History

Update ScriptEngine to store full running status off entity scripts

Ryan Huffman committed 9 years ago

Commit cbb55a01 parent 89d12423 files · +93 −42Browse files

Showing the changes to assignment-client/src/scripts/EntityScriptServer.cpp (1 of 3 files). Show all

Unified · Split

assignment-client/src/scripts/EntityScriptServer.cpp+15−9
@@ -11,8 +11,11 @@ · 10 unmodified lines
11 11
12#include "EntityScriptServer.h"12#include "EntityScriptServer.h"
13 13
14#include "EntityScriptUtils.h"
15
14#include <AudioConstants.h>16#include <AudioConstants.h>
15#include <AudioInjectorManager.h>17#include <AudioInjectorManager.h>
18#include <src/entities/AssignmentParentFinder.h>
16#include <EntityScriptingInterface.h>19#include <EntityScriptingInterface.h>
17#include <MessagesClient.h>20#include <MessagesClient.h>
18#include <plugins/CodecPlugin.h>21#include <plugins/CodecPlugin.h>
@@ -23,8 +26,6 @@ · 4 unmodified lines
23#include <SoundCache.h>26#include <SoundCache.h>
24#include <WebSocketServerClass.h>27#include <WebSocketServerClass.h>
25 28
26#include "../entities/AssignmentParentFinder.h"
27
28const size_t UUID_LENGTH_BYTES = 16;29const size_t UUID_LENGTH_BYTES = 16;
29 30
30int EntityScriptServer::_entitiesScriptEngineCount = 0;31int EntityScriptServer::_entitiesScriptEngineCount = 0;
@@ -75,16 +76,21 @@ void EntityScriptServer::handleEntityScriptGetStatusPacket(QSharedPointer<Receiv · 44 unmodified lines
75 MessageID messageID;76 MessageID messageID;
76 message->readPrimitive(&messageID);77 message->readPrimitive(&messageID);
77 auto entityID = QUuid::fromRfc4122(message->read(UUID_LENGTH_BYTES));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;80 auto replyPacketList = NLPacketList::create(PacketType::EntityScriptGetStatusReply, QByteArray(), true, true);
82 auto replyPacket = NLPacket::create(PacketType::EntityScriptGetStatusReply, -1, true);81 replyPacketList->writePrimitive(messageID);
83 replyPacket->writePrimitive(messageID);82
84 replyPacket->writeString("running");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 auto nodeList = DependencyManager::get<NodeList>();92 auto nodeList = DependencyManager::get<NodeList>();
87 nodeList->sendPacket(std::move(replyPacket), *senderNode);93 nodeList->sendPacketList(std::move(replyPacketList), *senderNode);
88}94}
89 95
90void EntityScriptServer::run() {96void EntityScriptServer::run() {