mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 14:43:02 +02:00
Merge pull request #12 from Atlante45/ess-pr
Fix server script preload funcitons
This commit is contained in:
commit
fe2a5d6059
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) {
|
void EntityScriptServer::checkAndCallPreload(const EntityItemID& entityID, const bool reload) {
|
||||||
if (_entityViewer.getTree() && !_shuttingDown) {
|
if (_entityViewer.getTree() && !_shuttingDown) {
|
||||||
EntityItemPointer entity = _entityViewer.getTree()->findEntityByEntityItemID(entityID);
|
EntityItemPointer entity = _entityViewer.getTree()->findEntityByEntityItemID(entityID);
|
||||||
if (entity && entity->shouldPreloadScript() && _entitiesScriptEngine) {
|
if (entity && entity->shouldPreloadServerScript() && _entitiesScriptEngine) {
|
||||||
QString scriptUrl = entity->getServerScripts();
|
QString scriptUrl = entity->getServerScripts();
|
||||||
scriptUrl = ResourceManager::normalizeURL(scriptUrl);
|
scriptUrl = ResourceManager::normalizeURL(scriptUrl);
|
||||||
ScriptEngine::loadEntityScript(_entitiesScriptEngine, entityID, scriptUrl, reload);
|
ScriptEngine::loadEntityScript(_entitiesScriptEngine, entityID, scriptUrl, reload);
|
||||||
entity->scriptHasPreloaded();
|
entity->serverScriptHasPreloaded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -444,9 +444,8 @@ public:
|
||||||
((_loadedScript != _script) || (_loadedScriptTimestamp != _scriptTimestamp)); }
|
((_loadedScript != _script) || (_loadedScriptTimestamp != _scriptTimestamp)); }
|
||||||
void scriptHasPreloaded() { _loadedScript = _script; _loadedScriptTimestamp = _scriptTimestamp; }
|
void scriptHasPreloaded() { _loadedScript = _script; _loadedScriptTimestamp = _scriptTimestamp; }
|
||||||
|
|
||||||
bool shouldPreloadServerScript() const { return !_script.isEmpty() &&
|
bool shouldPreloadServerScript() const { return !_serverScripts.isEmpty() && ((_loadedServerScripts != _serverScripts)); }
|
||||||
((_loadedScript != _script) || (_loadedScriptTimestamp != _scriptTimestamp)); }
|
void serverScriptHasPreloaded() { _loadedServerScripts = _serverScripts; }
|
||||||
void serverScriptHasPreloaded() { _loadedScript = _script; _loadedScriptTimestamp = _scriptTimestamp; }
|
|
||||||
|
|
||||||
bool getClientOnly() const { return _clientOnly; }
|
bool getClientOnly() const { return _clientOnly; }
|
||||||
void setClientOnly(bool clientOnly) { _clientOnly = 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
|
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
|
quint64 _scriptTimestamp{ ENTITY_ITEM_DEFAULT_SCRIPT_TIMESTAMP }; /// the script loaded property used for forced reload
|
||||||
QString _serverScripts;
|
QString _serverScripts;
|
||||||
|
QString _loadedServerScripts;
|
||||||
|
|
||||||
/// the value of _scriptTimestamp when the last preload signal was sent
|
/// 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
|
// NOTE: on construction we want this to be different from _scriptTimestamp so we intentionally bump it
|
||||||
|
|
Loading…
Reference in a new issue