some cleanup

This commit is contained in:
ZappoMan 2017-10-24 11:46:42 -07:00
parent 1128a98e88
commit a1885926b5
5 changed files with 12 additions and 10 deletions

View file

@ -30,7 +30,7 @@
#include <UUID.h>
#include <WebSocketServerClass.h>
#include <EntityScriptClient.h> // for EntityScriptServerStub
#include <EntityScriptClient.h> // for EntityScriptServerServices
#include "EntityScriptServerLogging.h"
#include "../entities/AssignmentParentFinder.h"
@ -70,7 +70,7 @@ EntityScriptServer::EntityScriptServer(ReceivedMessage& message) : ThreadedAssig
DependencyManager::set<ScriptCache>();
DependencyManager::set<ScriptEngines>(ScriptEngine::ENTITY_SERVER_SCRIPT);
DependencyManager::set<EntityScriptServerStub>();
DependencyManager::set<EntityScriptServerServices>();
// Needed to ensure the creation of the DebugDraw instance on the main thread

View file

@ -577,7 +577,14 @@ void EntityScriptingInterface::callEntityServerMethod(QUuid id, const QString& m
void EntityScriptingInterface::callEntityClientMethod(QUuid clientSessionID, QUuid entityID, const QString& method, const QStringList& params) {
PROFILE_RANGE(script_entities, __FUNCTION__);
DependencyManager::get<EntityScriptServerStub>()->callEntityClientMethod(clientSessionID, entityID, method, params);
auto scriptServerServices = DependencyManager::get<EntityScriptServerServices>();
// this won't be available on clients
if (scriptServerServices) {
scriptServerServices->callEntityClientMethod(clientSessionID, entityID, method, params);
} else {
qWarning() << "Entities.callEntityClientMethod() not allowed in client";
}
}

View file

@ -92,10 +92,7 @@ void EntityScriptClient::callEntityServerMethod(QUuid entityID, const QString& m
}
}
void EntityScriptServerStub::callEntityClientMethod(QUuid clientSessionID, QUuid entityID, const QString& method, const QStringList& params) {
qDebug() << __FUNCTION__;
void EntityScriptServerServices::callEntityClientMethod(QUuid clientSessionID, QUuid entityID, const QString& method, const QStringList& params) {
// only valid to call this function if you are the entity script server
auto nodeList = DependencyManager::get<NodeList>();
SharedNodePointer targetClient = nodeList->nodeWithUUID(clientSessionID);

View file

@ -75,7 +75,7 @@ private:
};
class EntityScriptServerStub : public QObject, public Dependency {
class EntityScriptServerServices : public QObject, public Dependency {
Q_OBJECT
public:
void callEntityClientMethod(QUuid clientSessionID, QUuid entityID, const QString& method, const QStringList& params);

View file

@ -2510,8 +2510,6 @@ void ScriptEngine::callEntityScriptMethod(const EntityItemID& entityID, const QS
if (remoteCallerID == QUuid()) {
callAllowed = true;
} else {
qDebug() << __FUNCTION__ << "checking remotelyCallable method: " << methodName << " on entityID:" << entityID;
if (entityScript.property("remotelyCallable").isArray()) {
auto callables = entityScript.property("remotelyCallable");
auto callableCount = callables.property("length").toInteger();