History

improve terse entity logging. change how action data sending is triggered

Seth Alves committed 11 years ago

Commit 5e4f30b1 parent d0430114 files · +91 −10Browse files

Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 4 files). Show all

Unified · Split

libraries/entities/src/EntityScriptingInterface.cpp+10−5
@@ -611,7 +611,8 @@ QUuid EntityScriptingInterface::addAction(const QString& actionTypeString, · 610 unmodified lines
611611 const QVariantMap& arguments) {
612612 QUuid actionID = QUuid::createUuid();
613613 auto actionFactory = DependencyManager::get<EntityActionFactoryInterface>();
614− bool success = actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) {
614+ bool success = true;
615+ actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) {
615616 // create this action even if the entity doesn't have physics info. it will often be the
616617 // case that a script adds an action immediately after an object is created, and the physicsInfo
617618 // is computed asynchronously.
@@ -620,17 +621,18 @@ QUuid EntityScriptingInterface::addAction(const QString& actionTypeString, · 2 unmodified lines
620621 // }
621622 EntityActionType actionType = EntityActionInterface::actionTypeFromString(actionTypeString);
622623 if (actionType == ACTION_TYPE_NONE) {
624+ success = false;
623625 return false;
624626 }
625627 EntityActionPointer action = actionFactory->factory(actionType, actionID, entity, arguments);
626628 if (action) {
627− entity->addAction(simulation, action);
629+ success = entity->addAction(simulation, action);
628630 auto nodeList = DependencyManager::get<NodeList>();
629631 const QUuid myNodeID = nodeList->getSessionUUID();
630632 if (entity->getSimulatorID() != myNodeID) {
631633 entity->flagForOwnership();
632634 }
633− return true;
635+ return false; // Physics will cause a packet to be sent, so don't send from here.
634636 }
635637 return false;
636638 });
@@ -656,9 +658,12 @@ bool EntityScriptingInterface::updateAction(const QUuid& entityID, const QUuid& · 19 unmodified lines
656658 }
657659
658660 bool EntityScriptingInterface::deleteAction(const QUuid& entityID, const QUuid& actionID) {
659− return actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) {
660− return entity->removeAction(simulation, actionID);
661+ bool success = false;
662+ actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) {
663+ success = entity->removeAction(simulation, actionID);
664+ return false; // Physics will cause a packet to be sent, so don't send from here.
661665 });
666+ return success;
662667 }
663668
664669 QVector<QUuid> EntityScriptingInterface::getActionIDs(const QUuid& entityID) {