/// <summary>The mod entry point, called after the mod is first loaded.</summary> /// <param name="helper">Provides simplified APIs for writing mods.</param> public override void Entry(IModHelper helper) { _config = helper.ReadJsonFile <ItemCollectorConfiguration>("ItemCollectorConfiguration.json"); GameEvents.GameLoaded += GameEvents_GameLoaded; TimeEvents.DayOfMonthChanged += TimeEvents_DayOfMonthChanged; TimeEvents.TimeOfDayChanged += TimeEvents_TimeOfDayChanged; PlayerEvents.InventoryChanged += PlayerEvents_InventoryChanged; #if DEBUG // allow keypresses to initiate events for easier debugging. ControlEvents.KeyPressed += this.ControlEvents_KeyPressed; #endif }
public ItemCollectorMod() { Log.Info($"Initalizing {nameof(ItemCollectorMod)}"); _config = ConfigurationBase.LoadConfiguration <ItemCollectorConfiguration>(); ItemFinder.ConnectorItems = new List <string>(_config.ItemsToConsiderConnectors.Split(',').Select(v => v.Trim())); ItemFinder.ConnectorFloorings = _config.FlooringsToConsiderConnectors; var machinesToCollectFrom = _config.MachinesToCollectFrom.Split(',').Select(v => v.Trim()).ToList(); var locationsToSearch = _config.LocationsToSearch.Split(',').Select(v => v.Trim()).ToList(); _machinesProcessor = new MachinesProcessor(machinesToCollectFrom, locationsToSearch, _config.AddBuildingsToLocations, _config.AllowDiagonalConnectionsForAllItems) { MuteWhileCollectingFromMachines = Math.Max(0, Math.Min(5000, _config.MuteWhileCollectingFromMachines)) }; _animalHouseProcessor = new AnimalHouseProcessor(_config.PetAnimals, _config.AdditionalFriendshipFromCollecting, _config.MuteAnimalsWhenCollecting); }