diff --git a/src/script/api/script_object.cpp b/src/script/api/script_object.cpp index 950362cd8a..8beed08a52 100644 --- a/src/script/api/script_object.cpp +++ b/src/script/api/script_object.cpp @@ -23,6 +23,7 @@ #include "../script_storage.hpp" #include "../script_instance.hpp" #include "../script_fatalerror.hpp" +#include "script_controller.hpp" #include "script_error.hpp" #include "../../debug.h" @@ -383,6 +384,12 @@ ScriptObject::ActiveInstance::~ActiveInstance() } else if (_networking) { /* Suspend the script till the command is really executed. */ throw Script_Suspend(-(int)GetDoCommandDelay(), callback); + } else if (GetActiveInstance()->GetScriptType() == ST_GS && (_pause_mode & PM_PAUSED_GAME_SCRIPT) != PM_UNPAUSED) { + /* Game is paused due to GS, just execute as fast as possible */ + IncreaseDoCommandCosts(res.GetCost()); + ScriptController::DecreaseOps(100); + callback(GetActiveInstance()); + throw SQInteger(1); } else { IncreaseDoCommandCosts(res.GetCost()); diff --git a/src/script/script_instance.hpp b/src/script/script_instance.hpp index df59d31bcb..e66ff4a80a 100644 --- a/src/script/script_instance.hpp +++ b/src/script/script_instance.hpp @@ -329,6 +329,8 @@ private: static bool LoadObjects(HSQUIRRELVM vm, ScriptData *data); public: + inline ScriptType GetScriptType() const { return this->script_type; } + inline bool IsTextParamMismatchAllowed() const { return this->allow_text_param_mismatch; } };