mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 08:23:04 +02:00
cleanup comment and scoping for server script URL changes
This commit is contained in:
parent
f1b4f79ad9
commit
304618f51d
2 changed files with 10 additions and 14 deletions
|
@ -781,22 +781,17 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
||||||
READ_ENTITY_PROPERTY(PROP_SCRIPT, QString, setScript);
|
READ_ENTITY_PROPERTY(PROP_SCRIPT, QString, setScript);
|
||||||
READ_ENTITY_PROPERTY(PROP_SCRIPT_TIMESTAMP, quint64, setScriptTimestamp);
|
READ_ENTITY_PROPERTY(PROP_SCRIPT_TIMESTAMP, quint64, setScriptTimestamp);
|
||||||
|
|
||||||
bool previousOverwriteLocalDataValue = overwriteLocalData;
|
{
|
||||||
|
// We use this scope to work around an issue stopping server script changes
|
||||||
|
// from being received by an entity script server running a script that continously updates an entity.
|
||||||
|
|
||||||
if (!overwriteLocalData) {
|
// Basically, we'll allow recent changes to the server scripts even if there are local changes to other properties
|
||||||
// We've decided not to read the data in this update because we have a newer local state of the entity.
|
// that have been made more recently.
|
||||||
// In order to work around a bug stopping server script changes from being received by an entity script server
|
|
||||||
// running a script that continously updates an entity, we force the overwriting of the server scripts
|
|
||||||
// if we believe this update might have a newer version than the one we have locally.
|
|
||||||
|
|
||||||
if (_lastEditedFromRemote > _serverScriptsChangedTimestamp) {
|
bool overwriteLocalData = !ignoreServerPacket || (lastEditedFromBufferAdjusted > _serverScriptsChangedTimestamp);
|
||||||
overwriteLocalData = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
READ_ENTITY_PROPERTY(PROP_SERVER_SCRIPTS, QString, setServerScripts);
|
READ_ENTITY_PROPERTY(PROP_SERVER_SCRIPTS, QString, setServerScripts);
|
||||||
|
}
|
||||||
overwriteLocalData = previousOverwriteLocalDataValue;
|
|
||||||
|
|
||||||
READ_ENTITY_PROPERTY(PROP_REGISTRATION_POINT, glm::vec3, updateRegistrationPoint);
|
READ_ENTITY_PROPERTY(PROP_REGISTRATION_POINT, glm::vec3, updateRegistrationPoint);
|
||||||
|
|
||||||
|
|
|
@ -518,7 +518,8 @@ protected:
|
||||||
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;
|
||||||
quint64 _serverScriptsChangedTimestamp; /// keep track of time when _serverScripts property was last changed
|
/// keep track of time when _serverScripts property was last changed
|
||||||
|
quint64 _serverScriptsChangedTimestamp { ENTITY_ITEM_DEFAULT_SCRIPT_TIMESTAMP };
|
||||||
|
|
||||||
/// 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