1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-27 23:37:20 +00:00

Remove numeric magic school ids and deprecate the enum

This commit is contained in:
Evil Eye 2023-09-20 19:51:29 +02:00
parent 4c3acfbcc0
commit 6ed5cbb7d0
4 changed files with 26 additions and 25 deletions

View File

@ -71,7 +71,7 @@ message(STATUS "Configuring OpenMW...")
set(OPENMW_VERSION_MAJOR 0) set(OPENMW_VERSION_MAJOR 0)
set(OPENMW_VERSION_MINOR 49) set(OPENMW_VERSION_MINOR 49)
set(OPENMW_VERSION_RELEASE 0) set(OPENMW_VERSION_RELEASE 0)
set(OPENMW_LUA_API_REVISION 48) set(OPENMW_LUA_API_REVISION 49)
set(OPENMW_VERSION_COMMITHASH "") set(OPENMW_VERSION_COMMITHASH "")
set(OPENMW_VERSION_TAGHASH "") set(OPENMW_VERSION_TAGHASH "")

View File

@ -184,7 +184,7 @@ namespace MWLua
return sol::nil; return sol::nil;
}; };
// TODO: deprecate this and provide access to the store instead // deprecated, use core.stats.Skill
sol::table skills(context.mLua->sol(), sol::create); sol::table skills(context.mLua->sol(), sol::create);
api["SKILL"] = LuaUtil::makeStrictReadOnly(skills); api["SKILL"] = LuaUtil::makeStrictReadOnly(skills);
for (int i = 0; i < ESM::Skill::Length; ++i) for (int i = 0; i < ESM::Skill::Length; ++i)
@ -197,7 +197,7 @@ namespace MWLua
skills[key] = id; skills[key] = id;
} }
// TODO: deprecate this and provide access to the store instead // deprecated, use core.stats.Attribute
sol::table attributes(context.mLua->sol(), sol::create); sol::table attributes(context.mLua->sol(), sol::create);
api["ATTRIBUTE"] = LuaUtil::makeStrictReadOnly(attributes); api["ATTRIBUTE"] = LuaUtil::makeStrictReadOnly(attributes);
for (int i = 0; i < ESM::Attribute::Length; ++i) for (int i = 0; i < ESM::Attribute::Length; ++i)

View File

@ -203,13 +203,14 @@ namespace MWLua
{ "Touch", ESM::RT_Touch }, { "Touch", ESM::RT_Touch },
{ "Target", ESM::RT_Target }, { "Target", ESM::RT_Target },
})); }));
magicApi["SCHOOL"] = LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs<std::string_view, int>({ // deprecated, use core.stats.Skill
{ "Alteration", 0 }, magicApi["SCHOOL"] = LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs<std::string_view, std::string>({
{ "Conjuration", 1 }, { "Alteration", ESM::RefId(ESM::Skill::Alteration).serializeText() },
{ "Destruction", 2 }, { "Conjuration", ESM::RefId(ESM::Skill::Conjuration).serializeText() },
{ "Illusion", 3 }, { "Destruction", ESM::RefId(ESM::Skill::Destruction).serializeText() },
{ "Mysticism", 4 }, { "Illusion", ESM::RefId(ESM::Skill::Illusion).serializeText() },
{ "Restoration", 5 }, { "Mysticism", ESM::RefId(ESM::Skill::Mysticism).serializeText() },
{ "Restoration", ESM::RefId(ESM::Skill::Restoration).serializeText() },
})); }));
magicApi["SPELL_TYPE"] magicApi["SPELL_TYPE"]
= LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs<std::string_view, ESM::Spell::SpellType>({ = LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs<std::string_view, ESM::Spell::SpellType>({
@ -406,7 +407,7 @@ namespace MWLua
->mValue.getString(); ->mValue.getString();
}); });
magicEffectT["school"] = sol::readonly_property( magicEffectT["school"] = sol::readonly_property(
[](const ESM::MagicEffect& rec) -> int { return ESM::MagicSchool::skillRefIdToIndex(rec.mData.mSchool); }); [](const ESM::MagicEffect& rec) -> std::string { return rec.mData.mSchool.serializeText(); });
magicEffectT["baseCost"] magicEffectT["baseCost"]
= sol::readonly_property([](const ESM::MagicEffect& rec) -> float { return rec.mData.mBaseCost; }); = sol::readonly_property([](const ESM::MagicEffect& rec) -> float { return rec.mData.mBaseCost; });
magicEffectT["color"] = sol::readonly_property([](const ESM::MagicEffect& rec) -> Misc::Color { magicEffectT["color"] = sol::readonly_property([](const ESM::MagicEffect& rec) -> Misc::Color {

View File

@ -333,8 +333,8 @@
--- ---
-- @type ActiveSpellEffect -- @type ActiveSpellEffect
-- @field #string affectedSkill @{#SKILL} or nil -- @field #string affectedSkill Optional skill ID
-- @field #string affectedAttribute @{#ATTRIBUTE} or nil -- @field #string affectedAttribute Optional attribute ID
-- @field #string id Magic effect id -- @field #string id Magic effect id
-- @field #string name Localized name of the effect -- @field #string name Localized name of the effect
-- @field #number magnitudeThisFrame The magnitude of the effect in the current frame. This will be a new random number between minMagnitude and maxMagnitude every frame. Or nil if the effect has no magnitude. -- @field #number magnitudeThisFrame The magnitude of the effect in the current frame. This will be a new random number between minMagnitude and maxMagnitude every frame. Or nil if the effect has no magnitude.
@ -498,17 +498,17 @@
-- @field #number Target Ranged spell -- @field #number Target Ranged spell
--- Possible @{#MagicSchool} values --- Possible @{#MagicSchool} values (DEPRECATED use @{#Skill})
-- @field [parent=#Magic] #MagicSchool SCHOOL -- @field [parent=#Magic] #MagicSchool SCHOOL
--- `core.magic.SCHOOL` --- `core.magic.SCHOOL`
-- @type MagicSchool -- @type MagicSchool
-- @field #number Alteration Alteration -- @field #string Alteration alteration
-- @field #number Conjuration Conjuration -- @field #string Conjuration conjuration
-- @field #number Destruction Destruction -- @field #string Destruction destruction
-- @field #number Illusion Illusion -- @field #string Illusion illusion
-- @field #number Mysticism Mysticism -- @field #string Mysticism mysticism
-- @field #number Restoration Restoration -- @field #string Restoration restoration
--- Possible @{#MagicEffectId} values --- Possible @{#MagicEffectId} values
@ -720,7 +720,7 @@
-- @field #string id Effect ID -- @field #string id Effect ID
-- @field #string icon Effect Icon Path -- @field #string icon Effect Icon Path
-- @field #string name Localized name of the effect -- @field #string name Localized name of the effect
-- @field #number school @{#MagicSchool} -- @field #string school Skill ID
-- @field #number baseCost -- @field #number baseCost
-- @field openmw.util#Color color -- @field openmw.util#Color color
-- @field #boolean harmful -- @field #boolean harmful
@ -728,8 +728,8 @@
--- ---
-- @type MagicEffectWithParams -- @type MagicEffectWithParams
-- @field #MagicEffect effect @{#MagicEffect} -- @field #MagicEffect effect @{#MagicEffect}
-- @field #string affectedSkill @{#SKILL} or nil -- @field #string affectedSkill Optional skill ID
-- @field #string affectedAttribute @{#ATTRIBUTE} or nil -- @field #string affectedAttribute Optional attribute ID
-- @field #number range -- @field #number range
-- @field #number area -- @field #number area
-- @field #number magnitudeMin -- @field #number magnitudeMin
@ -738,8 +738,8 @@
--- ---
-- @type ActiveEffect -- @type ActiveEffect
-- @field #string affectedSkill @{#SKILL} or nil -- @field #string affectedSkill Optional skill ID
-- @field #string affectedAttribute @{#ATTRIBUTE} or nil -- @field #string affectedAttribute Optional attribute ID
-- @field #string id Effect id string -- @field #string id Effect id string
-- @field #string name Localized name of the effect -- @field #string name Localized name of the effect
-- @field #number magnitude -- @field #number magnitude