Showing the changes to assignment-client/src/scripts/EntityScriptServer.cpp (1 of 1 file). Show all
Unified · Split
| @@ -281,12 +281,12 @@ void EntityScriptServer::entityServerScriptChanging(const EntityItemID& entityID · 280 unmodified lines | |||
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | void EntityScriptServer::checkAndCallPreload(const EntityItemID& entityID, const bool reload) { | 283 | void EntityScriptServer::checkAndCallPreload(const EntityItemID& entityID, const bool reload) { |
| 284 | EntityScriptDetails details; | 284 | if (_entityViewer.getTree() && !_shuttingDown && _entitiesScriptEngine) { |
| 285 | if (_entityViewer.getTree() && !_shuttingDown && _entitiesScriptEngine && | ||
| 286 | _entitiesScriptEngine->getEntityScriptDetails(entityID, details)) { | ||
| 287 | 285 | ||
| 288 | EntityItemPointer entity = _entityViewer.getTree()->findEntityByEntityItemID(entityID); | 286 | EntityItemPointer entity = _entityViewer.getTree()->findEntityByEntityItemID(entityID); |
| 289 | if (entity && (details.scriptText != entity->getServerScripts() || reload)) { | 287 | EntityScriptDetails details; |
| 288 | bool notRunning = !_entitiesScriptEngine->getEntityScriptDetails(entityID, details); | ||
| 289 | if (entity && (reload || notRunning || details.scriptText != entity->getServerScripts())) { | ||
| 290 | QString scriptUrl = entity->getServerScripts(); | 290 | QString scriptUrl = entity->getServerScripts(); |
| 291 | scriptUrl = ResourceManager::normalizeURL(scriptUrl); | 291 | scriptUrl = ResourceManager::normalizeURL(scriptUrl); |
| 292 | qDebug() << "Loading entity server script" << scriptUrl << "for" << entityID; | 292 | qDebug() << "Loading entity server script" << scriptUrl << "for" << entityID; |