mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-10 21:40:15 +00:00
[Lua] New function cell:hasTag
This commit is contained in:
parent
563324bcff
commit
f0a06258fb
@ -45,10 +45,23 @@ namespace MWLua
|
||||
cellT["gridX"] = sol::readonly_property([](const CellT& c) { return c.mStore->getCell()->getGridX(); });
|
||||
cellT["gridY"] = sol::readonly_property([](const CellT& c) { return c.mStore->getCell()->getGridY(); });
|
||||
cellT["hasWater"] = sol::readonly_property([](const CellT& c) { return c.mStore->getCell()->hasWater(); });
|
||||
cellT["hasSky"] = sol::readonly_property([](const CellT& c) {
|
||||
return c.mStore->getCell()->isExterior() || (c.mStore->getCell()->mData.mFlags & ESM::Cell::QuasiEx) != 0;
|
||||
});
|
||||
cellT["isExterior"] = sol::readonly_property([](const CellT& c) { return c.mStore->isExterior(); });
|
||||
|
||||
// deprecated, use cell:hasTag("QuasiExterior") instead
|
||||
cellT["isQuasiExterior"] = sol::readonly_property(
|
||||
[](const CellT& c) { return (c.mStore->getCell()->mData.mFlags & ESM::Cell::QuasiEx) != 0; });
|
||||
|
||||
cellT["hasTag"] = [](const CellT& c, std::string_view tag) -> bool {
|
||||
if (tag == "NoSleep")
|
||||
return (c.mStore->getCell()->mData.mFlags & ESM::Cell::NoSleep) != 0;
|
||||
else if (tag == "QuasiExterior")
|
||||
return (c.mStore->getCell()->mData.mFlags & ESM::Cell::QuasiEx) != 0;
|
||||
return false;
|
||||
};
|
||||
|
||||
cellT["isInSameSpace"] = [](const CellT& c, const ObjectT& obj) {
|
||||
const MWWorld::Ptr& ptr = obj.ptr();
|
||||
if (!ptr.isInCell())
|
||||
|
@ -182,11 +182,19 @@
|
||||
-- @type Cell
|
||||
-- @field #string name Name of the cell (can be empty string).
|
||||
-- @field #string region Region of the cell.
|
||||
-- @field #boolean isExterior Whether the cell is an exterior.
|
||||
-- @field #boolean isQuasiExterior Whether the cell is a quasi exterior (like interior but with the sky and the wheather).
|
||||
-- @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.
|
||||
-- @field #boolean isQuasiExterior (DEPRECATED, use `hasTag("QuasiExterior")`) Whether the cell is a quasi exterior (like interior but with the sky and the wheather).
|
||||
-- @field #number gridX Index of the cell by X (only for exteriors).
|
||||
-- @field #number gridY Index of the cell by Y (only for exteriors).
|
||||
-- @field #boolean hasWater True if the cell contains water.
|
||||
-- @field #boolean hasSky True if in this cell sky should be rendered.
|
||||
|
||||
---
|
||||
-- Returns true if the cell has given tag.
|
||||
-- @function [parent=#Cell] hasTag
|
||||
-- @param self
|
||||
-- @param #string tag One of "QuasiExterior", "NoSleep".
|
||||
-- @return #boolean
|
||||
|
||||
---
|
||||
-- Returns true either if the cell contains the object or if the cell is an exterior and the object is also in an exterior.
|
||||
|
Loading…
x
Reference in New Issue
Block a user