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