1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-28 19:21:04 +00:00

Merge branch 'deprecations' into 'master'

Remove numeric magic school ids and deprecate the enum

See merge request OpenMW/openmw!3440
This commit is contained in:
psi29a 2023-09-23 11:59:22 +00:00
commit 67075990bd
4 changed files with 9 additions and 107 deletions

View File

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

View File

@ -184,32 +184,6 @@ namespace MWLua
return sol::nil;
};
// TODO: deprecate this and provide access to the store instead
sol::table skills(context.mLua->sol(), sol::create);
api["SKILL"] = LuaUtil::makeStrictReadOnly(skills);
for (int i = 0; i < ESM::Skill::Length; ++i)
{
ESM::RefId skill = ESM::Skill::indexToRefId(i);
std::string id = skill.serializeText();
std::string key = Misc::StringUtils::lowerCase(skill.getRefIdString());
// force first character to uppercase for backwards compatability
key[0] += 'A' - 'a';
skills[key] = id;
}
// TODO: deprecate this and provide access to the store instead
sol::table attributes(context.mLua->sol(), sol::create);
api["ATTRIBUTE"] = LuaUtil::makeStrictReadOnly(attributes);
for (int i = 0; i < ESM::Attribute::Length; ++i)
{
ESM::RefId attribute = ESM::Attribute::indexToRefId(i);
std::string id = attribute.serializeText();
std::string key = Misc::StringUtils::lowerCase(attribute.getRefIdString());
// force first character to uppercase for backwards compatability
key[0] += 'A' - 'a';
attributes[key] = id;
}
return LuaUtil::makeReadOnly(api);
}

View File

@ -203,14 +203,6 @@ namespace MWLua
{ "Touch", ESM::RT_Touch },
{ "Target", ESM::RT_Target },
}));
magicApi["SCHOOL"] = LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs<std::string_view, int>({
{ "Alteration", 0 },
{ "Conjuration", 1 },
{ "Destruction", 2 },
{ "Illusion", 3 },
{ "Mysticism", 4 },
{ "Restoration", 5 },
}));
magicApi["SPELL_TYPE"]
= LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs<std::string_view, ESM::Spell::SpellType>({
{ "Spell", ESM::Spell::ST_Spell },
@ -406,7 +398,7 @@ namespace MWLua
->mValue.getString();
});
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"]
= sol::readonly_property([](const ESM::MagicEffect& rec) -> float { return rec.mData.mBaseCost; });
magicEffectT["color"] = sol::readonly_property([](const ESM::MagicEffect& rec) -> Misc::Color {

View File

@ -333,8 +333,8 @@
---
-- @type ActiveSpellEffect
-- @field #string affectedSkill @{#SKILL} or nil
-- @field #string affectedAttribute @{#ATTRIBUTE} or nil
-- @field #string affectedSkill Optional skill ID
-- @field #string affectedAttribute Optional attribute ID
-- @field #string id Magic effect id
-- @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.
@ -433,57 +433,6 @@
-- @usage for _, item in ipairs(inventory:findAll('common_shirt_01')) do ... end
--- Possible @{#ATTRIBUTE} values (DEPRECATED use @{#Attribute})
-- @field [parent=#core] #ATTRIBUTE ATTRIBUTE
--- DEPRECATED, use @{#Attribute}
--- `core.ATTRIBUTE`
-- @type ATTRIBUTE
-- @field #string Strength "strength"
-- @field #string Intelligence "intelligence"
-- @field #string Willpower "willpower"
-- @field #string Agility "agility"
-- @field #string Speed "speed"
-- @field #string Endurance "endurance"
-- @field #string Personality "personality"
-- @field #string Luck "luck"
--- Possible @{#SKILL} values (DEPRECATED use @{#Skill})
-- @field [parent=#core] #SKILL SKILL
--- DEPRECATED, use @{#Skill}
--- `core.SKILL`
-- @type SKILL
-- @field #string Acrobatics "acrobatics"
-- @field #string Alchemy "alchemy"
-- @field #string Alteration "alteration"
-- @field #string Armorer "armorer"
-- @field #string Athletics "athletics"
-- @field #string Axe "axe"
-- @field #string Block "block"
-- @field #string BluntWeapon "bluntweapon"
-- @field #string Conjuration "conjuration"
-- @field #string Destruction "destruction"
-- @field #string Enchant "enchant"
-- @field #string HandToHand "handtohand"
-- @field #string HeavyArmor "heavyarmor"
-- @field #string Illusion "illusion"
-- @field #string LightArmor "lightarmor"
-- @field #string LongBlade "longblade"
-- @field #string Marksman "marksman"
-- @field #string MediumArmor "mediumarmor"
-- @field #string Mercantile "mercantile"
-- @field #string Mysticism "mysticism"
-- @field #string Restoration "restoration"
-- @field #string Security "security"
-- @field #string ShortBlade "shortblade"
-- @field #string Sneak "sneak"
-- @field #string Spear "spear"
-- @field #string Speechcraft "speechcraft"
-- @field #string Unarmored "unarmored"
--- @{#Magic}: spells and spell effects
-- @field [parent=#core] #Magic magic
@ -498,19 +447,6 @@
-- @field #number Target Ranged spell
--- Possible @{#MagicSchool} values
-- @field [parent=#Magic] #MagicSchool SCHOOL
--- `core.magic.SCHOOL`
-- @type MagicSchool
-- @field #number Alteration Alteration
-- @field #number Conjuration Conjuration
-- @field #number Destruction Destruction
-- @field #number Illusion Illusion
-- @field #number Mysticism Mysticism
-- @field #number Restoration Restoration
--- Possible @{#MagicEffectId} values
-- @field [parent=#Magic] #MagicEffectId EFFECT_TYPE
@ -720,7 +656,7 @@
-- @field #string id Effect ID
-- @field #string icon Effect Icon Path
-- @field #string name Localized name of the effect
-- @field #number school @{#MagicSchool}
-- @field #string school Skill ID
-- @field #number baseCost
-- @field openmw.util#Color color
-- @field #boolean harmful
@ -728,8 +664,8 @@
---
-- @type MagicEffectWithParams
-- @field #MagicEffect effect @{#MagicEffect}
-- @field #string affectedSkill @{#SKILL} or nil
-- @field #string affectedAttribute @{#ATTRIBUTE} or nil
-- @field #string affectedSkill Optional skill ID
-- @field #string affectedAttribute Optional attribute ID
-- @field #number range
-- @field #number area
-- @field #number magnitudeMin
@ -738,8 +674,8 @@
---
-- @type ActiveEffect
-- @field #string affectedSkill @{#SKILL} or nil
-- @field #string affectedAttribute @{#ATTRIBUTE} or nil
-- @field #string affectedSkill Optional skill ID
-- @field #string affectedAttribute Optional attribute ID
-- @field #string id Effect id string
-- @field #string name Localized name of the effect
-- @field #number magnitude