| 1183 | } |
| 1184 | |
| 1185 | Json ServerWorldCallbacks::takeItemDrop(World* world, EntityId entityId, Maybe<EntityId> const& takenBy) { |
| 1186 | auto itemDrop = world->get<ItemDrop>(entityId); |
| 1187 | if (itemDrop && itemDrop->canTake() && itemDrop->isMaster()) { |
| 1188 | ItemPtr item; |
| 1189 | if (takenBy) |
| 1190 | item = itemDrop->takeBy(*takenBy); |
| 1191 | else |
| 1192 | item = itemDrop->take(); |
| 1193 | |
| 1194 | if (item) |
| 1195 | return item->descriptor().toJson(); |
| 1196 | } |
| 1197 | |
| 1198 | return Json(); |
| 1199 | } |
| 1200 | |
| 1201 | void ServerWorldCallbacks::setPlayerStart(World* world, Vec2F const& playerStart, Maybe<bool> respawnInWorld) { |
| 1202 | as<WorldServer>(world)->setPlayerStart(playerStart, respawnInWorld.isValid() && respawnInWorld.value()); |