public override void UpdatingStopped() { base.UpdatingStopped(); Log.Entered(); ComponentSession.RaiseSessionEventImmediately(ComponentEventNames.UpdatingStopped); IsUpdatingStopped = true; }
public Session() { // Only load if the steam version has been loaded too. var steamComponent = ReflectionHelper.FindModSessionComponent("GardenConquest", 450540708, "Steam", "GC.Notify"); if (steamComponent == null) { return; } Log.Log("GC steam component found, loading mod."); Log.Trace("Registering session components"); ComponentSession.RegisterComponentGroup((int)Groups.Sessions); //UpdateManager.RegisterSessionComponent(new ServerTestSession()); Log.Trace("Registering entity components"); //UpdateManager.RegisterEntityComponent( // ((e) => { return new EnforcedGrid(e); }), // typeof(MyObjectBuilder_CubeGrid), // RunLocation.Server); //UpdateManager.RegisterEntityComponent( // ((e) => { // return LootCrate.IsLootCrate(e) ? // new LootCrate(e) : // null; // }), // typeof(MyObjectBuilder_CubeGrid), // RunLocation.Server); // Tell the steam code we've loaded successfully. ReflectionHelper.SetInstanceField(steamComponent, "PluginLoaded", true); }
private void SessionClosed() { Log.Entered(); ComponentSession.Close(); // Send close event to ComponentSession dependencies Profiler.Close(); Logger.Close(); MyAPIGateway.Entities.OnCloseAll -= SessionClosed; SessionClosedAttached = false; }
public override void UpdateAfterSimulation() { base.UpdateAfterSimulation(); if (IsUpdatingStopped) { UpdatingResumed(); } if (!SessionClosedAttached && MyAPIGateway.Entities != null) { Log.Trace("Attaching SessionClosed"); MyAPIGateway.Entities.OnCloseAll += SessionClosed; SessionClosedAttached = true; } ComponentSession.Update(); }
private void UpdatingResumed() { Log.Entered(); ComponentSession.RaiseSessionEvent(ComponentEventNames.UpdatingResumed); IsUpdatingStopped = false; }
public override void SaveData() { base.SaveData(); Log.Entered(); ComponentSession.RaiseSessionEventImmediately(ComponentEventNames.SessionSave); }
public MySession() : base() { Log.Entered(); ComponentSession.Open(); }