1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-11-09 14:56:39 +00:00

Merge branch 'localize_cell_names' into 'master'

Localize cell names in the Lua API

Closes #8725

See merge request OpenMW/openmw!4938
This commit is contained in:
Alexei Kotov 2025-11-02 04:23:52 +03:00
commit b516770a04
3 changed files with 9 additions and 1 deletions

View file

@ -82,7 +82,7 @@ message(STATUS "Configuring OpenMW...")
set(OPENMW_VERSION_MAJOR 0)
set(OPENMW_VERSION_MINOR 51)
set(OPENMW_VERSION_RELEASE 0)
set(OPENMW_LUA_API_REVISION 97)
set(OPENMW_LUA_API_REVISION 98)
set(OPENMW_POSTPROCESSING_API_REVISION 3)
set(OPENMW_VERSION_COMMITHASH "")

View file

@ -40,7 +40,10 @@
#include <components/esm4/loadtree.hpp>
#include <components/esm4/loadweap.hpp>
#include <components/translation/translation.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/worldmodel.hpp"
@ -85,6 +88,10 @@ namespace MWLua
};
cellT["name"] = sol::readonly_property([](const CellT& c) { return c.mStore->getCell()->getNameId(); });
cellT["displayName"] = sol::readonly_property([](const CellT& c) -> std::string_view {
const auto& storage = MWBase::Environment::get().getWindowManager()->getTranslationDataStorage();
return storage.translateCellName(c.mStore->getCell()->getNameId());
});
cellT["id"]
= sol::readonly_property([](const CellT& c) { return c.mStore->getCell()->getId().serializeText(); });
cellT["region"] = sol::readonly_property(

View file

@ -297,6 +297,7 @@
-- A cell of the game world.
-- @type Cell
-- @field #string name Name of the cell (can be empty string).
-- @field #string displayName Human-readable cell name (takes into account *.cel file localizations). Can be empty string.
-- @field #string id Unique record ID of the cell, based on cell name for interiors and the worldspace for exteriors, or the formID of the cell for ESM4 cells.
-- @field #string region Region of the cell.
-- @field #boolean isExterior Whether the cell is an exterior cell. "Exterior" means grid of cells where the player can seamless walk from one cell to another without teleports. QuasiExterior (interior with sky) is not an exterior.