mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
cleanup access to sessionID
This commit is contained in:
parent
f63610af2b
commit
21654ba77c
1 changed files with 7 additions and 12 deletions
|
@ -242,13 +242,12 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties
|
||||||
_activityTracking.addedEntityCount++;
|
_activityTracking.addedEntityCount++;
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
auto sessionID = nodeList->getSessionUUID();
|
const auto sessionID = nodeList->getSessionUUID();
|
||||||
|
|
||||||
EntityItemProperties propertiesWithSimID = properties;
|
EntityItemProperties propertiesWithSimID = properties;
|
||||||
if (clientOnly) {
|
if (clientOnly) {
|
||||||
const QUuid myNodeID = sessionID;
|
|
||||||
propertiesWithSimID.setClientOnly(clientOnly);
|
propertiesWithSimID.setClientOnly(clientOnly);
|
||||||
propertiesWithSimID.setOwningAvatarID(myNodeID);
|
propertiesWithSimID.setOwningAvatarID(sessionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
propertiesWithSimID.setLastEditedBy(sessionID);
|
propertiesWithSimID.setLastEditedBy(sessionID);
|
||||||
|
@ -530,8 +529,7 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
|
||||||
|
|
||||||
_activityTracking.editedEntityCount++;
|
_activityTracking.editedEntityCount++;
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
const auto sessionID = DependencyManager::get<NodeList>()->getSessionUUID();
|
||||||
auto sessionID = nodeList->getSessionUUID();
|
|
||||||
|
|
||||||
EntityItemProperties properties = scriptSideProperties;
|
EntityItemProperties properties = scriptSideProperties;
|
||||||
properties.setLastEditedBy(sessionID);
|
properties.setLastEditedBy(sessionID);
|
||||||
|
@ -550,7 +548,7 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity->getClientOnly() && entity->getOwningAvatarID() != nodeList->getSessionUUID()) {
|
if (entity->getClientOnly() && entity->getOwningAvatarID() != sessionID) {
|
||||||
// don't edit other avatar's avatarEntities
|
// don't edit other avatar's avatarEntities
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -600,10 +598,7 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
|
||||||
bool hasTransformOrVelocityChanges = properties.hasTransformOrVelocityChanges();
|
bool hasTransformOrVelocityChanges = properties.hasTransformOrVelocityChanges();
|
||||||
bool hasPhysicsChanges = properties.hasMiscPhysicsChanges() || hasTransformOrVelocityChanges;
|
bool hasPhysicsChanges = properties.hasMiscPhysicsChanges() || hasTransformOrVelocityChanges;
|
||||||
if (_bidOnSimulationOwnership && hasPhysicsChanges) {
|
if (_bidOnSimulationOwnership && hasPhysicsChanges) {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
if (entity->getSimulatorID() == sessionID) {
|
||||||
const QUuid myNodeID = nodeList->getSessionUUID();
|
|
||||||
|
|
||||||
if (entity->getSimulatorID() == myNodeID) {
|
|
||||||
// we think we already own the simulation, so make sure to send the full transform and all velocities
|
// we think we already own the simulation, so make sure to send the full transform and all velocities
|
||||||
if (hasTransformOrVelocityChanges) {
|
if (hasTransformOrVelocityChanges) {
|
||||||
entity->getTransformAndVelocityProperties(properties);
|
entity->getTransformAndVelocityProperties(properties);
|
||||||
|
@ -618,11 +613,11 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
|
||||||
|
|
||||||
if (entity->getSimulationPriority() < SCRIPT_POKE_SIMULATION_PRIORITY) {
|
if (entity->getSimulationPriority() < SCRIPT_POKE_SIMULATION_PRIORITY) {
|
||||||
// we re-assert our simulation ownership at a higher priority
|
// we re-assert our simulation ownership at a higher priority
|
||||||
properties.setSimulationOwner(myNodeID, SCRIPT_POKE_SIMULATION_PRIORITY);
|
properties.setSimulationOwner(sessionID, SCRIPT_POKE_SIMULATION_PRIORITY);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// we make a bid for simulation ownership
|
// we make a bid for simulation ownership
|
||||||
properties.setSimulationOwner(myNodeID, SCRIPT_POKE_SIMULATION_PRIORITY);
|
properties.setSimulationOwner(sessionID, SCRIPT_POKE_SIMULATION_PRIORITY);
|
||||||
entity->setScriptSimulationPriority(SCRIPT_POKE_SIMULATION_PRIORITY);
|
entity->setScriptSimulationPriority(SCRIPT_POKE_SIMULATION_PRIORITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue