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 | 283 | void EntityScriptServer::checkAndCallPreload(const EntityItemID& entityID, const bool reload) { |
| 284 | − EntityScriptDetails details; | |
| 285 | − if (_entityViewer.getTree() && !_shuttingDown && _entitiesScriptEngine && | |
| 286 | − _entitiesScriptEngine->getEntityScriptDetails(entityID, details)) { | |
| 284 | + if (_entityViewer.getTree() && !_shuttingDown && _entitiesScriptEngine) { | |
| 287 | 285 | |
| 288 | 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 | 290 | QString scriptUrl = entity->getServerScripts(); |
| 291 | 291 | scriptUrl = ResourceManager::normalizeURL(scriptUrl); |
| 292 | 292 | qDebug() << "Loading entity server script" << scriptUrl << "for" << entityID; |