History

implement callEntityClientMethod

ZappoMan committed 9 years ago

Commit 1128a981 parent 77935066 files · +107 −5Browse files

Showing the changes to libraries/networking/src/EntityScriptClient.cpp (1 of 6 files). Show all

Unified · Split

libraries/networking/src/EntityScriptClient.cpp+25−0
@@ -92,6 +92,31 @@ void EntityScriptClient::callEntityServerMethod(QUuid entityID, const QString& m · 91 unmodified lines
92 }92 }
93}93}
94 94
95void 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
96MessageID EntityScriptClient::getEntityServerScriptStatus(QUuid entityID, GetScriptStatusCallback callback) {121MessageID EntityScriptClient::getEntityServerScriptStatus(QUuid entityID, GetScriptStatusCallback callback) {
97 auto nodeList = DependencyManager::get<NodeList>();122 auto nodeList = DependencyManager::get<NodeList>();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t