MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / entityNametag

Method entityNametag

source/game/scripting/StarWorldLuaBindings.cpp:1460–1476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1458 }
1459
1460 Maybe<Json> WorldEntityCallbacks::entityNametag(World* world, EntityId entityId) {
1461 auto entity = world->entity(entityId);
1462
1463 Json result;
1464 if (auto nametagEntity = as<NametagEntity>(entity)) {
1465 result = JsonObject{
1466 {"nametag", nametagEntity->nametag()},
1467 {"displayed", nametagEntity->displayNametag()},
1468 {"color", jsonFromColor(Color::rgb(nametagEntity->nametagColor()))},
1469 {"origin", jsonFromVec2F(nametagEntity->nametagOrigin())},
1470 };
1471 if (auto status = nametagEntity->statusText())
1472 result.set("status", *status);
1473 }
1474
1475 return result;
1476 }
1477
1478 Maybe<String> WorldEntityCallbacks::entityDescription(World* world, EntityId entityId, Maybe<String> const& species) {
1479 if (auto entity = world->entity(entityId)) {

Callers

nothing calls this directly

Calls 9

jsonFromColorFunction · 0.85
jsonFromVec2FFunction · 0.85
entityMethod · 0.45
nametagMethod · 0.45
displayNametagMethod · 0.45
nametagColorMethod · 0.45
nametagOriginMethod · 0.45
statusTextMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected