Adjust Entities.addEntity to not bid on simulation from AC Script

This commit is contained in:
Ryan Huffman 2016-02-02 13:00:35 -08:00
parent eff02d3e3a
commit 25632b63b7

View file

@ -131,17 +131,20 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties
_entityTree->withWriteLock([&] {
EntityItemPointer entity = _entityTree->addEntity(id, propertiesWithSimID);
if (entity) {
// This Node is creating a new object. If it's in motion, set this Node as the simulator.
auto nodeList = DependencyManager::get<NodeList>();
const QUuid myNodeID = nodeList->getSessionUUID();
propertiesWithSimID.setSimulationOwner(myNodeID, SCRIPT_EDIT_SIMULATION_PRIORITY);
if (propertiesWithSimID.parentRelatedPropertyChanged()) {
// due to parenting, the server may not know where something is in world-space, so include the bounding cube.
propertiesWithSimID.setQueryAACube(entity->getQueryAACube());
}
// and make note of it now, so we can act on it right away.
entity->setSimulationOwner(myNodeID, SCRIPT_EDIT_SIMULATION_PRIORITY);
if (_bidOnSimulationOwnership) {
// This Node is creating a new object. If it's in motion, set this Node as the simulator.
auto nodeList = DependencyManager::get<NodeList>();
const QUuid myNodeID = nodeList->getSessionUUID();
// and make note of it now, so we can act on it right away.
propertiesWithSimID.setSimulationOwner(myNodeID, SCRIPT_EDIT_SIMULATION_PRIORITY);
entity->setSimulationOwner(myNodeID, SCRIPT_EDIT_SIMULATION_PRIORITY);
}
entity->setLastBroadcast(usecTimestampNow());
} else {