Showing the changes to assignment-client/src/scripts/EntityScriptServer.cpp (1 of 3 files). Show all
Unified · Split
| @@ -11,8 +11,11 @@ · 10 unmodified lines | ||
| 11 | 11 | |
| 12 | 12 | #include "EntityScriptServer.h" |
| 13 | 13 | |
| 14 | +#include "EntityScriptUtils.h" | |
| 15 | + | |
| 14 | 16 | #include <AudioConstants.h> |
| 15 | 17 | #include <AudioInjectorManager.h> |
| 18 | +#include <src/entities/AssignmentParentFinder.h> | |
| 16 | 19 | #include <EntityScriptingInterface.h> |
| 17 | 20 | #include <MessagesClient.h> |
| 18 | 21 | #include <plugins/CodecPlugin.h> |
| @@ -23,8 +26,6 @@ · 4 unmodified lines | ||
| 23 | 26 | #include <SoundCache.h> |
| 24 | 27 | #include <WebSocketServerClass.h> |
| 25 | 28 | |
| 26 | −#include "../entities/AssignmentParentFinder.h" | |
| 27 | − | |
| 28 | 29 | const size_t UUID_LENGTH_BYTES = 16; |
| 29 | 30 | |
| 30 | 31 | int EntityScriptServer::_entitiesScriptEngineCount = 0; |
| @@ -75,16 +76,21 @@ void EntityScriptServer::handleEntityScriptGetStatusPacket(QSharedPointer<Receiv · 44 unmodified lines | ||
| 75 | 76 | MessageID messageID; |
| 76 | 77 | message->readPrimitive(&messageID); |
| 77 | 78 | auto entityID = QUuid::fromRfc4122(message->read(UUID_LENGTH_BYTES)); |
| 78 | − | |
| 79 | − // TODO(Huffman) Get Status | |
| 80 | 79 | |
| 81 | − qDebug() << "Getting script status of: " << entityID; | |
| 82 | − auto replyPacket = NLPacket::create(PacketType::EntityScriptGetStatusReply, -1, true); | |
| 83 | − replyPacket->writePrimitive(messageID); | |
| 84 | − replyPacket->writeString("running"); | |
| 80 | + auto replyPacketList = NLPacketList::create(PacketType::EntityScriptGetStatusReply, QByteArray(), true, true); | |
| 81 | + replyPacketList->writePrimitive(messageID); | |
| 82 | + | |
| 83 | + EntityScriptDetails details; | |
| 84 | + if (_entitiesScriptEngine->getEntityScriptDetails(entityID, details)) { | |
| 85 | + replyPacketList->writePrimitive(true); | |
| 86 | + replyPacketList->writePrimitive(details.status); | |
| 87 | + replyPacketList->writeString(details.errorInfo); | |
| 88 | + } else { | |
| 89 | + replyPacketList->writePrimitive(false); | |
| 90 | + } | |
| 85 | 91 | |
| 86 | 92 | auto nodeList = DependencyManager::get<NodeList>(); |
| 87 | − nodeList->sendPacket(std::move(replyPacket), *senderNode); | |
| 93 | + nodeList->sendPacketList(std::move(replyPacketList), *senderNode); | |
| 88 | 94 | } |
| 89 | 95 | |
| 90 | 96 | void EntityScriptServer::run() { |