/********* ** Public methods *********/ /// <summary>The mod entry point, called after the mod is first loaded.</summary> /// <param name="helper">Provides methods for interacting with the mod directory, such as read/writing a config file or custom JSON files.</param> public override void Entry(IModHelper helper) { // init this.Config = helper.ReadConfig <ModConfig>(); this.Factory = new MachineFactory(this.Config.Connectors, this.Config.AutomateShippingBin); // hook events IModEvents events = this.Helper.Events; SaveEvents.AfterLoad += this.SaveEvents_AfterLoad; PlayerEvents.Warped += this.PlayerEvents_Warped; events.World.LocationListChanged += this.World_LocationListChanged; events.World.ObjectListChanged += this.World_ObjectListChanged; GameEvents.UpdateTick += this.GameEvents_UpdateTick; events.Input.ButtonPressed += this.Input_ButtonPressed; if (this.Config.Connectors.Any(p => p.Type == ObjectType.Floor)) { events.World.TerrainFeatureListChanged += this.World_TerrainFeatureListChanged; } // log info if (this.Config.VerboseLogging) { this.Monitor.Log($"Verbose logging is enabled. This is useful when troubleshooting but can impact performance. It should be disabled if you don't explicitly need it. You can delete {Path.Combine(this.Helper.DirectoryPath, "config.json")} and restart the game to disable it.", LogLevel.Warn); } this.VerboseLog($"Initialised with automation every {this.Config.AutomationInterval} ticks."); }
/********* ** Public methods *********/ /// <summary>The mod entry point, called after the mod is first loaded.</summary> /// <param name="helper">Provides methods for interacting with the mod directory, such as read/writing a config file or custom JSON files.</param> public override void Entry(IModHelper helper) { // init this.Config = helper.ReadConfig <ModConfig>(); this.Factory = new MachineFactory(this.Config.Connectors); // hook events SaveEvents.AfterLoad += this.SaveEvents_AfterLoad; PlayerEvents.Warped += this.PlayerEvents_Warped; LocationEvents.LocationsChanged += this.LocationEvents_LocationsChanged; LocationEvents.ObjectsChanged += this.LocationEvents_ObjectsChanged; GameEvents.UpdateTick += this.GameEvents_UpdateTick; // handle player interaction InputEvents.ButtonPressed += this.InputEvents_ButtonPressed; // log info if (this.Config.VerboseLogging) { this.Monitor.Log($"Verbose logging is enabled. This is useful when troubleshooting but can impact performance. It should be disabled if you don't explicitly need it. You can delete {Path.Combine(this.Helper.DirectoryPath, "config.json")} and restart the game to disable it.", LogLevel.Warn); } this.VerboseLog($"Initialised with automation every {this.Config.AutomationInterval} ticks."); }
/********* ** Public methods *********/ /// <summary>The mod entry point, called after the mod is first loaded.</summary> /// <param name="helper">Provides methods for interacting with the mod directory, such as read/writing a config file or custom JSON files.</param> public override void Entry(IModHelper helper) { // init this.Config = helper.ReadConfig <ModConfig>(); this.Factory = new MachineFactory(this.Config.Connectors, this.Config.AutomateShippingBin); // hook events IModEvents events = this.Helper.Events; SaveEvents.AfterLoad += this.SaveEvents_AfterLoad; PlayerEvents.Warped += this.PlayerEvents_Warped; events.World.LocationListChanged += this.World_LocationListChanged; events.World.ObjectListChanged += this.World_ObjectListChanged; GameEvents.UpdateTick += this.GameEvents_UpdateTick; events.Input.ButtonPressed += this.Input_ButtonPressed; if (this.Config.Connectors.Any(p => p.Type == ObjectType.Floor)) { events.World.TerrainFeatureListChanged += this.World_TerrainFeatureListChanged; } // log info this.Monitor.VerboseLog($"Initialised with automation every {this.Config.AutomationInterval} ticks."); }