mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-09 21:44:54 +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:
commit
898e43205e
@ -28,6 +28,8 @@ namespace MWLua
|
|||||||
sol::usertype<ESM::Creature> record = context.mLua->sol().new_usertype<ESM::Creature>("ESM3_Creature");
|
sol::usertype<ESM::Creature> record = context.mLua->sol().new_usertype<ESM::Creature>("ESM3_Creature");
|
||||||
record[sol::meta_function::to_string]
|
record[sol::meta_function::to_string]
|
||||||
= [](const ESM::Creature& rec) { return "ESM3_Creature[" + rec.mId.toDebugString() + "]"; };
|
= [](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["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 {
|
record["model"] = sol::readonly_property([vfs](const ESM::Creature& rec) -> std::string {
|
||||||
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
|
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
|
||||||
|
@ -30,6 +30,8 @@ namespace MWLua
|
|||||||
sol::usertype<ESM::NPC> record = context.mLua->sol().new_usertype<ESM::NPC>("ESM3_NPC");
|
sol::usertype<ESM::NPC> record = context.mLua->sol().new_usertype<ESM::NPC>("ESM3_NPC");
|
||||||
record[sol::meta_function::to_string]
|
record[sol::meta_function::to_string]
|
||||||
= [](const ESM::NPC& rec) { return "ESM3_NPC[" + rec.mId.toDebugString() + "]"; };
|
= [](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["name"] = sol::readonly_property([](const ESM::NPC& rec) -> std::string { return rec.mName; });
|
||||||
record["race"]
|
record["race"]
|
||||||
= sol::readonly_property([](const ESM::NPC& rec) -> std::string { return rec.mRace.serializeText(); });
|
= sol::readonly_property([](const ESM::NPC& rec) -> std::string { return rec.mRace.serializeText(); });
|
||||||
|
@ -473,6 +473,7 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
-- @type CreatureRecord
|
-- @type CreatureRecord
|
||||||
|
-- @field #string id The record ID of the creature
|
||||||
-- @field #string name
|
-- @field #string name
|
||||||
-- @field #string baseCreature Record id of a base creature, which was modified to create this one
|
-- @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
|
-- @field #string model VFS path to the creature's model
|
||||||
@ -514,6 +515,7 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
-- @type NpcRecord
|
-- @type NpcRecord
|
||||||
|
-- @field #string id The record ID of the NPC
|
||||||
-- @field #string name
|
-- @field #string name
|
||||||
-- @field #string race
|
-- @field #string race
|
||||||
-- @field #string class Name of the NPC's class (e. g. Acrobat)
|
-- @field #string class Name of the NPC's class (e. g. Acrobat)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user