Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -611,7 +611,7 @@ QUuid EntityScriptingInterface::addAction(const QString& actionTypeString, · 610 unmodified lines | ||
| 611 | 611 | const QVariantMap& arguments) { |
| 612 | 612 | QUuid actionID = QUuid::createUuid(); |
| 613 | 613 | auto actionFactory = DependencyManager::get<EntityActionFactoryInterface>(); |
| 614 | − bool success = true; | |
| 614 | + bool success = false; | |
| 615 | 615 | actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) { |
| 616 | 616 | // create this action even if the entity doesn't have physics info. it will often be the |
| 617 | 617 | // case that a script adds an action immediately after an object is created, and the physicsInfo |
| @@ -621,20 +621,19 @@ QUuid EntityScriptingInterface::addAction(const QString& actionTypeString, · 3 unmodified lines | ||
| 621 | 621 | // } |
| 622 | 622 | EntityActionType actionType = EntityActionInterface::actionTypeFromString(actionTypeString); |
| 623 | 623 | if (actionType == ACTION_TYPE_NONE) { |
| 624 | − success = false; | |
| 625 | 624 | return false; |
| 626 | 625 | } |
| 627 | 626 | EntityActionPointer action = actionFactory->factory(actionType, actionID, entity, arguments); |
| 628 | − if (action) { | |
| 629 | − success = entity->addAction(simulation, action); | |
| 630 | − auto nodeList = DependencyManager::get<NodeList>(); | |
| 631 | − const QUuid myNodeID = nodeList->getSessionUUID(); | |
| 632 | − if (entity->getSimulatorID() != myNodeID) { | |
| 633 | − entity->flagForOwnership(); | |
| 634 | − } | |
| 635 | − return false; // Physics will cause a packet to be sent, so don't send from here. | |
| 627 | + if (!action) { | |
| 628 | + return false; | |
| 636 | 629 | } |
| 637 | − return false; | |
| 630 | + success = entity->addAction(simulation, action); | |
| 631 | + auto nodeList = DependencyManager::get<NodeList>(); | |
| 632 | + const QUuid myNodeID = nodeList->getSessionUUID(); | |
| 633 | + if (entity->getSimulatorID() != myNodeID) { | |
| 634 | + entity->flagForOwnership(); | |
| 635 | + } | |
| 636 | + return false; // Physics will cause a packet to be sent, so don't send from here. | |
| 638 | 637 | }); |
| 639 | 638 | if (success) { |
| 640 | 639 | return actionID; |