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

Method interact

source/game/StarWorldClient.cpp:1661–1681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1659}
1660
1661RpcPromise<InteractAction> WorldClient::interact(InteractRequest const& request) {
1662 if (!inWorld())
1663 return RpcPromise<InteractAction>::createFailed("not initialized in world");
1664
1665 if (auto targetEntity = m_entityMap->entity(request.targetId)) {
1666 if (targetEntity->isMaster()) {
1667 // client-side-master entities need to be handled here rather than over network
1668 auto interactiveTarget = as<InteractiveEntity>(targetEntity);
1669 starAssert(interactiveTarget);
1670
1671 return RpcPromise<InteractAction>::createFulfilled(interactiveTarget->interact(request));
1672 }
1673 }
1674
1675 auto pair = RpcPromise<InteractAction>::createPair();
1676 Uuid requestId;
1677 m_entityInteractionResponses[requestId] = pair.second;
1678 m_outgoingPackets.append(make_shared<EntityInteractPacket>(request, requestId));
1679
1680 return pair.first;
1681}
1682
1683void WorldClient::lightingTileGather() {
1684 int64_t start = Time::monotonicMicroseconds();

Callers

nothing calls this directly

Calls 3

isMasterMethod · 0.80
entityMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected