public void SetPhysics(int level) { if (physics == 0 && level != 0 && blocks != null) { for (int i = 0; i < blocks.Length; i++) { // Optimization hack, since no blocks under 183 ever need a restart if (blocks[i] > 183 && Block.NeedRestart(blocks[i])) { AddCheck(i); } } } if (physics != level) { OnPhysicsLevelChangedEvent.Call(this, level); } if (level > 0 && physics == 0) { StartPhysics(); } Physicsint = level; Config.Physics = level; }
void InitServerTask(SchedulerTask task) { Server.Start(); // The first check for updates is run after 10 seconds, subsequent ones every two hours Server.Background.QueueRepeat(Updater.UpdaterTask, null, TimeSpan.FromSeconds(10)); OnPlayerConnectEvent.Register(Player_PlayerConnect, Priority.Low); OnPlayerDisconnectEvent.Register(Player_PlayerDisconnect, Priority.Low); OnSentMapEvent.Register(Player_OnJoinedLevel, Priority.Low); OnLevelAddedEvent.Register(Level_LevelAdded, Priority.Low); OnLevelRemovedEvent.Register(Level_LevelRemoved, Priority.Low); OnPhysicsLevelChangedEvent.Register(Level_PhysicsLevelChanged, Priority.Low); RunOnUI_Async(() => main_btnProps.Enabled = true); }
public void SetPhysics(int level) { if (physics == 0 && level != 0 && blocks != null) { for (int i = 0; i < blocks.Length; i++) { // Optimization hack, since no blocks under 183 ever need a restart if (blocks[i] > 183 && Block.NeedRestart(blocks[i])) { AddCheck(i); } } } if (physics != level) { OnPhysicsLevelChangedEvent.Call(this, level); } physics = level; //StartPhysics(); This isnt needed, the physics will start when we set the new value above }