handle deactivation of avatar entities differently

This commit is contained in:
Andrew Meadows 2018-06-25 10:36:36 -07:00
parent b7069fff71
commit 5e2a08b3c2
2 changed files with 26 additions and 3 deletions

View file

@ -312,11 +312,26 @@ void PhysicalEntitySimulation::handleDeactivatedMotionStates(const VectorOfMotio
assert(state);
if (state->getType() == MOTIONSTATE_TYPE_ENTITY) {
EntityMotionState* entityState = static_cast<EntityMotionState*>(state);
if (!serverlessMode) {
entityState->handleDeactivation();
}
EntityItemPointer entity = entityState->getEntity();
_entitiesToSort.insert(entity);
if (!serverlessMode) {
if (entity->getClientOnly()) {
switch (entityState->getOwnershipState()) {
case EntityMotionState::OwnershipState::PendingBid:
_bids.removeFirst(entityState);
entityState->clearOwnershipState();
break;
case EntityMotionState::OwnershipState::LocallyOwned:
_owned.removeFirst(entityState);
entityState->clearOwnershipState();
break;
default:
break;
}
} else {
entityState->handleDeactivation();
}
}
}
}
}

View file

@ -37,6 +37,14 @@ public:
}
pop_back();
}
void removeFirst(EntityMotionState* state) {
for (uint32_t i = 0; i < size(); ++i) {
if ((*this)[i] == state) {
remove(i);
break;
}
}
}
};
class PhysicalEntitySimulation : public EntitySimulation {