Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2025-06-03 09:57:53 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2025-06-03 09:57:53 +1000
commitb4ecfab5b893d08d0d5784ef0b567b8cf0564a7e (patch)
treeb71f56d97e25e44f5e5c58dd26ba137c65f50f8a /source/game
parent72d55371d2d5bc2a14567c20a7c391a24c9f1837 (diff)
add statusText to world.nametagEntity
Diffstat (limited to 'source/game')
-rw-r--r--source/game/scripting/StarWorldLuaBindings.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/game/scripting/StarWorldLuaBindings.cpp b/source/game/scripting/StarWorldLuaBindings.cpp
index 64d1f30..9f5465a 100644
--- a/source/game/scripting/StarWorldLuaBindings.cpp
+++ b/source/game/scripting/StarWorldLuaBindings.cpp
@@ -1455,16 +1455,19 @@ namespace LuaBindings {
Maybe<Json> WorldEntityCallbacks::entityNametag(World* world, EntityId entityId) {
auto entity = world->entity(entityId);
+ Json result;
if (auto nametagEntity = as<NametagEntity>(entity)) {
- return JsonObject{
+ Json result = JsonObject{
{"nametag", nametagEntity->nametag()},
{"displayed", nametagEntity->displayNametag()},
{"color", jsonFromColor(Color::rgb(nametagEntity->nametagColor()))},
{"origin", jsonFromVec2F(nametagEntity->nametagOrigin())},
};
+ if (auto status = nametagEntity->statusText())
+ result.set("status", *status);
}
- return {};
+ return result;
}
Maybe<String> WorldEntityCallbacks::entityDescription(World* world, EntityId entityId, Maybe<String> const& species) {