| 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); |