mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
action->locallyAddedButNotYetReceived is unneeded with isMine available
This commit is contained in:
parent
91af732516
commit
d76b8f2335
3 changed files with 4 additions and 14 deletions
|
@ -57,8 +57,6 @@ public:
|
||||||
virtual bool isMine() { return _isMine; }
|
virtual bool isMine() { return _isMine; }
|
||||||
virtual void setIsMine(bool value) { _isMine = value; }
|
virtual void setIsMine(bool value) { _isMine = value; }
|
||||||
|
|
||||||
bool locallyAddedButNotYetReceived = false;
|
|
||||||
|
|
||||||
virtual bool shouldSuppressLocationEdits() { return false; }
|
virtual bool shouldSuppressLocationEdits() { return false; }
|
||||||
|
|
||||||
virtual void prepareForPhysicsSimulation() { }
|
virtual void prepareForPhysicsSimulation() { }
|
||||||
|
|
|
@ -1666,7 +1666,7 @@ bool EntityItem::addAction(EntitySimulation* simulation, EntityActionPointer act
|
||||||
if (!result) {
|
if (!result) {
|
||||||
removeActionInternal(action->getID());
|
removeActionInternal(action->getID());
|
||||||
} else {
|
} else {
|
||||||
action->locallyAddedButNotYetReceived = true;
|
action->setIsMine(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1821,7 +1821,6 @@ void EntityItem::deserializeActionsInternal() {
|
||||||
if (!action->isMine()) {
|
if (!action->isMine()) {
|
||||||
action->deserialize(serializedAction);
|
action->deserialize(serializedAction);
|
||||||
}
|
}
|
||||||
action->locallyAddedButNotYetReceived = false;
|
|
||||||
updated << actionID;
|
updated << actionID;
|
||||||
} else {
|
} else {
|
||||||
auto actionFactory = DependencyManager::get<EntityActionFactoryInterface>();
|
auto actionFactory = DependencyManager::get<EntityActionFactoryInterface>();
|
||||||
|
@ -1829,7 +1828,6 @@ void EntityItem::deserializeActionsInternal() {
|
||||||
EntityActionPointer action = actionFactory->factoryBA(entity, serializedAction);
|
EntityActionPointer action = actionFactory->factoryBA(entity, serializedAction);
|
||||||
if (action) {
|
if (action) {
|
||||||
entity->addActionInternal(simulation, action);
|
entity->addActionInternal(simulation, action);
|
||||||
action->locallyAddedButNotYetReceived = false;
|
|
||||||
updated << actionID;
|
updated << actionID;
|
||||||
} else {
|
} else {
|
||||||
static QString repeatedMessage =
|
static QString repeatedMessage =
|
||||||
|
@ -1849,14 +1847,10 @@ void EntityItem::deserializeActionsInternal() {
|
||||||
EntityActionPointer action = i.value();
|
EntityActionPointer action = i.value();
|
||||||
|
|
||||||
if (action->isMine()) {
|
if (action->isMine()) {
|
||||||
// we just received an update that didn't include one of our actions. tell the server about it.
|
// we just received an update that didn't include one of our actions. tell the server about it (again).
|
||||||
setActionDataNeedsTransmit(true);
|
setActionDataNeedsTransmit(true);
|
||||||
}
|
} else {
|
||||||
|
// don't let someone else delete my action.
|
||||||
// don't let someone else delete my action.
|
|
||||||
if (!action->isMine() &&
|
|
||||||
// if we've just added this action, don't remove it due to lack of mention in an incoming packet.
|
|
||||||
!action->locallyAddedButNotYetReceived) {
|
|
||||||
_actionsToRemove << id;
|
_actionsToRemove << id;
|
||||||
_previouslyDeletedActions.insert(id, now);
|
_previouslyDeletedActions.insert(id, now);
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,13 +139,11 @@ void ObjectActionSpring::updateActionWorker(btScalar deltaTimeStep) {
|
||||||
float speed = glm::min(offsetLength / _linearTimeScale, SPRING_MAX_SPEED);
|
float speed = glm::min(offsetLength / _linearTimeScale, SPRING_MAX_SPEED);
|
||||||
targetVelocity = (-speed / offsetLength) * offset;
|
targetVelocity = (-speed / offsetLength) * offset;
|
||||||
if (speed > rigidBody->getLinearSleepingThreshold()) {
|
if (speed > rigidBody->getLinearSleepingThreshold()) {
|
||||||
qDebug() << "HERE";
|
|
||||||
forceBodyNonStatic();
|
forceBodyNonStatic();
|
||||||
rigidBody->activate();
|
rigidBody->activate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this action is aggresively critically damped and defeats the current velocity
|
// this action is aggresively critically damped and defeats the current velocity
|
||||||
qDebug() << targetVelocity.x() << targetVelocity.y() << targetVelocity.z();
|
|
||||||
rigidBody->setLinearVelocity(targetVelocity);
|
rigidBody->setLinearVelocity(targetVelocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue