mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 17:17:58 +02:00
adjust how the decision to send action changes over the wire is made
This commit is contained in:
parent
2e635bd936
commit
a8cd891e48
6 changed files with 10 additions and 11 deletions
|
@ -211,7 +211,7 @@ bool AvatarActionHold::updateArguments(QVariantMap arguments) {
|
||||||
|
|
||||||
auto ownerEntity = _ownerEntity.lock();
|
auto ownerEntity = _ownerEntity.lock();
|
||||||
if (ownerEntity) {
|
if (ownerEntity) {
|
||||||
ownerEntity->setActionDataDirty(true);
|
ownerEntity->setActionDataNeedsUpdate(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
activateBody();
|
activateBody();
|
||||||
|
|
|
@ -1740,8 +1740,6 @@ void EntityItem::deserializeActionsInternal() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_actionDataDirty = true;
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1802,11 +1800,11 @@ void EntityItem::serializeActions(bool& success, QByteArray& result) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
const QByteArray EntityItem::getActionDataInternal() const {
|
const QByteArray EntityItem::getActionDataInternal() const {
|
||||||
if (_actionDataDirty) {
|
if (_actionDataNeedsUpdate) {
|
||||||
bool success;
|
bool success;
|
||||||
serializeActions(success, _allActionsDataCache);
|
serializeActions(success, _allActionsDataCache);
|
||||||
if (success) {
|
if (success) {
|
||||||
_actionDataDirty = false;
|
_actionDataNeedsUpdate = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _allActionsDataCache;
|
return _allActionsDataCache;
|
||||||
|
@ -1816,7 +1814,7 @@ const QByteArray EntityItem::getActionData() const {
|
||||||
QByteArray result;
|
QByteArray result;
|
||||||
assertUnlocked();
|
assertUnlocked();
|
||||||
|
|
||||||
if (_actionDataDirty) {
|
if (_actionDataNeedsUpdate) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
getActionDataInternal();
|
getActionDataInternal();
|
||||||
result = _allActionsDataCache;
|
result = _allActionsDataCache;
|
||||||
|
|
|
@ -408,7 +408,8 @@ public:
|
||||||
QList<QUuid> getActionIDs() { return _objectActions.keys(); }
|
QList<QUuid> getActionIDs() { return _objectActions.keys(); }
|
||||||
QVariantMap getActionArguments(const QUuid& actionID) const;
|
QVariantMap getActionArguments(const QUuid& actionID) const;
|
||||||
void deserializeActions();
|
void deserializeActions();
|
||||||
void setActionDataDirty(bool value) const { _actionDataDirty = value; }
|
void setActionDataNeedsUpdate(bool value) const { _actionDataNeedsUpdate = value; }
|
||||||
|
bool actionDataNeedsUpdate() const { return _actionDataNeedsUpdate; }
|
||||||
bool shouldSuppressLocationEdits() const;
|
bool shouldSuppressLocationEdits() const;
|
||||||
|
|
||||||
void setSourceUUID(const QUuid& sourceUUID) { _sourceUUID = sourceUUID; }
|
void setSourceUUID(const QUuid& sourceUUID) { _sourceUUID = sourceUUID; }
|
||||||
|
@ -511,7 +512,7 @@ protected:
|
||||||
// are used to keep track of and work around this situation.
|
// are used to keep track of and work around this situation.
|
||||||
void checkWaitingToRemove(EntitySimulation* simulation = nullptr);
|
void checkWaitingToRemove(EntitySimulation* simulation = nullptr);
|
||||||
mutable QSet<QUuid> _actionsToRemove;
|
mutable QSet<QUuid> _actionsToRemove;
|
||||||
mutable bool _actionDataDirty = false;
|
mutable bool _actionDataNeedsUpdate = false;
|
||||||
// _previouslyDeletedActions is used to avoid an action being re-added due to server round-trip lag
|
// _previouslyDeletedActions is used to avoid an action being re-added due to server round-trip lag
|
||||||
static quint64 _rememberDeletedActionTime;
|
static quint64 _rememberDeletedActionTime;
|
||||||
mutable QHash<QUuid, quint64> _previouslyDeletedActions;
|
mutable QHash<QUuid, quint64> _previouslyDeletedActions;
|
||||||
|
|
|
@ -297,7 +297,7 @@ bool EntityMotionState::remoteSimulationOutOfSync(uint32_t simulationStep) {
|
||||||
_serverPosition += dt * _serverVelocity;
|
_serverPosition += dt * _serverVelocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_serverActionData != _entity->getActionData()) {
|
if (_entity->actionDataNeedsUpdate()) {
|
||||||
setOutgoingPriority(SCRIPT_EDIT_SIMULATION_PRIORITY);
|
setOutgoingPriority(SCRIPT_EDIT_SIMULATION_PRIORITY);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ bool ObjectActionOffset::updateArguments(QVariantMap arguments) {
|
||||||
|
|
||||||
auto ownerEntity = _ownerEntity.lock();
|
auto ownerEntity = _ownerEntity.lock();
|
||||||
if (ownerEntity) {
|
if (ownerEntity) {
|
||||||
ownerEntity->setActionDataDirty(true);
|
ownerEntity->setActionDataNeedsUpdate(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
activateBody();
|
activateBody();
|
||||||
|
|
|
@ -162,7 +162,7 @@ bool ObjectActionSpring::updateArguments(QVariantMap arguments) {
|
||||||
|
|
||||||
auto ownerEntity = _ownerEntity.lock();
|
auto ownerEntity = _ownerEntity.lock();
|
||||||
if (ownerEntity) {
|
if (ownerEntity) {
|
||||||
ownerEntity->setActionDataDirty(true);
|
ownerEntity->setActionDataNeedsUpdate(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
activateBody();
|
activateBody();
|
||||||
|
|
Loading…
Reference in a new issue