// Context: All public override void UpdateBeforeSimulation() { int newTimer = --Timer; if (newTimer <= 0) { Timer = 0; if (Constants.IsServer) { if (pending.Spawn(() => BuildState = ProjectorState.Idle)) { BuildState = ProjectorState.Building; } else { BuildState = ProjectorState.Idle; } } NeedsUpdate = MyEntityUpdateEnum.NONE; } else if (newTimer % 60 == 0) { if (Constants.IsServer) { if (newTimer < 1200) // < 20 seconds, every second { pending.Notify(Constants.msgTime + (newTimer / 60) + " seconds.", 1); } else if (newTimer % 600 == 0 && newTimer < 3600) // < 60 seconds, every 10 seconds { pending.Notify(Constants.msgTime + (newTimer / 60) + " seconds.", 2); } else if (newTimer % 3600 == 0) // >= 60 seconds, every minute { int minutes = newTimer / 3600; string msg = Constants.msgTime + minutes + " minute"; if (minutes > 1) { msg += "s."; } else { msg += "."; } pending.Notify(msg, 10); } } RefreshUI(); } }
// Context: All public override void UpdateBeforeSimulation() { int newTimer = --Timer; if (newTimer <= 0) { Timer = 0; if (Constants.IsServer) { if (pending.Spawn(() => BuildState = State.Idle)) { BuildState = State.Building; } else { BuildState = State.Idle; } } NeedsUpdate = MyEntityUpdateEnum.NONE; } else if (newTimer % 60 == 0) { if (Constants.IsServer) { if (newTimer < 1200) // < 20 seconds, every second { pending.Notify(Constants.msgTime + (newTimer / 60) + " seconds.", 1); } else if (newTimer % 600 == 0 && newTimer < 3600) // < 60 seconds, every 10 seconds { pending.Notify(Constants.msgTime + (newTimer / 60) + " seconds.", 2); } else if (newTimer % 3600 == 0) // >= 60 seconds, every minute { int minutes = newTimer / 3600; string msg = Constants.msgTime + minutes + " minute"; if (minutes > 1) { msg += "s."; } else { msg += "."; } pending.Notify(msg, 10); pending.UpdateBounds(); IMyEntity e = pending.GetOverlappingEntity(); if (e != null) { Constants.Notify(GetOverlapString(false, e), pending.Activator, 10); } int needed; string name; if (!pending.HasComponents(out needed, out name)) { Constants.Notify(GetCompsString(needed, name), pending.Activator, 10); } } } RefreshUI(); } }