Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 9 files). Show all
Unified · Split
| @@ -474,7 +474,7 @@ void synchronizeEditedGrabProperties(EntityItemProperties& properties, const QSt · 473 unmodified lines | ||
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | |
| 477 | −QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties, const QString& entityHostTypeString) { | |
| 477 | +QUuid EntityScriptingInterface::addEntityInternal(const EntityItemProperties& properties, entity::HostType entityHostType) { | |
| 478 | 478 | PROFILE_RANGE(script_entities, __FUNCTION__); |
| 479 | 479 | |
| 480 | 480 | _activityTracking.addedEntityCount++; |
| @@ -483,10 +483,10 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties · 2 unmodified lines | ||
| 483 | 483 | const auto sessionID = nodeList->getSessionUUID(); |
| 484 | 484 | |
| 485 | 485 | EntityItemProperties propertiesWithSimID = properties; |
| 486 | − propertiesWithSimID.setEntityHostTypeFromString(entityHostTypeString); | |
| 487 | − if (propertiesWithSimID.getEntityHostType() == entity::HostType::AVATAR) { | |
| 486 | + propertiesWithSimID.setEntityHostType(entityHostType); | |
| 487 | + if (entityHostType == entity::HostType::AVATAR) { | |
| 488 | 488 | propertiesWithSimID.setOwningAvatarID(sessionID); |
| 489 | − } else if (propertiesWithSimID.getEntityHostType() == entity::HostType::LOCAL) { | |
| 489 | + } else if (entityHostType == entity::HostType::LOCAL) { | |
| 490 | 490 | // For now, local entities are always collisionless |
| 491 | 491 | // TODO: create a separate, local physics simulation that just handles local entities (and MyAvatar?) |
| 492 | 492 | propertiesWithSimID.setCollisionless(true); |
| @@ -579,9 +579,9 @@ QUuid EntityScriptingInterface::cloneEntity(const QUuid& entityIDToClone) { · 86 unmodified lines | ||
| 579 | 579 | |
| 580 | 580 | if (properties.getEntityHostType() == entity::HostType::LOCAL) { |
| 581 | 581 | // Local entities are only cloned locally |
| 582 | − return addEntity(properties, QString("local")); | |
| 582 | + return addEntityInternal(properties, entity::HostType::LOCAL); | |
| 583 | 583 | } else if (cloneAvatarEntity) { |
| 584 | − return addEntity(properties, QString("avatar")); | |
| 584 | + return addEntityInternal(properties, entity::HostType::AVATAR); | |
| 585 | 585 | } else { |
| 586 | 586 | // setLastEdited timestamp to 0 to ensure this entity gets updated with the properties |
| 587 | 587 | // from the server-created entity, don't change this unless you know what you are doing |