mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-08 07:02:25 +02:00
Pull out ownership bidding changes
This commit is contained in:
parent
be39874999
commit
b86b07c08f
4 changed files with 7 additions and 15 deletions
|
@ -1824,15 +1824,10 @@ bool EntityItemProperties::hasTerseUpdateChanges() const {
|
|||
return _positionChanged || _velocityChanged || _rotationChanged || _angularVelocityChanged || _accelerationChanged;
|
||||
}
|
||||
|
||||
bool EntityItemProperties::hasDynamicPhysicsChanges() const {
|
||||
return _velocityChanged || _angularVelocityChanged || _accelerationChanged;
|
||||
}
|
||||
|
||||
bool EntityItemProperties::hasMiscPhysicsChanges() const {
|
||||
return _gravityChanged || _dimensionsChanged || _densityChanged || _frictionChanged
|
||||
|| _restitutionChanged || _dampingChanged || _angularDampingChanged || _registrationPointChanged ||
|
||||
_compoundShapeURLChanged || _dynamicChanged || _collisionlessChanged || _collisionMaskChanged ||
|
||||
_rotationChanged || _positionChanged;
|
||||
_compoundShapeURLChanged || _dynamicChanged || _collisionlessChanged || _collisionMaskChanged;
|
||||
}
|
||||
|
||||
void EntityItemProperties::clearSimulationOwner() {
|
||||
|
|
|
@ -274,7 +274,6 @@ public:
|
|||
void setCreated(QDateTime& v);
|
||||
|
||||
bool hasTerseUpdateChanges() const;
|
||||
bool hasDynamicPhysicsChanges() const;
|
||||
bool hasMiscPhysicsChanges() const;
|
||||
|
||||
void clearSimulationOwner();
|
||||
|
|
|
@ -414,17 +414,15 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
|
|||
entityFound = true;
|
||||
// make sure the properties has a type, so that the encode can know which properties to include
|
||||
properties.setType(entity->getType());
|
||||
bool hasMiscPhysicsChanges = properties.hasMiscPhysicsChanges();
|
||||
bool hasDynamicsChanges = properties.hasDynamicPhysicsChanges();
|
||||
// _bidOnSimulationOwnership is set per-instance of the scripting interface.
|
||||
// It essentially corresponds to "Am I an AC or an Interface client?" - ACs will never bid.
|
||||
if ((_bidOnSimulationOwnership && ((hasMiscPhysicsChanges && entity->isMoving()) || hasDynamicsChanges))) {
|
||||
bool hasTerseUpdateChanges = properties.hasTerseUpdateChanges();
|
||||
bool hasPhysicsChanges = properties.hasMiscPhysicsChanges() || hasTerseUpdateChanges;
|
||||
if (_bidOnSimulationOwnership && hasPhysicsChanges) {
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
const QUuid myNodeID = nodeList->getSessionUUID();
|
||||
|
||||
if (entity->getSimulatorID() == myNodeID) {
|
||||
// we think we already own the simulation, so make sure to send ALL TerseUpdate properties
|
||||
if (properties.hasTerseUpdateChanges()) {
|
||||
if (hasTerseUpdateChanges) {
|
||||
entity->getAllTerseUpdateProperties(properties);
|
||||
}
|
||||
// TODO: if we knew that ONLY TerseUpdate properties have changed in properties AND the object
|
||||
|
|
|
@ -114,8 +114,8 @@ public:
|
|||
EntityServerScriptLog,
|
||||
AdjustAvatarSorting,
|
||||
OctreeFileReplacement,
|
||||
SimulationBiddingChanges,
|
||||
LAST_PACKET_TYPE = SimulationBiddingChanges
|
||||
CollisionEventChanges,
|
||||
LAST_PACKET_TYPE = CollisionEventChanges
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue