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