From 49a801b2b0dce4bd3b4abeee3e45ba0d7f2bee4d Mon Sep 17 00:00:00 2001 From: Efreak Date: Tue, 28 Feb 2017 14:59:10 -0800 Subject: toggle timefreeze when no value given --- src/TrainerMod/TrainerMod.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/TrainerMod/TrainerMod.cs b/src/TrainerMod/TrainerMod.cs index a1eef561..22ec2e66 100644 --- a/src/TrainerMod/TrainerMod.cs +++ b/src/TrainerMod/TrainerMod.cs @@ -104,7 +104,7 @@ namespace TrainerMod .Add("list_items", "Lists and searches items in the game data.\n\nUsage: list_items [search]\n- search (optional): an arbitrary search string to filter by.", this.HandleCommand) .Add("world_settime", "Sets the time to the specified value.\n\nUsage: world_settime \n- value: the target time in military time (like 0600 for 6am and 1800 for 6pm)", this.HandleCommand) - .Add("world_freezetime", "Freezes or resumes time.\n\nUsage: world_freezetime \n- value: one of 0 (resume) or 1 (freeze).", this.HandleCommand) + .Add("world_freezetime", "Freezes or resumes time.\n\nUsage: world_freezetime [value]\n- value: one of 0 (resume), 1 (freeze) or blank (toggle).", this.HandleCommand) .Add("world_setday", "Sets the day to the specified value.\n\nUsage: world_setday .\n- value: the target day (a number from 1 to 28).", this.HandleCommand) .Add("world_setseason", "Sets the season to the specified value.\n\nUsage: world_setseason \n- value: the target season (one of 'spring', 'summer', 'fall', 'winter').", this.HandleCommand) .Add("world_downminelevel", "Goes down one mine level?", this.HandleCommand) @@ -381,13 +381,24 @@ namespace TrainerMod this.Monitor.Log("Time is now " + (this.FreezeTime ? "frozen" : "thawed"), LogLevel.Info); } else - this.Monitor.Log(" should be 0 or 1", LogLevel.Error); + this.Monitor.Log(" should be 0, 1, or empty", LogLevel.Error); } else this.LogValueNotInt32(); } else - this.LogValueNotSpecified(); + int valu = 1; + if (this.FreezeTime == false) + { + valu = 1; + } + else + { + valu = 0; + } + this.FreezeTime = valu == 1; + this.FrozenTime = this.FreezeTime ? Game1.timeOfDay : 0; + this.Monitor.Log("Time is now " + (this.FreezeTime ? "frozen" : "thawed"), LogLevel.Info); break; case "world_settime": -- cgit