Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 6 files). Show all
Unified · Split
| @@ -1289,6 +1289,17 @@ bool EntityScriptingInterface::wantsHandControllerPointerEvents(QUuid id) { · 1288 unmodified lines | ||
| 1289 | 1289 | return result; |
| 1290 | 1290 | } |
| 1291 | 1291 | |
| 1292 | +void EntityScriptingInterface::emitScriptEvent(const EntityItemID& entityID, const QVariant& message) { | |
| 1293 | + if (_entityTree) { | |
| 1294 | + _entityTree->withReadLock([&] { | |
| 1295 | + EntityItemPointer entity = _entityTree->findEntityByEntityItemID(EntityItemID(entityID)); | |
| 1296 | + if (entity) { | |
| 1297 | + entity->emitScriptEvent(message); | |
| 1298 | + } | |
| 1299 | + }); | |
| 1300 | + } | |
| 1301 | +} | |
| 1302 | + | |
| 1292 | 1303 | float EntityScriptingInterface::calculateCost(float mass, float oldVelocity, float newVelocity) { |
| 1293 | 1304 | return std::abs(mass * (newVelocity - oldVelocity)); |
| 1294 | 1305 | } |
| @@ -1305,3 +1316,4 @@ float EntityScriptingInterface::getCostMultiplier() { · 10 unmodified lines | ||
| 1305 | 1316 | void EntityScriptingInterface::setCostMultiplier(float value) { |
| 1306 | 1317 | costMultiplier = value; |
| 1307 | 1318 | } |
| 1319 | + | |