From fccf75377d53797a96646e3050b53f634d221412 Mon Sep 17 00:00:00 2001 From: Dave Corley Date: Mon, 24 Jun 2024 03:11:01 -0500 Subject: [PATCH 1/2] FEAT: Add organic/respawning flags to containers --- CHANGELOG.md | 1 + apps/openmw/mwlua/types/container.cpp | 4 ++++ files/lua_api/openmw/types.lua | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce530dfe3d..988106734b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -246,6 +246,7 @@ Feature #7964: Add Lua read access to MW Dialogue records Feature #7971: Make save's Time Played value display hours instead of days Feature #7985: Support dark mode on Windows + Feature #8034: (Lua) Containers should have respawning/organic flags Task #5896: Do not use deprecated MyGUI properties Task #6085: Replace boost::filesystem with std::filesystem Task #6149: Dehardcode Lua API_REVISION diff --git a/apps/openmw/mwlua/types/container.cpp b/apps/openmw/mwlua/types/container.cpp index 332cf6ac2e..11a66da03c 100644 --- a/apps/openmw/mwlua/types/container.cpp +++ b/apps/openmw/mwlua/types/container.cpp @@ -54,5 +54,9 @@ namespace MWLua record["mwscript"] = sol::readonly_property( [](const ESM::Container& rec) -> std::string { return rec.mScript.serializeText(); }); record["weight"] = sol::readonly_property([](const ESM::Container& rec) -> float { return rec.mWeight; }); + record["organic"] = sol::readonly_property( + [](const ESM::Container& rec) -> bool { return rec.mFlags & ESM::Container::Organic; }); + record["respawns"] = sol::readonly_property( + [](const ESM::Container& rec) -> bool { return rec.mFlags & ESM::Container::Respawn; }); } } diff --git a/files/lua_api/openmw/types.lua b/files/lua_api/openmw/types.lua index 39a3df579a..69ec965955 100644 --- a/files/lua_api/openmw/types.lua +++ b/files/lua_api/openmw/types.lua @@ -2109,7 +2109,8 @@ -- @field #string model VFS path to the model -- @field #string mwscript MWScript on this container (can be empty) -- @field #number weight capacity of this container - +-- @field #boolean organic Whether items can be placed in the container +-- @field #boolean respawns Whether the container respawns its contents -------------------------------------------------------------------------------- -- @{#Door} functions From 77fa41b8c6fc58a4c2bbdfadafe1f0915b242c59 Mon Sep 17 00:00:00 2001 From: Dave Corley Date: Fri, 28 Jun 2024 09:26:35 -0500 Subject: [PATCH 2/2] CLEANUP(container): Make organic/respawning field names more consistent --- apps/openmw/mwlua/types/container.cpp | 4 ++-- files/lua_api/openmw/types.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwlua/types/container.cpp b/apps/openmw/mwlua/types/container.cpp index 11a66da03c..55f3e4a10e 100644 --- a/apps/openmw/mwlua/types/container.cpp +++ b/apps/openmw/mwlua/types/container.cpp @@ -54,9 +54,9 @@ namespace MWLua record["mwscript"] = sol::readonly_property( [](const ESM::Container& rec) -> std::string { return rec.mScript.serializeText(); }); record["weight"] = sol::readonly_property([](const ESM::Container& rec) -> float { return rec.mWeight; }); - record["organic"] = sol::readonly_property( + record["isOrganic"] = sol::readonly_property( [](const ESM::Container& rec) -> bool { return rec.mFlags & ESM::Container::Organic; }); - record["respawns"] = sol::readonly_property( + record["isRespawning"] = sol::readonly_property( [](const ESM::Container& rec) -> bool { return rec.mFlags & ESM::Container::Respawn; }); } } diff --git a/files/lua_api/openmw/types.lua b/files/lua_api/openmw/types.lua index 69ec965955..1e0b486524 100644 --- a/files/lua_api/openmw/types.lua +++ b/files/lua_api/openmw/types.lua @@ -2109,8 +2109,8 @@ -- @field #string model VFS path to the model -- @field #string mwscript MWScript on this container (can be empty) -- @field #number weight capacity of this container --- @field #boolean organic Whether items can be placed in the container --- @field #boolean respawns Whether the container respawns its contents +-- @field #boolean isOrganic Whether items can be placed in the container +-- @field #boolean isRespawning Whether the container respawns its contents -------------------------------------------------------------------------------- -- @{#Door} functions