These are like ScriptAssert, but make use of the fmt library (atm hijacking the version that comes with spdlog). This allows us to pass in a format string and some args, and then only create the format string if there's an actual error. This means we won't waste time doing a ton of std::string concatenations if the assert succeeds.
As these are variadic templates, we can't use a std::optional as the last argument to check if we're forcing a different error mode (we possibly could by assuming the last arg is a std::optional, but that seems unclean), so instead I've just separated them out into two functions.
SetErrorMode is called via Lua in settings.lua to allow us or the LD to choose between the three ERROR_MODEs for script asserts.
ScriptWarn is for when we want to follow up on a failed assert in ERROR_MODE::WARN. e.g. if the player gives in an invalid HP value, we would ScriptWarn to tell them that the HP is being set to zero instead. If we added this information in ScriptAssert, we would end up displaying this message in TERMINATE mode, too - which is incorrect, since we won't have set the HP to zero, as we will have terminated the game.
This is to be used when an error is discovered in a Lua Script.
The var ScriptErrorMode refers to the error mode the user has chosen (silent, warn, terminate). At the moment this is hardcoded but will soon become editable to a LD via settings.
ScriptAssert will read this variable and take the appropriate action when an assert is failed.
IGNORE will do nothing (we should make a note in the documentation that this should almost certainly not be used by the LD if they can avoid it).
WARN will call TENLog with LogLevel::Warn.
TERMINATE will throw a TENScriptException, where it will be caught at GameMain, where TENLog will be called.
There are circumstances where we will HAVE to terminate, even if the user has opted not to (i.e. errors where there is nothing sensible that can be done, such as syntax errors that would terminate Lua anyway). For these, we can pass in ERROR_MODE::TERMINATE as the last variable.