1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-06 07:15:36 +00:00

Merge branch 'lua_fix_record_id' into 'master'

[Lua] Add missing `record.id` for NPC and Creature records.

See merge request OpenMW/openmw!2919
This commit is contained in:
psi29a 2023-04-11 06:53:59 +00:00
commit 898e43205e
3 changed files with 6 additions and 0 deletions

View file

@ -28,6 +28,8 @@ namespace MWLua
sol::usertype<ESM::Creature> record = context.mLua->sol().new_usertype<ESM::Creature>("ESM3_Creature");
record[sol::meta_function::to_string]
= [](const ESM::Creature& rec) { return "ESM3_Creature[" + rec.mId.toDebugString() + "]"; };
record["id"]
= sol::readonly_property([](const ESM::Creature& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::Creature& rec) -> std::string { return rec.mName; });
record["model"] = sol::readonly_property([vfs](const ESM::Creature& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);

View file

@ -30,6 +30,8 @@ namespace MWLua
sol::usertype<ESM::NPC> record = context.mLua->sol().new_usertype<ESM::NPC>("ESM3_NPC");
record[sol::meta_function::to_string]
= [](const ESM::NPC& rec) { return "ESM3_NPC[" + rec.mId.toDebugString() + "]"; };
record["id"]
= sol::readonly_property([](const ESM::NPC& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::NPC& rec) -> std::string { return rec.mName; });
record["race"]
= sol::readonly_property([](const ESM::NPC& rec) -> std::string { return rec.mRace.serializeText(); });

View file

@ -473,6 +473,7 @@
---
-- @type CreatureRecord
-- @field #string id The record ID of the creature
-- @field #string name
-- @field #string baseCreature Record id of a base creature, which was modified to create this one
-- @field #string model VFS path to the creature's model
@ -514,6 +515,7 @@
---
-- @type NpcRecord
-- @field #string id The record ID of the NPC
-- @field #string name
-- @field #string race
-- @field #string class Name of the NPC's class (e. g. Acrobat)