From ee653eb2b87a7013803cbd6548000c195015d4c7 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Sun, 7 Jul 2024 13:58:34 +0200 Subject: [PATCH] Make mwscript return nil for records that don't have a script --- CMakeLists.txt | 2 +- apps/openmw/mwlua/types/activator.cpp | 6 +++-- apps/openmw/mwlua/types/apparatus.cpp | 6 +++-- apps/openmw/mwlua/types/armor.cpp | 12 ++++----- apps/openmw/mwlua/types/book.cpp | 16 +++++------- apps/openmw/mwlua/types/clothing.cpp | 10 ++++---- apps/openmw/mwlua/types/container.cpp | 6 +++-- apps/openmw/mwlua/types/creature.cpp | 6 +++-- apps/openmw/mwlua/types/door.cpp | 5 ++-- apps/openmw/mwlua/types/ingredient.cpp | 5 ++-- apps/openmw/mwlua/types/light.cpp | 5 ++-- apps/openmw/mwlua/types/lockpick.cpp | 6 +++-- apps/openmw/mwlua/types/misc.cpp | 11 ++++----- apps/openmw/mwlua/types/npc.cpp | 4 +-- apps/openmw/mwlua/types/potion.cpp | 4 +-- apps/openmw/mwlua/types/probe.cpp | 5 ++-- apps/openmw/mwlua/types/repair.cpp | 5 ++-- apps/openmw/mwlua/types/weapon.cpp | 12 ++++----- components/lua/util.hpp | 12 +++++++++ files/lua_api/openmw/types.lua | 34 +++++++++++++------------- 20 files changed, 95 insertions(+), 77 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 43a645ed14..83d81999ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,7 +82,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 63) +set(OPENMW_LUA_API_REVISION 64) set(OPENMW_POSTPROCESSING_API_REVISION 1) set(OPENMW_VERSION_COMMITHASH "") diff --git a/apps/openmw/mwlua/types/activator.cpp b/apps/openmw/mwlua/types/activator.cpp index 43e03952f7..3531a476ad 100644 --- a/apps/openmw/mwlua/types/activator.cpp +++ b/apps/openmw/mwlua/types/activator.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -51,7 +52,8 @@ namespace MWLua record["model"] = sol::readonly_property([](const ESM::Activator& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); }); - record["mwscript"] = sol::readonly_property( - [](const ESM::Activator& rec) -> std::string { return rec.mScript.serializeText(); }); + record["mwscript"] = sol::readonly_property([](const ESM::Activator& rec) -> sol::optional { + return LuaUtil::serializeRefId(rec.mScript); + }); } } diff --git a/apps/openmw/mwlua/types/apparatus.cpp b/apps/openmw/mwlua/types/apparatus.cpp index 282dd0669d..025cba6550 100644 --- a/apps/openmw/mwlua/types/apparatus.cpp +++ b/apps/openmw/mwlua/types/apparatus.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -39,8 +40,9 @@ namespace MWLua record["model"] = sol::readonly_property([](const ESM::Apparatus& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); }); - record["mwscript"] = sol::readonly_property( - [](const ESM::Apparatus& rec) -> std::string { return rec.mScript.serializeText(); }); + record["mwscript"] = sol::readonly_property([](const ESM::Apparatus& rec) -> sol::optional { + return LuaUtil::serializeRefId(rec.mScript); + }); record["icon"] = sol::readonly_property([vfs](const ESM::Apparatus& rec) -> std::string { return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs); }); diff --git a/apps/openmw/mwlua/types/armor.cpp b/apps/openmw/mwlua/types/armor.cpp index 8c741a4684..3d1250af13 100644 --- a/apps/openmw/mwlua/types/armor.cpp +++ b/apps/openmw/mwlua/types/armor.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -98,13 +99,10 @@ namespace MWLua record["icon"] = sol::readonly_property([vfs](const ESM::Armor& rec) -> std::string { return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs); }); - record["enchant"] = sol::readonly_property([](const ESM::Armor& rec) -> sol::optional { - if (rec.mEnchant.empty()) - return sol::nullopt; - return rec.mEnchant.serializeText(); - }); - record["mwscript"] - = sol::readonly_property([](const ESM::Armor& rec) -> std::string { return rec.mScript.serializeText(); }); + record["enchant"] = sol::readonly_property( + [](const ESM::Armor& rec) -> sol::optional { return LuaUtil::serializeRefId(rec.mEnchant); }); + record["mwscript"] = sol::readonly_property( + [](const ESM::Armor& rec) -> sol::optional { return LuaUtil::serializeRefId(rec.mScript); }); record["weight"] = sol::readonly_property([](const ESM::Armor& rec) -> float { return rec.mData.mWeight; }); record["value"] = sol::readonly_property([](const ESM::Armor& rec) -> int { return rec.mData.mValue; }); record["type"] = sol::readonly_property([](const ESM::Armor& rec) -> int { return rec.mData.mType; }); diff --git a/apps/openmw/mwlua/types/book.cpp b/apps/openmw/mwlua/types/book.cpp index 92bea13748..0733d89914 100644 --- a/apps/openmw/mwlua/types/book.cpp +++ b/apps/openmw/mwlua/types/book.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -104,17 +105,14 @@ namespace MWLua record["name"] = sol::readonly_property([](const ESM::Book& rec) -> std::string { return rec.mName; }); record["model"] = sol::readonly_property( [](const ESM::Book& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); }); - record["mwscript"] - = sol::readonly_property([](const ESM::Book& rec) -> std::string { return rec.mScript.serializeText(); }); + record["mwscript"] = sol::readonly_property( + [](const ESM::Book& rec) -> sol::optional { return LuaUtil::serializeRefId(rec.mScript); }); record["icon"] = sol::readonly_property([vfs](const ESM::Book& rec) -> std::string { return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs); }); record["text"] = sol::readonly_property([](const ESM::Book& rec) -> std::string { return rec.mText; }); - record["enchant"] = sol::readonly_property([](const ESM::Book& rec) -> sol::optional { - if (rec.mEnchant.empty()) - return sol::nullopt; - return rec.mEnchant.serializeText(); - }); + record["enchant"] = sol::readonly_property( + [](const ESM::Book& rec) -> sol::optional { return LuaUtil::serializeRefId(rec.mEnchant); }); record["isScroll"] = sol::readonly_property([](const ESM::Book& rec) -> bool { return rec.mData.mIsScroll; }); record["value"] = sol::readonly_property([](const ESM::Book& rec) -> int { return rec.mData.mValue; }); record["weight"] = sol::readonly_property([](const ESM::Book& rec) -> float { return rec.mData.mWeight; }); @@ -122,9 +120,7 @@ namespace MWLua = sol::readonly_property([](const ESM::Book& rec) -> float { return rec.mData.mEnchant * 0.1f; }); record["skill"] = sol::readonly_property([](const ESM::Book& rec) -> sol::optional { ESM::RefId skill = ESM::Skill::indexToRefId(rec.mData.mSkillId); - if (!skill.empty()) - return skill.serializeText(); - return sol::nullopt; + return LuaUtil::serializeRefId(skill); }); } } diff --git a/apps/openmw/mwlua/types/clothing.cpp b/apps/openmw/mwlua/types/clothing.cpp index 8679ce0b67..733cf5ba11 100644 --- a/apps/openmw/mwlua/types/clothing.cpp +++ b/apps/openmw/mwlua/types/clothing.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -94,12 +95,11 @@ namespace MWLua return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs); }); record["enchant"] = sol::readonly_property([](const ESM::Clothing& rec) -> sol::optional { - if (rec.mEnchant.empty()) - return sol::nullopt; - return rec.mEnchant.serializeText(); + return LuaUtil::serializeRefId(rec.mEnchant); + }); + record["mwscript"] = sol::readonly_property([](const ESM::Clothing& rec) -> sol::optional { + return LuaUtil::serializeRefId(rec.mScript); }); - record["mwscript"] = sol::readonly_property( - [](const ESM::Clothing& rec) -> std::string { return rec.mScript.serializeText(); }); record["weight"] = sol::readonly_property([](const ESM::Clothing& rec) -> float { return rec.mData.mWeight; }); record["value"] = sol::readonly_property([](const ESM::Clothing& rec) -> int { return rec.mData.mValue; }); record["type"] = sol::readonly_property([](const ESM::Clothing& rec) -> int { return rec.mData.mType; }); diff --git a/apps/openmw/mwlua/types/container.cpp b/apps/openmw/mwlua/types/container.cpp index 55f3e4a10e..b5d9c082bd 100644 --- a/apps/openmw/mwlua/types/container.cpp +++ b/apps/openmw/mwlua/types/container.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -51,8 +52,9 @@ namespace MWLua record["model"] = sol::readonly_property([](const ESM::Container& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); }); - record["mwscript"] = sol::readonly_property( - [](const ESM::Container& rec) -> std::string { return rec.mScript.serializeText(); }); + record["mwscript"] = sol::readonly_property([](const ESM::Container& rec) -> sol::optional { + return LuaUtil::serializeRefId(rec.mScript); + }); record["weight"] = sol::readonly_property([](const ESM::Container& rec) -> float { return rec.mWeight; }); record["isOrganic"] = sol::readonly_property( [](const ESM::Container& rec) -> bool { return rec.mFlags & ESM::Container::Organic; }); diff --git a/apps/openmw/mwlua/types/creature.cpp b/apps/openmw/mwlua/types/creature.cpp index dd4b1bd67b..61ddc3f4fa 100644 --- a/apps/openmw/mwlua/types/creature.cpp +++ b/apps/openmw/mwlua/types/creature.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -36,8 +37,9 @@ namespace MWLua record["name"] = sol::readonly_property([](const ESM::Creature& rec) -> std::string { return rec.mName; }); record["model"] = sol::readonly_property( [](const ESM::Creature& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); }); - record["mwscript"] = sol::readonly_property( - [](const ESM::Creature& rec) -> std::string { return rec.mScript.serializeText(); }); + record["mwscript"] = sol::readonly_property([](const ESM::Creature& rec) -> sol::optional { + return LuaUtil::serializeRefId(rec.mScript); + }); 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; }); diff --git a/apps/openmw/mwlua/types/door.cpp b/apps/openmw/mwlua/types/door.cpp index df1d10015a..1c0cc07b00 100644 --- a/apps/openmw/mwlua/types/door.cpp +++ b/apps/openmw/mwlua/types/door.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -64,8 +65,8 @@ namespace MWLua record["name"] = sol::readonly_property([](const ESM::Door& rec) -> std::string { return rec.mName; }); record["model"] = sol::readonly_property( [](const ESM::Door& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); }); - record["mwscript"] - = sol::readonly_property([](const ESM::Door& rec) -> std::string { return rec.mScript.serializeText(); }); + record["mwscript"] = sol::readonly_property( + [](const ESM::Door& rec) -> sol::optional { return LuaUtil::serializeRefId(rec.mScript); }); record["openSound"] = sol::readonly_property( [](const ESM::Door& rec) -> std::string { return rec.mOpenSound.serializeText(); }); record["closeSound"] = sol::readonly_property( diff --git a/apps/openmw/mwlua/types/ingredient.cpp b/apps/openmw/mwlua/types/ingredient.cpp index a76869308b..0df31d1e85 100644 --- a/apps/openmw/mwlua/types/ingredient.cpp +++ b/apps/openmw/mwlua/types/ingredient.cpp @@ -34,8 +34,9 @@ namespace MWLua record["model"] = sol::readonly_property([](const ESM::Ingredient& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); }); - record["mwscript"] = sol::readonly_property( - [](const ESM::Ingredient& rec) -> std::string { return rec.mScript.serializeText(); }); + record["mwscript"] = sol::readonly_property([](const ESM::Ingredient& rec) -> sol::optional { + return LuaUtil::serializeRefId(rec.mScript); + }); record["icon"] = sol::readonly_property([vfs](const ESM::Ingredient& rec) -> std::string { return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs); }); diff --git a/apps/openmw/mwlua/types/light.cpp b/apps/openmw/mwlua/types/light.cpp index 2784e5a770..ab758c22ec 100644 --- a/apps/openmw/mwlua/types/light.cpp +++ b/apps/openmw/mwlua/types/light.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -96,8 +97,8 @@ namespace MWLua }); record["sound"] = sol::readonly_property([](const ESM::Light& rec) -> std::string { return rec.mSound.serializeText(); }); - record["mwscript"] - = sol::readonly_property([](const ESM::Light& rec) -> std::string { return rec.mScript.serializeText(); }); + record["mwscript"] = sol::readonly_property( + [](const ESM::Light& rec) -> sol::optional { return LuaUtil::serializeRefId(rec.mScript); }); record["weight"] = sol::readonly_property([](const ESM::Light& rec) -> float { return rec.mData.mWeight; }); record["value"] = sol::readonly_property([](const ESM::Light& rec) -> int { return rec.mData.mValue; }); record["duration"] = sol::readonly_property([](const ESM::Light& rec) -> int { return rec.mData.mTime; }); diff --git a/apps/openmw/mwlua/types/lockpick.cpp b/apps/openmw/mwlua/types/lockpick.cpp index 373de4b24d..4186f44378 100644 --- a/apps/openmw/mwlua/types/lockpick.cpp +++ b/apps/openmw/mwlua/types/lockpick.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -31,8 +32,9 @@ namespace MWLua record["name"] = sol::readonly_property([](const ESM::Lockpick& rec) -> std::string { return rec.mName; }); record["model"] = sol::readonly_property( [](const ESM::Lockpick& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); }); - record["mwscript"] = sol::readonly_property( - [](const ESM::Lockpick& rec) -> std::string { return rec.mScript.serializeText(); }); + record["mwscript"] = sol::readonly_property([](const ESM::Lockpick& rec) -> sol::optional { + return LuaUtil::serializeRefId(rec.mScript); + }); record["icon"] = sol::readonly_property([vfs](const ESM::Lockpick& rec) -> std::string { return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs); }); diff --git a/apps/openmw/mwlua/types/misc.cpp b/apps/openmw/mwlua/types/misc.cpp index 8fc9406cfd..85eb03524c 100644 --- a/apps/openmw/mwlua/types/misc.cpp +++ b/apps/openmw/mwlua/types/misc.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -70,10 +71,7 @@ namespace MWLua }; miscellaneous["getSoul"] = [](const Object& object) -> sol::optional { ESM::RefId soul = object.ptr().getCellRef().getSoul(); - if (soul.empty()) - return sol::nullopt; - else - return soul.serializeText(); + return LuaUtil::serializeRefId(soul); }; miscellaneous["soul"] = miscellaneous["getSoul"]; // for compatibility; should be removed later @@ -87,8 +85,9 @@ namespace MWLua record["model"] = sol::readonly_property([](const ESM::Miscellaneous& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); }); - record["mwscript"] = sol::readonly_property( - [](const ESM::Miscellaneous& rec) -> std::string { return rec.mScript.serializeText(); }); + record["mwscript"] = sol::readonly_property([](const ESM::Miscellaneous& rec) -> sol::optional { + return LuaUtil::serializeRefId(rec.mScript); + }); record["icon"] = sol::readonly_property([vfs](const ESM::Miscellaneous& rec) -> std::string { return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs); }); diff --git a/apps/openmw/mwlua/types/npc.cpp b/apps/openmw/mwlua/types/npc.cpp index f8a1a82e54..0f5c82f1dd 100644 --- a/apps/openmw/mwlua/types/npc.cpp +++ b/apps/openmw/mwlua/types/npc.cpp @@ -85,8 +85,8 @@ namespace MWLua = sol::readonly_property([](const ESM::NPC& rec) -> std::string { return rec.mRace.serializeText(); }); record["class"] = sol::readonly_property([](const ESM::NPC& rec) -> std::string { return rec.mClass.serializeText(); }); - record["mwscript"] - = sol::readonly_property([](const ESM::NPC& rec) -> std::string { return rec.mScript.serializeText(); }); + record["mwscript"] = sol::readonly_property( + [](const ESM::NPC& rec) -> sol::optional { return LuaUtil::serializeRefId(rec.mScript); }); record["hair"] = sol::readonly_property([](const ESM::NPC& rec) -> std::string { return rec.mHair.serializeText(); }); record["baseDisposition"] diff --git a/apps/openmw/mwlua/types/potion.cpp b/apps/openmw/mwlua/types/potion.cpp index cc4dd5700c..a3dab55224 100644 --- a/apps/openmw/mwlua/types/potion.cpp +++ b/apps/openmw/mwlua/types/potion.cpp @@ -80,8 +80,8 @@ namespace MWLua record["icon"] = sol::readonly_property([vfs](const ESM::Potion& rec) -> std::string { return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs); }); - record["mwscript"] - = sol::readonly_property([](const ESM::Potion& rec) -> std::string { return rec.mScript.serializeText(); }); + record["mwscript"] = sol::readonly_property( + [](const ESM::Potion& rec) -> sol::optional { return LuaUtil::serializeRefId(rec.mScript); }); record["weight"] = sol::readonly_property([](const ESM::Potion& rec) -> float { return rec.mData.mWeight; }); record["value"] = sol::readonly_property([](const ESM::Potion& rec) -> int { return rec.mData.mValue; }); record["effects"] = sol::readonly_property([context](const ESM::Potion& rec) -> sol::table { diff --git a/apps/openmw/mwlua/types/probe.cpp b/apps/openmw/mwlua/types/probe.cpp index 30c84326a5..5db8141a23 100644 --- a/apps/openmw/mwlua/types/probe.cpp +++ b/apps/openmw/mwlua/types/probe.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -31,8 +32,8 @@ namespace MWLua record["name"] = sol::readonly_property([](const ESM::Probe& rec) -> std::string { return rec.mName; }); record["model"] = sol::readonly_property( [](const ESM::Probe& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); }); - record["mwscript"] - = sol::readonly_property([](const ESM::Probe& rec) -> std::string { return rec.mScript.serializeText(); }); + record["mwscript"] = sol::readonly_property( + [](const ESM::Probe& rec) -> sol::optional { return LuaUtil::serializeRefId(rec.mScript); }); record["icon"] = sol::readonly_property([vfs](const ESM::Probe& rec) -> std::string { return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs); }); diff --git a/apps/openmw/mwlua/types/repair.cpp b/apps/openmw/mwlua/types/repair.cpp index 880a74d131..4d35a55fbe 100644 --- a/apps/openmw/mwlua/types/repair.cpp +++ b/apps/openmw/mwlua/types/repair.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -31,8 +32,8 @@ namespace MWLua record["name"] = sol::readonly_property([](const ESM::Repair& rec) -> std::string { return rec.mName; }); record["model"] = sol::readonly_property( [](const ESM::Repair& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); }); - record["mwscript"] - = sol::readonly_property([](const ESM::Repair& rec) -> std::string { return rec.mScript.serializeText(); }); + record["mwscript"] = sol::readonly_property( + [](const ESM::Repair& rec) -> sol::optional { return LuaUtil::serializeRefId(rec.mScript); }); record["icon"] = sol::readonly_property([vfs](const ESM::Repair& rec) -> std::string { return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs); }); diff --git a/apps/openmw/mwlua/types/weapon.cpp b/apps/openmw/mwlua/types/weapon.cpp index 71fab2e0f5..386b81c843 100644 --- a/apps/openmw/mwlua/types/weapon.cpp +++ b/apps/openmw/mwlua/types/weapon.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -131,13 +132,10 @@ namespace MWLua record["icon"] = sol::readonly_property([vfs](const ESM::Weapon& rec) -> std::string { return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs); }); - record["enchant"] = sol::readonly_property([](const ESM::Weapon& rec) -> sol::optional { - if (rec.mEnchant.empty()) - return sol::nullopt; - return rec.mEnchant.serializeText(); - }); - record["mwscript"] - = sol::readonly_property([](const ESM::Weapon& rec) -> std::string { return rec.mScript.serializeText(); }); + record["enchant"] = sol::readonly_property( + [](const ESM::Weapon& rec) -> sol::optional { return LuaUtil::serializeRefId(rec.mEnchant); }); + record["mwscript"] = sol::readonly_property( + [](const ESM::Weapon& rec) -> sol::optional { return LuaUtil::serializeRefId(rec.mScript); }); record["isMagical"] = sol::readonly_property( [](const ESM::Weapon& rec) -> bool { return rec.mData.mFlags & ESM::Weapon::Magical; }); record["isSilver"] = sol::readonly_property( diff --git a/components/lua/util.hpp b/components/lua/util.hpp index 640b5eeeb0..2b84d9d60c 100644 --- a/components/lua/util.hpp +++ b/components/lua/util.hpp @@ -2,6 +2,11 @@ #define COMPONENTS_LUA_UTIL_H #include +#include + +#include + +#include namespace LuaUtil { @@ -15,6 +20,13 @@ namespace LuaUtil { return i + 1; } + + inline sol::optional serializeRefId(ESM::RefId id) + { + if (id.empty()) + return sol::nullopt; + return id.serializeText(); + } } #endif diff --git a/files/lua_api/openmw/types.lua b/files/lua_api/openmw/types.lua index d686df144a..7606015c15 100644 --- a/files/lua_api/openmw/types.lua +++ b/files/lua_api/openmw/types.lua @@ -837,7 +837,7 @@ -- @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 --- @field #string mwscript +-- @field #string mwscript MWScript on this creature (can be nil) -- @field #number soulValue The soul value of the creature record -- @field #number type The @{#Creature.TYPE} of the creature -- @field #number baseGold The base barter gold of the creature @@ -1117,7 +1117,7 @@ -- @field #string race -- @field #string class Name of the NPC's class (e. g. Acrobat) -- @field #string model Path to the model associated with this NPC, used for animations. --- @field #string mwscript MWScript that is attached to this NPC +-- @field #string mwscript MWScript on this NPC (can be nil) -- @field #string hair Path to the hair body part model -- @field #string head Path to the head body part model -- @field #number baseGold The base barter gold of the NPC @@ -1327,7 +1327,7 @@ -- @field #string id Record id -- @field #string name Human-readable name -- @field #string model VFS path to the model --- @field #string mwscript MWScript on this armor (can be empty) +-- @field #string mwscript MWScript on this armor (can be nil) -- @field #string icon VFS path to the icon -- @field #string enchant The enchantment ID of this armor (can be nil) -- @field #number weight @@ -1416,7 +1416,7 @@ -- @field #string id The record ID of the book -- @field #string name Name of the book -- @field #string model VFS path to the model --- @field #string mwscript MWScript on this book (can be empty) +-- @field #string mwscript MWScript on this book (can be nil) -- @field #string icon VFS path to the icon -- @field #string enchant The enchantment ID of this book (can be nil) -- @field #string text The text content of the book @@ -1494,7 +1494,7 @@ -- @field #string id Record id -- @field #string name Name of the clothing -- @field #string model VFS path to the model --- @field #string mwscript MWScript on this clothing (can be empty) +-- @field #string mwscript MWScript on this clothing (can be nil) -- @field #string icon VFS path to the icon -- @field #string enchant The enchantment ID of this clothing (can be nil) -- @field #number weight @@ -1537,7 +1537,7 @@ -- @field #string id Record id -- @field #string name Human-readable name -- @field #string model VFS path to the model --- @field #string mwscript MWScript on this potion (can be empty) +-- @field #string mwscript MWScript on this potion (can be nil) -- @field #string icon VFS path to the icon -- @field #number weight -- @field #number value @@ -1643,7 +1643,7 @@ -- @field #string id Record id -- @field #string name Human-readable name -- @field #string model VFS path to the model --- @field #string mwscript MWScript on this light (can be empty) +-- @field #string mwscript MWScript on this light (can be nil) -- @field #string icon VFS path to the icon -- @field #string sound VFS path to the sound -- @field #number weight @@ -1714,7 +1714,7 @@ -- @field #string id The record ID of the miscellaneous item -- @field #string name The name of the miscellaneous item -- @field #string model VFS path to the model --- @field #string mwscript MWScript on this miscellaneous item (can be empty) +-- @field #string mwscript MWScript on this miscellaneous item (can be nil) -- @field #string icon VFS path to the icon -- @field #number weight -- @field #number value @@ -1759,7 +1759,7 @@ -- @field #string id Record id -- @field #string name Human-readable name -- @field #string model VFS path to the model --- @field #string mwscript MWScript on this potion (can be empty) +-- @field #string mwscript MWScript on this potion (can be nil) -- @field #string icon VFS path to the icon -- @field #number weight -- @field #number value @@ -1819,7 +1819,7 @@ -- @field #string id Record id -- @field #string name Human-readable name -- @field #string model VFS path to the model --- @field #string mwscript MWScript on this weapon (can be empty) +-- @field #string mwscript MWScript on this weapon (can be nil) -- @field #string icon VFS path to the icon -- @field #string enchant The enchantment ID of this weapon (can be nil) -- @field #boolean isMagical @@ -1888,7 +1888,7 @@ -- @field #string id The record ID of the apparatus -- @field #string name The name of the apparatus -- @field #string model VFS path to the model --- @field #string mwscript MWScript on this apparatus (can be empty) +-- @field #string mwscript MWScript on this apparatus (can be nil) -- @field #string icon VFS path to the icon -- @field #number type The type of apparatus. See @{#Apparatus.TYPE} -- @field #number weight @@ -1927,7 +1927,7 @@ -- @field #string id The record ID of the lockpick -- @field #string name The name of the lockpick -- @field #string model VFS path to the model --- @field #string mwscript MWScript on this lockpick (can be empty) +-- @field #string mwscript MWScript on this lockpick (can be nil) -- @field #string icon VFS path to the icon -- @field #number maxCondition The maximum number of uses of this lockpick -- @field #number weight @@ -1966,7 +1966,7 @@ -- @field #string id The record ID of the probe -- @field #string name The name of the probe -- @field #string model VFS path to the model --- @field #string mwscript MWScript on this probe (can be empty) +-- @field #string mwscript MWScript on this probe (can be nil) -- @field #string icon VFS path to the icon -- @field #number maxCondition The maximum number of uses of this probe -- @field #number weight @@ -2005,7 +2005,7 @@ -- @field #string id The record ID of the repair tool -- @field #string name The name of the repair tool -- @field #string model VFS path to the model --- @field #string mwscript MWScript on this repair tool (can be empty) +-- @field #string mwscript MWScript on this repair tool (can be nil) -- @field #string icon VFS path to the icon -- @field #number maxCondition The maximum number of uses of this repair tool -- @field #number weight @@ -2042,7 +2042,7 @@ -- @field #string id Record id -- @field #string name Human-readable name -- @field #string model VFS path to the model --- @field #string mwscript MWScript on this activator (can be empty) +-- @field #string mwscript MWScript on this activator (can be nil) --- -- Creates a @{#ActivatorRecord} without adding it to the world database. @@ -2109,7 +2109,7 @@ -- @field #string id Record id -- @field #string name Human-readable name -- @field #string model VFS path to the model --- @field #string mwscript MWScript on this container (can be empty) +-- @field #string mwscript MWScript on this container (can be nil) -- @field #number weight capacity of this container -- @field #boolean isOrganic Whether items can be placed in the container -- @field #boolean isRespawning Whether the container respawns its contents @@ -2171,7 +2171,7 @@ -- @field #string id Record id -- @field #string name Human-readable name -- @field #string model VFS path to the model --- @field #string mwscript MWScript on this door (can be empty) +-- @field #string mwscript MWScript on this door (can be nil) -- @field #string openSound VFS path to the sound of opening -- @field #string closeSound VFS path to the sound of closing