Showing the changes to libraries/networking/src/EntityScriptClient.cpp (1 of 6 files). Show all
Unified · Split
| @@ -92,6 +92,31 @@ void EntityScriptClient::callEntityServerMethod(QUuid entityID, const QString& m · 91 unmodified lines | |||
| 92 | } | 92 | } |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | void EntityScriptServerStub::callEntityClientMethod(QUuid clientSessionID, QUuid entityID, const QString& method, const QStringList& params) { | ||
| 96 | qDebug() << __FUNCTION__; | ||
| 97 | |||
| 98 | |||
| 99 | // only valid to call this function if you are the entity script server | ||
| 100 | auto nodeList = DependencyManager::get<NodeList>(); | ||
| 101 | SharedNodePointer targetClient = nodeList->nodeWithUUID(clientSessionID); | ||
| 102 | |||
| 103 | if (nodeList->getOwnerType() == NodeType::EntityScriptServer && targetClient) { | ||
| 104 | auto packetList = NLPacketList::create(PacketType::EntityScriptCallMethod, QByteArray(), true, true); | ||
| 105 | |||
| 106 | packetList->write(entityID.toRfc4122()); | ||
| 107 | |||
| 108 | packetList->writeString(method); | ||
| 109 | |||
| 110 | quint16 paramCount = params.length(); | ||
| 111 | packetList->writePrimitive(paramCount); | ||
| 112 | |||
| 113 | foreach(const QString& param, params) { | ||
| 114 | packetList->writeString(param); | ||
| 115 | } | ||
| 116 | |||
| 117 | nodeList->sendPacketList(std::move(packetList), *targetClient); | ||
| 118 | } | ||
| 119 | } | ||
| 95 | 120 | ||
| 96 | MessageID EntityScriptClient::getEntityServerScriptStatus(QUuid entityID, GetScriptStatusCallback callback) { | 121 | MessageID EntityScriptClient::getEntityServerScriptStatus(QUuid entityID, GetScriptStatusCallback callback) { |
| 97 | auto nodeList = DependencyManager::get<NodeList>(); | 122 | auto nodeList = DependencyManager::get<NodeList>(); |