示例#1
0
    public override BlockActivationCommand[] GetBlockActivationCommands(WorldBase _world, BlockValue _blockValue, int _clrIdx, Vector3i _blockPos, EntityAlive _entityFocusing)
    {
        var tileEntity       = _world.GetTileEntity(_clrIdx, _blockPos);
        var secureLootEntity = tileEntity as TileEntitySecureLootContainer;

        if (secureLootEntity == null)
        {
            return(new BlockActivationCommand[0]);
        }
        string _steamID = GamePrefs.GetString(EnumGamePrefs.PlayerId);
        PersistentPlayerData playerData = _world.GetGameManager().GetPersistentPlayerList().GetPlayerData(secureLootEntity.GetOwner());
        bool flag = !secureLootEntity.IsOwner(_steamID) && (playerData != null && playerData.ACL != null && playerData.ACL.Contains(_steamID));

        _activationCommands[0].enabled = true;
        _activationCommands[1].enabled = !secureLootEntity.IsLocked() && (secureLootEntity.IsOwner(_steamID) || flag);
        _activationCommands[2].enabled = secureLootEntity.IsLocked() && secureLootEntity.IsOwner(_steamID);
        _activationCommands[3].enabled = !secureLootEntity.IsUserAllowed(_steamID) && secureLootEntity.HasPassword() && secureLootEntity.IsLocked() || secureLootEntity.IsOwner(_steamID);
        bool isMyLandProtectedBlock = _world.IsMyLandProtectedBlock(_blockPos, _world.GetGameManager().GetPersistentLocalPlayer(), false);

        _activationCommands[4].enabled = isMyLandProtectedBlock && secureLootEntity.IsOwner(_steamID) && _takeDelay > 0.0;

        _activationCommands[5].enabled = secureLootEntity.IsOwner(_steamID);

        return(_activationCommands);
    }
示例#2
0
    public override bool OnBlockActivated(WorldBase _world, int _clrIdx, Vector3i _blockPos, BlockValue _blockValue, EntityAlive _player)
    {
        bool flag = _world.IsMyLandProtectedBlock(_blockPos, _world.GetGameManager().GetPersistentLocalPlayer());

        if (!flag)
        {
            return(false);
        }
        this.TakeItemWithTimer(_clrIdx, _blockPos, _blockValue, _player);
        return(true);
    }
    public override BlockActivationCommand[] GetBlockActivationCommands(WorldBase _world, BlockValue _blockValue, int _clrIdx, Vector3i _blockPos, EntityAlive _entityFocusing)
    {
        bool       flag = _world.IsMyLandProtectedBlock(_blockPos, _world.GetGameManager().GetPersistentLocalPlayer(), false);
        TileEntity tileEntityWorkstation = (TileEntity)_world.GetTileEntity(_clrIdx, _blockPos);
        bool       flag2 = false;

        if (tileEntityWorkstation != null)
        {
            flag2 = (tileEntityWorkstation as TileEntityPoweredWorkstationSDX).IsPlayerPlaced;
        }
        this.cmds[1].enabled = (flag && flag2 && this.TakeDelay > 0f);
        return(this.cmds);
    }