| 1659 | } |
| 1660 | |
| 1661 | RpcPromise<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 | |
| 1683 | void WorldClient::lightingTileGather() { |
| 1684 | int64_t start = Time::monotonicMicroseconds(); |