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

Method takeItemDrop

source/game/scripting/StarWorldLuaBindings.cpp:1185–1199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

JsonClass · 0.85
canTakeMethod · 0.80
isMasterMethod · 0.80
takeByMethod · 0.80
takeMethod · 0.45
toJsonMethod · 0.45
descriptorMethod · 0.45

Tested by

no test coverage detected