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

Method entityName

source/game/scripting/StarWorldLuaBindings.cpp:1439–1458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1437 }
1438
1439 Maybe<String> WorldEntityCallbacks::entityName(World* world, EntityId entityId) {
1440 auto entity = world->entity(entityId);
1441
1442 if (auto portraitEntity = as<PortraitEntity>(entity)) {
1443 return portraitEntity->name();
1444 } else if (auto objectEntity = as<Object>(entity)) {
1445 return objectEntity->name();
1446 } else if (auto itemDropEntity = as<ItemDrop>(entity)) {
1447 if (itemDropEntity->item())
1448 return itemDropEntity->item()->name();
1449 } else if (auto vehicleEntity = as<Vehicle>(entity)) {
1450 return vehicleEntity->name();
1451 } else if (auto stagehandEntity = as<Stagehand>(entity)) {
1452 return stagehandEntity->typeName();
1453 } else if (auto projectileEntity = as<Projectile>(entity)) {
1454 return projectileEntity->typeName();
1455 }
1456
1457 return {};
1458 }
1459
1460 Maybe<Json> WorldEntityCallbacks::entityNametag(World* world, EntityId entityId) {
1461 auto entity = world->entity(entityId);

Callers

nothing calls this directly

Calls 4

entityMethod · 0.45
nameMethod · 0.45
itemMethod · 0.45
typeNameMethod · 0.45

Tested by

no test coverage detected