mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
Fix server script preload funcitons
This commit is contained in:
parent
8dabf25c42
commit
e94cccf08d
2 changed files with 5 additions and 5 deletions
|
@ -243,11 +243,11 @@ void EntityScriptServer::entityServerScriptChanging(const EntityItemID& entityID
|
|||
void EntityScriptServer::checkAndCallPreload(const EntityItemID& entityID, const bool reload) {
|
||||
if (_entityViewer.getTree() && !_shuttingDown) {
|
||||
EntityItemPointer entity = _entityViewer.getTree()->findEntityByEntityItemID(entityID);
|
||||
if (entity && entity->shouldPreloadScript() && _entitiesScriptEngine) {
|
||||
if (entity && entity->shouldPreloadServerScript() && _entitiesScriptEngine) {
|
||||
QString scriptUrl = entity->getServerScripts();
|
||||
scriptUrl = ResourceManager::normalizeURL(scriptUrl);
|
||||
ScriptEngine::loadEntityScript(_entitiesScriptEngine, entityID, scriptUrl, reload);
|
||||
entity->scriptHasPreloaded();
|
||||
entity->serverScriptHasPreloaded();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -444,9 +444,8 @@ public:
|
|||
((_loadedScript != _script) || (_loadedScriptTimestamp != _scriptTimestamp)); }
|
||||
void scriptHasPreloaded() { _loadedScript = _script; _loadedScriptTimestamp = _scriptTimestamp; }
|
||||
|
||||
bool shouldPreloadServerScript() const { return !_script.isEmpty() &&
|
||||
((_loadedScript != _script) || (_loadedScriptTimestamp != _scriptTimestamp)); }
|
||||
void serverScriptHasPreloaded() { _loadedScript = _script; _loadedScriptTimestamp = _scriptTimestamp; }
|
||||
bool shouldPreloadServerScript() const { return !_serverScripts.isEmpty() && ((_loadedScript != _script)); }
|
||||
void serverScriptHasPreloaded() { _loadedScript = _script; }
|
||||
|
||||
bool getClientOnly() const { return _clientOnly; }
|
||||
void setClientOnly(bool clientOnly) { _clientOnly = clientOnly; }
|
||||
|
@ -520,6 +519,7 @@ protected:
|
|||
QString _loadedScript; /// the value of _script when the last preload signal was sent
|
||||
quint64 _scriptTimestamp{ ENTITY_ITEM_DEFAULT_SCRIPT_TIMESTAMP }; /// the script loaded property used for forced reload
|
||||
QString _serverScripts;
|
||||
QString _loadedServerScripts;
|
||||
|
||||
/// the value of _scriptTimestamp when the last preload signal was sent
|
||||
// NOTE: on construction we want this to be different from _scriptTimestamp so we intentionally bump it
|
||||
|
|
Loading…
Reference in a new issue