From 56ea3e3879491582e539317d3c726f87b980ebac Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 15 Sep 2023 18:49:46 +0400 Subject: [PATCH] Add a way to toggle AI to Lua debug package --- apps/openmw/mwlua/debugbindings.cpp | 5 +++++ files/lua_api/openmw/debug.lua | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/apps/openmw/mwlua/debugbindings.cpp b/apps/openmw/mwlua/debugbindings.cpp index 7f64188ff5..41b8092e37 100644 --- a/apps/openmw/mwlua/debugbindings.cpp +++ b/apps/openmw/mwlua/debugbindings.cpp @@ -3,7 +3,9 @@ #include "luamanagerimp.hpp" #include "../mwbase/environment.hpp" +#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/world.hpp" + #include "../mwrender/postprocessor.hpp" #include "../mwrender/renderingmanager.hpp" @@ -38,6 +40,9 @@ namespace MWLua api["toggleGodMode"] = []() { MWBase::Environment::get().getWorld()->toggleGodMode(); }; api["isGodMode"] = []() { return MWBase::Environment::get().getWorld()->getGodModeState(); }; + api["toggleAI"] = []() { MWBase::Environment::get().getMechanicsManager()->toggleAI(); }; + api["isAIEnabled"] = []() { return MWBase::Environment::get().getMechanicsManager()->isAIActive(); }; + api["toggleCollision"] = []() { MWBase::Environment::get().getWorld()->toggleCollisionMode(); }; api["isCollisionEnabled"] = []() { auto world = MWBase::Environment::get().getWorld(); diff --git a/files/lua_api/openmw/debug.lua b/files/lua_api/openmw/debug.lua index fba649c16e..fdce2dedf8 100644 --- a/files/lua_api/openmw/debug.lua +++ b/files/lua_api/openmw/debug.lua @@ -35,6 +35,15 @@ -- @function [parent=#Debug] isGodMode -- @return #boolean +--- +-- Toggles AI +-- @function [parent=#Debug] toggleAI + +--- +-- Is AI enabled +-- @function [parent=#Debug] isAIEnabled +-- @return #boolean + --- -- Toggles collisions -- @function [parent=#Debug] toggleCollision