diff --git a/AnimalSitter/AnimalSitter.cs b/AnimalSitter/AnimalSitter.cs index c0e4d8c..e43bbb9 100644 --- a/AnimalSitter/AnimalSitter.cs +++ b/AnimalSitter/AnimalSitter.cs @@ -61,6 +61,8 @@ public class AnimalSitter : Mod // A string defining the locations of specific chests. private string ChestDefs = ""; + private bool isFirstTimeTruffle = true; + private ModConfig Config; private DialogueManager DialogueManager; @@ -83,6 +85,12 @@ public override void Entry(IModHelper helper) helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded; helper.Events.Input.ButtonPressed += this.OnButtonPressed; helper.Events.GameLoop.GameLaunched += this.OnGameLaunched; + helper.Events.GameLoop.DayStarted += this.OnDayStarted; + } + + private void OnDayStarted(object sender, DayStartedEventArgs e) + { + this.isFirstTimeTruffle = true; } /// Raised after the player loads a save slot. @@ -311,12 +319,13 @@ private void IterateOverAnimals() if (animal.type.Value == "Pig") { - if (this.TakeTrufflesFromPigs) + if (this.TakeTrufflesFromPigs && this.isFirstTimeTruffle) { Object toAdd = new Object(animal.currentProduce.Value, 1, false, -1, animal.produceQuality.Value); this.AddItemToInventory(toAdd, farmer); stats.TrufflesHarvested++; + this.isFirstTimeTruffle = false; } } else diff --git a/AnimalSitter/manifest.json b/AnimalSitter/manifest.json index 442bd41..8bff33a 100644 --- a/AnimalSitter/manifest.json +++ b/AnimalSitter/manifest.json @@ -1,7 +1,7 @@ { "Name": "Animal Sitter LTS", "Author": "oliver", - "Version": "2.2.0", + "Version": "2.2.1", "Description": "Long Term Support Mod Version for Animal Sitter Mod. Let someone else pet all those pesky animals!", "UniqueID": "oliver.AnimalSitterLTS", "EntryDll": "AnimalSitter.dll",