From 2ef0568dda0e87b2419460c1351264a76d3ff970 Mon Sep 17 00:00:00 2001 From: Max Yari Date: Fri, 21 Jun 2024 16:53:11 +0200 Subject: [PATCH] Changed lua enum name, tweaked docs --- apps/openmw/mwlua/localscripts.cpp | 4 ++-- files/lua_api/openmw/self.lua | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwlua/localscripts.cpp b/apps/openmw/mwlua/localscripts.cpp index e9c3ea3662..d2ef661bc7 100644 --- a/apps/openmw/mwlua/localscripts.cpp +++ b/apps/openmw/mwlua/localscripts.cpp @@ -63,8 +63,8 @@ namespace MWLua selfAPI["controls"] = sol::readonly_property([](SelfObject& self) { return &self.mControls; }); selfAPI["isActive"] = [](SelfObject& self) { return &self.mIsActive; }; selfAPI["enableAI"] = [](SelfObject& self, bool v) { self.mControls.mDisableAI = !v; }; - selfAPI["attackType"] = LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs( - { { "NoAttack", 0 }, { "Chop", 1 }, { "Slash", 2 }, { "Thrust", 3 } })); + selfAPI["AttackTYPE"] = LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs( + { { "NoAttack", 0 }, { "Attack", 1 }, { "Chop", 1 }, { "Slash", 2 }, { "Thrust", 3 } })); using AiPackage = MWMechanics::AiPackage; sol::usertype aiPackage = context.mLua->sol().new_usertype("AiPackage"); diff --git a/files/lua_api/openmw/self.lua b/files/lua_api/openmw/self.lua index 60b5f563a5..9f13f6a8bf 100644 --- a/files/lua_api/openmw/self.lua +++ b/files/lua_api/openmw/self.lua @@ -37,7 +37,14 @@ -- @field [parent=#ActorControls] #boolean run true - run, false - walk -- @field [parent=#ActorControls] #boolean sneak If true - sneak -- @field [parent=#ActorControls] #boolean jump If true - initiate a jump --- @field [parent=#ActorControls] #number use Possible values: 0 - 3. If above 0 - activates the readied weapon/spell. For weapons, keeping at a non-zero value will charge the attack until set to 0. For melee weapons on AI-disabled actors - values 1 - 3 determine an attack type: 1 - chop, 2 - slash, 3 - thrust. +-- @field [parent=#ActorControls] #number Accepts an @{#AttackTYPE} value. Activates the readied weapon/spell according to a provided value. For weapons, keeping this value modified will charge the attack until set to @{#AttackTYPE.NoAttack}. + +-- @type AttackTYPE +-- @field #number NoAttack +-- @field #number Attack +-- @field #number Chop +-- @field #number Swing +-- @field #number Thrust --- -- Enables or disables standard AI (enabled by default).