Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -93,7 +93,6 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(EntityItemID · 92 unmodified lines | |||
| 93 | 93 | ||
| 94 | EntityItemID EntityScriptingInterface::editEntity(EntityItemID entityID, const EntityItemProperties& properties) { | 94 | EntityItemID EntityScriptingInterface::editEntity(EntityItemID entityID, const EntityItemProperties& properties) { |
| 95 | EntityItemID actualID = entityID; | 95 | EntityItemID actualID = entityID; |
| 96 | |||
| 97 | // if the entity is unknown, attempt to look it up | 96 | // if the entity is unknown, attempt to look it up |
| 98 | if (!entityID.isKnownID) { | 97 | if (!entityID.isKnownID) { |
| 99 | actualID = EntityItemID::getIDfromCreatorTokenID(entityID.creatorTokenID); | 98 | actualID = EntityItemID::getIDfromCreatorTokenID(entityID.creatorTokenID); |
| @@ -113,6 +112,18 @@ EntityItemID EntityScriptingInterface::editEntity(EntityItemID entityID, const E · 13 unmodified lines | |||
| 113 | 112 | ||
| 114 | // if at this point, we know the id, send the update to the entity server | 113 | // if at this point, we know the id, send the update to the entity server |
| 115 | if (entityID.isKnownID) { | 114 | if (entityID.isKnownID) { |
| 115 | // make sure the properties has a type, so that the encode can know which properties to include | ||
| 116 | if (properties.getType() == EntityTypes::Unknown) { | ||
| 117 | EntityItem* entity = _entityTree->findEntityByEntityItemID(entityID); | ||
| 118 | if (entity) { | ||
| 119 | EntityItemProperties tempProperties = properties; | ||
| 120 | tempProperties.setType(entity->getType()); | ||
| 121 | queueEntityMessage(PacketTypeEntityAddOrEdit, entityID, tempProperties); | ||
| 122 | return entityID; | ||
| 123 | } | ||
| 124 | } | ||
| 125 | |||
| 126 | // if the properties already includes the type, then use it as is | ||
| 116 | queueEntityMessage(PacketTypeEntityAddOrEdit, entityID, properties); | 127 | queueEntityMessage(PacketTypeEntityAddOrEdit, entityID, properties); |
| 117 | } | 128 | } |
| 118 | 129 | ||