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); }
void Update() { if (BlockNeonSign.isBlockPoweredUp(blockPos, cIdx)) { isSignActive = true; } else { isSignActive = false; nextStateChangeTime = default(DateTime); } if (isSignActive) { if (litSignObject != null && flicker) { litSignObject.active = !litSignObject.active; return; } if (flash) { //Flashing if (nextStateChangeTime == default(DateTime)) { nextStateChangeTime = DateTime.Now; } if (DateTime.Now > nextStateChangeTime) { if (litSignObject != null && litSignObject.active) { litSignObject.active = false; } else { litSignObject.active = true; } nextStateChangeTime = DateTime.Now.AddSeconds(flashSpeed); } } else { //No Flashing if (litSignObject != null && !litSignObject.active) { litSignObject.active = true; } } } else { if (litSignObject != null && litSignObject.active) { litSignObject.active = false; } } }