From ace810c8b39e53c0360a1ce7ebae3fcad1c03bdd Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Sat, 26 Oct 2013 05:36:34 -0400 Subject: [PATCH] Add toggles for pumpkin moon --- TShockAPI/ConfigFile.cs | 4 ++++ TShockAPI/TShock.cs | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 6f66607e..6ca3ddbe 100755 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -276,6 +276,10 @@ namespace TShockAPI [Description("Forces your world to be in Halloween mode regardless of the data.")] public bool ForceHalloween = false; + [Description("Disables the pumpkin moon when the night is over, regardless of wave.")] public bool DisablePumpkinMoonOnDaybreak = false; + + [Description("Disables the pumpkin moon when the night is over if you reached wave 15.")] public bool DisablePumpkinMoonAfterWave15 = false; + /// /// Reads a configuration file from a given path /// diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index d215df12..c72a86de 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -648,6 +648,7 @@ namespace TShockAPI } } + private bool lastTickDay = false; private void OnSecondUpdate() { if (Config.ForceTime != "normal") @@ -662,6 +663,20 @@ namespace TShockAPI break; } } + + if (!lastTickDay && Main.dayTime) + { + lastTickDay = true; + if (Config.DisablePumpkinMoonOnDaybreak || (Config.DisablePumpkinMoonAfterWave15 && NPC.waveCount == 15)) + { + Main.pumpkinMoon = false; + } + + } + else if (lastTickDay && !Main.dayTime) + { + lastTickDay = false; + } foreach (TSPlayer player in Players) {