mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 14:03:55 +02:00
Merge pull request #40 from birarda/entity-script-server
hack to accept possibly newer server scripts
This commit is contained in:
commit
3f34a9e832
2 changed files with 18 additions and 2 deletions
|
@ -780,7 +780,19 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
|||
READ_ENTITY_PROPERTY(PROP_LIFETIME, float, updateLifetime);
|
||||
READ_ENTITY_PROPERTY(PROP_SCRIPT, QString, setScript);
|
||||
READ_ENTITY_PROPERTY(PROP_SCRIPT_TIMESTAMP, quint64, setScriptTimestamp);
|
||||
READ_ENTITY_PROPERTY(PROP_SERVER_SCRIPTS, QString, setServerScripts);
|
||||
|
||||
{
|
||||
// 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.
|
||||
|
||||
// Basically, we'll allow recent changes to the server scripts even if there are local changes to other properties
|
||||
// that have been made more recently.
|
||||
|
||||
bool overwriteLocalData = !ignoreServerPacket || (lastEditedFromBufferAdjusted > _serverScriptsChangedTimestamp);
|
||||
|
||||
READ_ENTITY_PROPERTY(PROP_SERVER_SCRIPTS, QString, setServerScripts);
|
||||
}
|
||||
|
||||
READ_ENTITY_PROPERTY(PROP_REGISTRATION_POINT, glm::vec3, updateRegistrationPoint);
|
||||
|
||||
READ_ENTITY_PROPERTY(PROP_ANGULAR_DAMPING, float, updateAngularDamping);
|
||||
|
|
|
@ -261,7 +261,8 @@ public:
|
|||
void setScriptTimestamp(const quint64 value) { _scriptTimestamp = value; }
|
||||
|
||||
QString getServerScripts() const { return _serverScripts; }
|
||||
void setServerScripts(const QString& serverScripts) { _serverScripts = serverScripts; }
|
||||
void setServerScripts(const QString& serverScripts)
|
||||
{ _serverScripts = serverScripts; _serverScriptsChangedTimestamp = usecTimestampNow(); }
|
||||
|
||||
const QString& getCollisionSoundURL() const { return _collisionSoundURL; }
|
||||
void setCollisionSoundURL(const QString& value);
|
||||
|
@ -515,7 +516,10 @@ protected:
|
|||
QString _script; /// the value of the script property
|
||||
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;
|
||||
/// 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
|
||||
// NOTE: on construction we want this to be different from _scriptTimestamp so we intentionally bump it
|
||||
|
|
Loading…
Reference in a new issue