summaryrefslogtreecommitdiff
path: root/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/TrainerCommand.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-01-22 20:36:24 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-01-22 20:36:24 -0500
commit381de5eba9f9822c3483abdf64396cec794e3d03 (patch)
treee256864f213a6bdbcfddb526b326d11d9f1c91e5 /src/SMAPI.Mods.ConsoleCommands/Framework/Commands/TrainerCommand.cs
parent1670a2f3a6263da158db5231f60d42d529734209 (diff)
downloadSMAPI-381de5eba9f9822c3483abdf64396cec794e3d03.tar.gz
SMAPI-381de5eba9f9822c3483abdf64396cec794e3d03.tar.bz2
SMAPI-381de5eba9f9822c3483abdf64396cec794e3d03.zip
add test_input console command
Diffstat (limited to 'src/SMAPI.Mods.ConsoleCommands/Framework/Commands/TrainerCommand.cs')
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/TrainerCommand.cs22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/TrainerCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/TrainerCommand.cs
index 466b8f6e..6d5cae97 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/TrainerCommand.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/TrainerCommand.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
@@ -16,8 +16,11 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands
/// <summary>The command description.</summary>
public string Description { get; }
- /// <summary>Whether the command needs to perform logic when the game updates.</summary>
- public virtual bool NeedsUpdate { get; } = false;
+ /// <summary>Whether the command may need to perform logic when the player presses a button. This value shouldn't change.</summary>
+ public bool MayNeedInput { get; }
+
+ /// <summary>Whether the command may need to perform logic when the game updates. This value shouldn't change.</summary>
+ public bool MayNeedUpdate { get; }
/*********
@@ -31,7 +34,12 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands
/// <summary>Perform any logic needed on update tick.</summary>
/// <param name="monitor">Writes messages to the console and log file.</param>
- public virtual void Update(IMonitor monitor) { }
+ public virtual void OnUpdated(IMonitor monitor) { }
+
+ /// <summary>Perform any logic when input is received.</summary>
+ /// <param name="monitor">Writes messages to the console and log file.</param>
+ /// <param name="button">The button that was pressed.</param>
+ public virtual void OnButtonPressed(IMonitor monitor, SButton button) { }
/*********
@@ -40,10 +48,14 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands
/// <summary>Construct an instance.</summary>
/// <param name="name">The command name the user must type.</param>
/// <param name="description">The command description.</param>
- protected TrainerCommand(string name, string description)
+ /// <param name="mayNeedInput">Whether the command may need to perform logic when the player presses a button.</param>
+ /// <param name="mayNeedUpdate">Whether the command may need to perform logic when the game updates.</param>
+ protected TrainerCommand(string name, string description, bool mayNeedInput = false, bool mayNeedUpdate = false)
{
this.Name = name;
this.Description = description;
+ this.MayNeedInput = mayNeedInput;
+ this.MayNeedUpdate = mayNeedUpdate;
}
/// <summary>Log an error indicating incorrect usage.</summary>