diff --git a/CMakeLists.txt b/CMakeLists.txt index 1673c80a0c..9604c720fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,7 +82,7 @@ message(STATUS "Configuring OpenMW...") set(OPENMW_VERSION_MAJOR 0) set(OPENMW_VERSION_MINOR 51) set(OPENMW_VERSION_RELEASE 0) -set(OPENMW_LUA_API_REVISION 101) +set(OPENMW_LUA_API_REVISION 102) set(OPENMW_POSTPROCESSING_API_REVISION 3) set(OPENMW_VERSION_COMMITHASH "") diff --git a/apps/openmw/mwlua/magicbindings.cpp b/apps/openmw/mwlua/magicbindings.cpp index 3831cf656e..26dedcab6b 100644 --- a/apps/openmw/mwlua/magicbindings.cpp +++ b/apps/openmw/mwlua/magicbindings.cpp @@ -312,8 +312,11 @@ namespace MWLua [](const ESM::Spell& rec) -> bool { return !!(rec.mData.mFlags & ESM::Spell::F_Always); }); spellT["starterSpellFlag"] = sol::readonly_property( [](const ESM::Spell& rec) -> bool { return !!(rec.mData.mFlags & ESM::Spell::F_PCStart); }); + // Deprecated for consistency with other record types spellT["autocalcFlag"] = sol::readonly_property( [](const ESM::Spell& rec) -> bool { return !!(rec.mData.mFlags & ESM::Spell::F_Autocalc); }); + spellT["isAutocalc"] = sol::readonly_property( + [](const ESM::Spell& rec) -> bool { return !!(rec.mData.mFlags & ESM::Spell::F_Autocalc); }); spellT["effects"] = sol::readonly_property([lua = state.lua_state()](const ESM::Spell& rec) -> sol::table { return effectParamsListToTable(lua, rec.mEffects.mList); }); @@ -325,8 +328,11 @@ namespace MWLua }; enchantT["id"] = sol::readonly_property([](const ESM::Enchantment& rec) { return rec.mId.serializeText(); }); enchantT["type"] = sol::readonly_property([](const ESM::Enchantment& rec) -> int { return rec.mData.mType; }); + // Deprecated for consistency with other record types enchantT["autocalcFlag"] = sol::readonly_property( [](const ESM::Enchantment& rec) -> bool { return !!(rec.mData.mFlags & ESM::Enchantment::Autocalc); }); + enchantT["isAutocalc"] = sol::readonly_property( + [](const ESM::Enchantment& rec) -> bool { return !!(rec.mData.mFlags & ESM::Enchantment::Autocalc); }); enchantT["cost"] = sol::readonly_property([](const ESM::Enchantment& rec) -> int { return rec.mData.mCost; }); enchantT["charge"] = sol::readonly_property([](const ESM::Enchantment& rec) -> int { return rec.mData.mCharge; }); diff --git a/apps/openmw/mwlua/types/potion.cpp b/apps/openmw/mwlua/types/potion.cpp index 435bce9c9b..1fd8ef9c28 100644 --- a/apps/openmw/mwlua/types/potion.cpp +++ b/apps/openmw/mwlua/types/potion.cpp @@ -54,6 +54,9 @@ namespace } potion.mEffects.updateIndexes(); } + if (rec["isAutocalc"] != sol::nil && rec["isAutocalc"]) + potion.mData.mFlags = ESM::Potion::Autocalc; + return potion; } } @@ -91,5 +94,7 @@ namespace MWLua res[LuaUtil::toLuaIndex(i)] = rec.mEffects.mList[i]; // ESM::IndexedENAMstruct (effect params) return res; }); + record["isAutocalc"] = sol::readonly_property( + [](const ESM::Potion& rec) -> bool { return rec.mData.mFlags & ESM::Potion::Autocalc; }); } } \ No newline at end of file diff --git a/files/lua_api/openmw/core.lua b/files/lua_api/openmw/core.lua index e5d5a3ae7f..387aa15fe0 100644 --- a/files/lua_api/openmw/core.lua +++ b/files/lua_api/openmw/core.lua @@ -403,7 +403,8 @@ -- @type Enchantment -- @field #string id Enchantment id -- @field #number type @{#EnchantmentType} --- @field #boolean autocalcFlag If set, the casting cost should be computed based on the effect list rather than read from the cost field +-- @field #boolean autocalcFlag (DEPRECATED, use isAutocalc) If set, the casting cost should be computed based on the effect list rather than read from the cost field +-- @field #boolean isAutocalc If set, the casting cost should be computed based on the effect list rather than read from the cost field -- @field #number cost -- @field #number charge Charge capacity. Should not be confused with current charge. -- @field #list<#MagicEffectWithParams> effects The effects (@{#MagicEffectWithParams}) of the enchantment @@ -729,7 +730,8 @@ -- @field #list<#MagicEffectWithParams> effects The effects (@{#MagicEffectWithParams}) of the spell -- @field #boolean alwaysSucceedFlag If set, the spell should ignore skill checks and always succeed. -- @field #boolean starterSpellFlag If set, the spell can be selected as a player's starting spell. --- @field #boolean autocalcFlag If set, the casting cost should be computed based on the effect list rather than read from the cost field +-- @field #boolean autocalcFlag (DEPRECATED, use isAutocalc) If set, the casting cost should be computed based on the effect list rather than read from the cost field +-- @field #boolean isAutocalc If set, the casting cost should be computed based on the effect list rather than read from the cost field --- -- @type MagicEffect diff --git a/files/lua_api/openmw/types.lua b/files/lua_api/openmw/types.lua index c2b3d78ea9..ad72f33f5f 100644 --- a/files/lua_api/openmw/types.lua +++ b/files/lua_api/openmw/types.lua @@ -861,7 +861,7 @@ -- @field #boolean canWalk whether the creature can walk -- @field #boolean canUseWeapons whether the creature can use weapons and shields -- @field #boolean isBiped whether the creature is a biped --- @field #boolean isAutocalc If true, the actors stats will be automatically calculated based on level and class. +-- @field #boolean isAutocalc If true, the actor's stats will be automatically calculated based on level and class. -- @field #string primaryFaction Faction ID of the NPCs default faction. Nil if no faction -- @field #number primaryFactionRank Faction rank of the NPCs default faction. Nil if no faction -- @field #boolean isEssential whether the creature is essential @@ -1148,6 +1148,7 @@ -- @field #list<#TravelDestination> travelDestinations A list of @{#TravelDestination}s for this NPC. -- @field #boolean isEssential whether the NPC is essential -- @field #boolean isRespawning whether the NPC respawns after death +-- @field #boolean isAutocalc If true, the actor's stats will be automatically calculated based on level and class. -- @field #number bloodType integer representing the blood type of the NPC. Used to generate the correct blood vfx. --- @@ -1884,6 +1885,7 @@ -- @field #number weight -- @field #number value -- @field #list effects The effects (@{#list}) of the potion +-- @field #boolean isAutocalc If set, the gold value should be computed based on the effect list rather than read from the value field