Ejemplo n.º 1
0
        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);
    }
Ejemplo n.º 3
0
        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);
            }
        }