From 3b52208c87deb61f2645300beb991fb044844ceb Mon Sep 17 00:00:00 2001 From: FutureRave Date: Fri, 14 Jan 2022 00:21:14 +0000 Subject: [PATCH] Add script function from bo2 for good mesure --- src/Components/Modules/Script.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Components/Modules/Script.cpp b/src/Components/Modules/Script.cpp index d2230086..6fd1554e 100644 --- a/src/Components/Modules/Script.cpp +++ b/src/Components/Modules/Script.cpp @@ -643,6 +643,22 @@ namespace Components Script::ScriptStorage.clear(); }); + Script::AddFunction("AreControlsFrozen", [](Game::scr_entref_t entref) // Usage: self AreControlsFrozen(); + { + auto* ent = Script::GetEntFromEntRef(entref); + + if (ent->client == nullptr) + { + Game::Scr_ObjectError(Utils::String::VA("Entity %u is not a player", entref)); + return; + } + + const auto isToggled = (ent->client->flags & Game::PLAYER_FLAG_FROZEN) + ? 1 : 0; + + Game::Scr_AddInt(isToggled); + }); + Script::AddFunction("DebugCode", [](Game::scr_entref_t) // gsc: DebugCode() { if (Game::Scr_GetNumParam() != 1u)