private void OnEntityKill(ContainerIOEntity entity) { BuildingPrivlidge priv = entity.GetBuildingPrivilege(); if (priv == null) { return; } _ioEntity[priv.buildingID]?.Remove(entity); }
public void CreateInventory(bool giveUID) { this.inventory = new ItemContainer() { entityOwner = this, allowedContents = ((int)this.allowedContents == 0 ? ItemContainer.ContentsType.Generic : this.allowedContents), onlyAllowedItem = this.onlyAllowedItem, maxStackSize = this.maxStackSize }; this.inventory.ServerInitialize(null, this.numSlots); if (giveUID) { this.inventory.GiveUID(); } ContainerIOEntity containerIOEntity = this; this.inventory.onItemAddedRemoved = new Action <Item, bool>(containerIOEntity.OnItemAddedOrRemoved); }
private void OnEntitySpawned(ContainerIOEntity entity) { BuildingPrivlidge priv = entity.GetBuildingPrivilege(); if (priv == null) { return; } if (!_ioEntity.ContainsKey(priv.buildingID)) { _ioEntity[priv.buildingID] = new List <IOEntity> { entity }; } else { _ioEntity[priv.buildingID].Add(entity); } }