-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cac7d7b
commit 2e09a9b
Showing
11 changed files
with
165 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 33 additions & 16 deletions
49
GreenhouseSprinklers/GreenhouseSprinklers/Controllers/TimeOfDayController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,53 @@ | ||
using StardewModdingAPI.Events; | ||
using System; | ||
using StardewModdingAPI; | ||
using StardewValley; | ||
using System.Linq; | ||
|
||
namespace Bpendragon.GreenhouseSprinklers | ||
{ | ||
partial class ModEntry | ||
{ | ||
internal void OnDayStart(object sender, DayStartedEventArgs e) | ||
{ | ||
WaterGreenHouse(); | ||
this.Monitor.Log("Day starting"); | ||
Monitor.Log("Day starting"); | ||
if (Data.FirstUpgrade) | ||
{ | ||
this.Monitor.Log("first upgrade owned, watering"); | ||
|
||
Monitor.Log("first upgrade owned, watering"); | ||
WaterGreenHouse(); | ||
} | ||
if(Data.FinalUpgrade) | ||
{ | ||
Monitor.Log("final ugrade owned, watering entire farm"); | ||
WaterFarm(); | ||
} | ||
} | ||
|
||
internal void OnDayEnding(object sender, DayEndingEventArgs e) | ||
{ | ||
this.Monitor.Log("Day ending"); | ||
if (Data.SecondUpgrade) | ||
Monitor.Log("Day ending"); | ||
if (Data.SecondUpgrade) //run these checks before we check for upgrades | ||
{ | ||
this.Monitor.Log("second upgrade owned, watering"); | ||
Monitor.Log("second upgrade owned, watering"); | ||
WaterGreenHouse(); | ||
} | ||
} | ||
|
||
internal void OnTimeChanged(object sender, TimeChangedEventArgs e) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
|
||
if (Data.FinalUpgrade) | ||
{ | ||
Monitor.Log("final ugrade owned, watering entire farm"); | ||
WaterFarm(); | ||
} | ||
if (!Data.FinalUpgrade) | ||
{ | ||
var silo = Game1.getFarm().buildings.Where(x => x.buildingType == "Silo" && x.daysUntilUpgrade == 1).FirstOrDefault(); | ||
if (silo != null) | ||
{ | ||
Monitor.Log("Silo \"Upgrade\" completed, moving to next level"); | ||
silo.daysUntilUpgrade.Value = 0; | ||
if (!Data.FirstUpgrade) Data.FirstUpgrade = true; | ||
else if (!Data.SecondUpgrade) Data.SecondUpgrade = true; | ||
else if (!Data.FinalUpgrade) Data.FinalUpgrade = true; | ||
else Monitor.Log("Tried to Upgrade sprinklers while all upgrades already completed", LogLevel.Error); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.