Merge branch 'add_creature_type_type_prop' into 'master'

Lua: Add type property to types.Creature

See merge request OpenMW/openmw!3132
revert-6246b479
psi29a 2 years ago
commit 240cc73a8d

@ -21,6 +21,13 @@ namespace MWLua
{
void addCreatureBindings(sol::table creature, const Context& context)
{
creature["TYPE"] = LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs<std::string_view, int>({
{ "Creatures", ESM::Creature::Creatures },
{ "Daedra", ESM::Creature::Daedra },
{ "Undead", ESM::Creature::Undead },
{ "Humanoid", ESM::Creature::Humanoid },
}));
auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
addRecordFunctionBinding<ESM::Creature>(creature, context);
@ -39,5 +46,6 @@ namespace MWLua
record["baseCreature"] = sol::readonly_property(
[](const ESM::Creature& rec) -> std::string { return rec.mOriginal.serializeText(); });
record["soulValue"] = sol::readonly_property([](const ESM::Creature& rec) -> int { return rec.mData.mSoul; });
record["type"] = sol::readonly_property([](const ESM::Creature& rec) -> int { return rec.mData.mType; });
}
}

@ -578,6 +578,16 @@
-- @param openmw.core#GameObject object
-- @return #boolean
--- Creature.TYPE
-- @type CreatureTYPE
-- @field #number Creatures
-- @field #number Daedra
-- @field #number Undead
-- @field #number Humanoid
--- @{#CreatureTYPE}
-- @field [parent=#Creature] #CreatureTYPE TYPE
---
-- Returns the read-only @{#CreatureRecord} of a creature
-- @function [parent=#Creature] record
@ -592,6 +602,7 @@
-- @field #string model VFS path to the creature's model
-- @field #string mwscript
-- @field #number soulValue The soul value of the creature record
-- @field #number type The @{#Creature.TYPE} of the creature
--- @{#NPC} functions

Loading…
Cancel
Save