diff --git a/MultiversalDiplomacy/Script/SetupScriptHandler.cs b/MultiversalDiplomacy/Script/SetupScriptHandler.cs
index 45f5b0f..19ae3ed 100644
--- a/MultiversalDiplomacy/Script/SetupScriptHandler.cs
+++ b/MultiversalDiplomacy/Script/SetupScriptHandler.cs
@@ -7,12 +7,17 @@ namespace MultiversalDiplomacy.Script;
///
/// A script handler for modifying a game before it begins.
///
-public class SetupScriptHandler(World world) : IScriptHandler
+public class SetupScriptHandler(World world, bool strict = false) : IScriptHandler
{
public string Prompt => "5dp> ";
public World World { get; private set; } = world;
+ ///
+ /// Whether unsuccessful commands should terminate the script.
+ ///
+ public bool Strict { get; } = strict;
+
public IScriptHandler? HandleInput(string input)
{
var args = input.Split(' ', StringSplitOptions.RemoveEmptyEntries);
@@ -74,14 +79,16 @@ public class SetupScriptHandler(World world) : IScriptHandler
if (ParseUnit(power, type, province, location, out Unit? newUnit)) {
World = World.Update(units: World.Units.Append(newUnit));
Console.WriteLine($"Created {newUnit}");
+ } else if (Strict) {
+ return null;
}
break;
default:
// noop on comments that begin with #
- if (!command.StartsWith('#')) {
- Console.WriteLine($"Unrecognized command: {command}");
- }
+ if (command.StartsWith('#')) break;
+ Console.WriteLine($"Unrecognized command: {command}");
+ if (Strict) return null;
break;
}