Exemplo n.º 1
0
    public static bool isBlockPoweredUp(Vector3i _blockPos, int _clrIdx)
    {
        WorldBase world = GameManager.Instance.World;

        if (world.IsRemote())
        {
            //Use HasActivePower power instead since directly powering blocks doesnt work on servers.
            return(BlockNeonSign.HasActivePower(world, _clrIdx, _blockPos));
        }
        TileEntityPowered tileEntityPowered = (TileEntityPowered)GameManager.Instance.World.GetTileEntity(_clrIdx, _blockPos);

        if (tileEntityPowered != null)
        {
            if (tileEntityPowered.IsPowered)
            {
                DebugMsg("Block Power Is On");
                return(true);
            }
        }
        if (BlockNeonSign.IsSpRemotePowerAllowed(_blockPos))
        {
            DebugMsg("No direct power found, checking for remote power");
            return(BlockNeonSign.HasActivePower(world, _clrIdx, _blockPos));
        }
        DebugMsg("Block Power Is Off");
        return(false);
    }