From 8ab5d384da837155f12bd1476295e7fbd140e8f1 Mon Sep 17 00:00:00 2001 From: kremsy Date: Wed, 22 Mar 2017 19:12:38 +0100 Subject: [PATCH] new callbacks are only supported in some modes, so leave backwards compatiblity in --- core/Server/ScriptManager.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/Server/ScriptManager.php b/core/Server/ScriptManager.php index a6e232e2..ef8c0727 100644 --- a/core/Server/ScriptManager.php +++ b/core/Server/ScriptManager.php @@ -36,7 +36,7 @@ class ScriptManager { * @param bool $enable * @return bool */ - public function enableScriptCallbacks($enable = true) { + public function enableScriptCallbacks() { if (!$this->isScriptMode()) { return false; } @@ -47,7 +47,14 @@ class ScriptManager { return false; } - //TODO verify that the old S_ isnt needed anymore + //TODO remove later, than only the last 2 lines are needed in future + if (!array_key_exists('S_UseScriptCallbacks', $scriptSettings)) { + return false; + } + $scriptSettings['S_UseScriptCallbacks'] = true; + $this->maniaControl->getClient()->setModeScriptSettings($scriptSettings); + + $this->maniaControl->getModeScriptEventManager()->enableCallbacks(); Logger::logInfo("Script Callbacks successfully enabled!");