mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-30 16:20:21 +00:00
Add type prop for types.Creature
This commit is contained in:
parent
e35bf97603
commit
43e92fa1c9
@ -21,6 +21,13 @@ namespace MWLua
|
|||||||
{
|
{
|
||||||
void addCreatureBindings(sol::table creature, const Context& context)
|
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();
|
auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
|
||||||
|
|
||||||
addRecordFunctionBinding<ESM::Creature>(creature, context);
|
addRecordFunctionBinding<ESM::Creature>(creature, context);
|
||||||
@ -39,5 +46,6 @@ namespace MWLua
|
|||||||
record["baseCreature"] = sol::readonly_property(
|
record["baseCreature"] = sol::readonly_property(
|
||||||
[](const ESM::Creature& rec) -> std::string { return rec.mOriginal.serializeText(); });
|
[](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["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
|
-- @param openmw.core#GameObject object
|
||||||
-- @return #boolean
|
-- @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
|
-- Returns the read-only @{#CreatureRecord} of a creature
|
||||||
-- @function [parent=#Creature] record
|
-- @function [parent=#Creature] record
|
||||||
@ -592,6 +602,7 @@
|
|||||||
-- @field #string model VFS path to the creature's model
|
-- @field #string model VFS path to the creature's model
|
||||||
-- @field #string mwscript
|
-- @field #string mwscript
|
||||||
-- @field #number soulValue The soul value of the creature record
|
-- @field #number soulValue The soul value of the creature record
|
||||||
|
-- @field #number type The @{#Creature.TYPE} of the creature
|
||||||
|
|
||||||
|
|
||||||
--- @{#NPC} functions
|
--- @{#NPC} functions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user