示例#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
 protected virtual void checkParticles(WorldBase _world, int _clrIdx, Vector3i _blockPos, BlockValue _blockValue)
 {
     if (this.particleName != null && !_world.GetGameManager().HasBlockParticleEffect(_blockPos))
     {
         this.addParticles(_world, _clrIdx, _blockPos.x, _blockPos.y, _blockPos.z, _blockValue);
     }
 }
示例#3
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);
    }
    public override bool OnBlockActivated(WorldBase _world, int _cIdx, Vector3i _blockPos, BlockValue _blockValue, EntityAlive _player)
    {
        TileEntityPoweredWorkstationSDX tileEntityWorkstation = (TileEntityPoweredWorkstationSDX)_world.GetTileEntity(_cIdx, _blockPos);

        if (tileEntityWorkstation == null)
        {
            return(false);
        }
        _player.AimingGun = false;
        Vector3i blockPos = tileEntityWorkstation.ToWorldPos();

        _world.GetGameManager().TELockServer(_cIdx, blockPos, tileEntityWorkstation.entityId, _player.entityId);
        return(true);
    }
示例#6
0
    /**
     * This is called when the player presses the activation key (usually E) on the block.
     */

    public override bool OnBlockActivated(WorldBase _world, int _cIdx, Vector3i _blockPos, BlockValue _blockValue, EntityAlive _player)
    {
        TileEntityBlockTransformer tileEntityBlockTransformer = _world.GetTileEntity(_cIdx, _blockPos) as TileEntityBlockTransformer;

        if (tileEntityBlockTransformer == null)
        {
            return(false);
        }
        _player.AimingGun = false;
        Vector3i blockPos = tileEntityBlockTransformer.ToWorldPos();

        tileEntityBlockTransformer.bWasTouched = tileEntityBlockTransformer.bTouched;
        _world.GetGameManager().TELockServer(_cIdx, blockPos, tileEntityBlockTransformer.entityId, _player.entityId);
        return(true);
    }
示例#7
0
    protected virtual void addParticles(WorldBase _world, int _clrIdx, int _x, int _y, int _z, BlockValue _blockValue)
    {
        if (this.particleName == null || this.particleName == string.Empty)
        {
            return;
        }
        float num = 0f;

        if (_y > 0 && Block.list[_blockValue.type].IsTerrainDecoration && Block.list[_world.GetBlock(_x, _y - 1, _z).type].shape.IsTerrain())
        {
            sbyte density  = _world.GetDensity(_clrIdx, _x, _y, _z);
            sbyte density2 = _world.GetDensity(_clrIdx, _x, _y - 1, _z);
            num = MarchingCubes.GetDecorationOffsetY(density, density2);
        }
        _world.GetGameManager().SpawnBlockParticleEffect(new Vector3i(_x, _y, _z), new ParticleEffect(this.particleName, new Vector3((float)_x, (float)_y + num, (float)_z) + this.getParticleOffset(_blockValue), this.shape.GetRotation(_blockValue), 1f, Color.white));
    }
示例#8
0
    /**
     * Called when a block is destroyed by an entity. It cam be useful for separating things out if needed depending on what
     * entity destroyed it.
     */

    public override bool OnBlockDestroyedBy(WorldBase _world, int _clrIdx, Vector3i _blockPos, BlockValue _blockValue, int _entityId, bool _bUseHarvestTool)
    {
        TileEntityBlockTransformer tileEntityBlockTransformer = _world.GetTileEntity(_clrIdx, _blockPos) as TileEntityBlockTransformer;

        if (tileEntityBlockTransformer != null)
        {
            tileEntityBlockTransformer.OnDestroy();
        }
        LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(GameManager.Instance.World.GetEntity(_entityId) as EntityPlayerLocal);

        if (null != uiforPlayer && uiforPlayer.windowManager.IsWindowOpen("looting") && ((XUiC_LootWindow)uiforPlayer.xui.GetWindow("windowLooting").Controller).GetLootBlockPos() == _blockPos)
        {
            uiforPlayer.windowManager.Close("looting");
        }
        if (tileEntityBlockTransformer != null)
        {
            _world.GetGameManager().DropContentOfLootContainerServer(_blockValue, _blockPos, tileEntityBlockTransformer.entityId);
        }
        return(true);
    }
示例#9
0
    public override BlockActivationCommand[] GetBlockActivationCommands(WorldBase _world, BlockValue _blockValue, int _clrIdx, Vector3i _blockPos, EntityAlive _entityFocusing)
    {
        TileEntitySign tileEntitySign = (TileEntitySign)_world.GetTileEntity(_clrIdx, _blockPos);

        if (tileEntitySign == null)
        {
            return(new BlockActivationCommand[0]);
        }
        string @string = GamePrefs.GetString(EnumGamePrefs.PlayerId);
        PersistentPlayerData playerData = _world.GetGameManager().GetPersistentPlayerList().GetPlayerData(tileEntitySign.GetOwner());

        bool flag = !tileEntitySign.IsOwner(@string) && (playerData != null && playerData.ACL != null) && playerData.ACL.Contains(@string);

        this.cmds[0].enabled = true;
        this.cmds[1].enabled = (!tileEntitySign.IsLocked() && (tileEntitySign.IsOwner(@string) || flag));
        this.cmds[2].enabled = (tileEntitySign.IsLocked() && tileEntitySign.IsOwner(@string));
        this.cmds[3].enabled = ((!tileEntitySign.IsUserAllowed(@string) && tileEntitySign.HasPassword() && tileEntitySign.IsLocked()) || tileEntitySign.IsOwner(@string));
        this.cmds[4].enabled = ((!tileEntitySign.IsUserAllowed(@string) && tileEntitySign.HasPassword() && tileEntitySign.IsLocked()) || tileEntitySign.IsOwner(@string));

        return(this.cmds);
    }
示例#10
0
 protected virtual void removeParticles(WorldBase _world, int _x, int _y, int _z, BlockValue _blockValue)
 {
     _world.GetGameManager().RemoveBlockParticleEffect(new Vector3i(_x, _y, _z));
 }