Fix Agents bidding on simulation ownership

This commit is contained in:
Ryan Huffman 2016-01-10 10:11:47 -08:00
parent ee96341380
commit eff02d3e3a
5 changed files with 10 additions and 8 deletions

View file

@ -469,7 +469,7 @@ void Agent::aboutToFinish() {
} }
// our entity tree is going to go away so tell that to the EntityScriptingInterface // our entity tree is going to go away so tell that to the EntityScriptingInterface
DependencyManager::get<EntityScriptingInterface>()->setEntityTree(NULL); DependencyManager::get<EntityScriptingInterface>()->setEntityTree(nullptr);
// cleanup the AssetClient thread // cleanup the AssetClient thread
QThread* assetThread = DependencyManager::get<AssetClient>()->thread(); QThread* assetThread = DependencyManager::get<AssetClient>()->thread();

View file

@ -60,7 +60,7 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri
auto nodeList = DependencyManager::set<NodeList>(NodeType::Unassigned, listenPort); auto nodeList = DependencyManager::set<NodeList>(NodeType::Unassigned, listenPort);
auto animationCache = DependencyManager::set<AnimationCache>(); auto animationCache = DependencyManager::set<AnimationCache>();
auto entityScriptingInterface = DependencyManager::set<EntityScriptingInterface>(); auto entityScriptingInterface = DependencyManager::set<EntityScriptingInterface>(false);
DependencyManager::registerInheritance<EntityActionFactoryInterface, AssignmentActionFactory>(); DependencyManager::registerInheritance<EntityActionFactoryInterface, AssignmentActionFactory>();
auto actionFactory = DependencyManager::set<AssignmentActionFactory>(); auto actionFactory = DependencyManager::set<AssignmentActionFactory>();

View file

@ -348,7 +348,7 @@ bool setupEssentials(int& argc, char** argv) {
DependencyManager::set<BandwidthRecorder>(); DependencyManager::set<BandwidthRecorder>();
DependencyManager::set<ResourceCacheSharedItems>(); DependencyManager::set<ResourceCacheSharedItems>();
DependencyManager::set<DesktopScriptingInterface>(); DependencyManager::set<DesktopScriptingInterface>();
DependencyManager::set<EntityScriptingInterface>(); DependencyManager::set<EntityScriptingInterface>(true);
DependencyManager::set<RecordingScriptingInterface>(); DependencyManager::set<RecordingScriptingInterface>();
DependencyManager::set<WindowScriptingInterface>(); DependencyManager::set<WindowScriptingInterface>();
DependencyManager::set<HMDScriptingInterface>(); DependencyManager::set<HMDScriptingInterface>();

View file

@ -25,8 +25,9 @@
#include "ZoneEntityItem.h" #include "ZoneEntityItem.h"
EntityScriptingInterface::EntityScriptingInterface() : EntityScriptingInterface::EntityScriptingInterface(bool bidOnSimulationOwnership) :
_entityTree(NULL) _entityTree(NULL),
_bidOnSimulationOwnership(bidOnSimulationOwnership)
{ {
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
connect(nodeList.data(), &NodeList::canAdjustLocksChanged, this, &EntityScriptingInterface::canAdjustLocksChanged); connect(nodeList.data(), &NodeList::canAdjustLocksChanged, this, &EntityScriptingInterface::canAdjustLocksChanged);
@ -255,7 +256,7 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
properties.setType(entity->getType()); properties.setType(entity->getType());
bool hasTerseUpdateChanges = properties.hasTerseUpdateChanges(); bool hasTerseUpdateChanges = properties.hasTerseUpdateChanges();
bool hasPhysicsChanges = properties.hasMiscPhysicsChanges() || hasTerseUpdateChanges; bool hasPhysicsChanges = properties.hasMiscPhysicsChanges() || hasTerseUpdateChanges;
if (hasPhysicsChanges) { if (_bidOnSimulationOwnership && hasPhysicsChanges) {
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
const QUuid myNodeID = nodeList->getSessionUUID(); const QUuid myNodeID = nodeList->getSessionUUID();

View file

@ -58,7 +58,7 @@ void RayToEntityIntersectionResultFromScriptValue(const QScriptValue& object, Ra
class EntityScriptingInterface : public OctreeScriptingInterface, public Dependency { class EntityScriptingInterface : public OctreeScriptingInterface, public Dependency {
Q_OBJECT Q_OBJECT
public: public:
EntityScriptingInterface(); EntityScriptingInterface(bool bidOnSimulationOwnership);
EntityEditPacketSender* getEntityPacketSender() const { return (EntityEditPacketSender*)getPacketSender(); } EntityEditPacketSender* getEntityPacketSender() const { return (EntityEditPacketSender*)getPacketSender(); }
virtual NodeType_t getServerNodeType() const { return NodeType::EntityServer; } virtual NodeType_t getServerNodeType() const { return NodeType::EntityServer; }
@ -204,7 +204,8 @@ private:
bool precisionPicking, const QVector<EntityItemID>& entityIdsToInclude, const QVector<EntityItemID>& entityIdsToDiscard); bool precisionPicking, const QVector<EntityItemID>& entityIdsToInclude, const QVector<EntityItemID>& entityIdsToDiscard);
EntityTreePointer _entityTree; EntityTreePointer _entityTree;
EntitiesScriptEngineProvider* _entitiesScriptEngine = nullptr; EntitiesScriptEngineProvider* _entitiesScriptEngine { nullptr };
bool _bidOnSimulationOwnership { false };
}; };
#endif // hifi_EntityScriptingInterface_h #endif // hifi_EntityScriptingInterface_h