History

eventBridge for web entities.

Anthony J. Thibault committed 10 years ago

Commit 21bf9311 parent 823420a6 files · +73 −6Browse files

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

Unified · Split

libraries/entities/src/EntityScriptingInterface.cpp+12−0
@@ -1289,6 +1289,17 @@ bool EntityScriptingInterface::wantsHandControllerPointerEvents(QUuid id) { · 1288 unmodified lines
12891289 return result;
12901290 }
12911291
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+
12921303 float EntityScriptingInterface::calculateCost(float mass, float oldVelocity, float newVelocity) {
12931304 return std::abs(mass * (newVelocity - oldVelocity));
12941305 }
@@ -1305,3 +1316,4 @@ float EntityScriptingInterface::getCostMultiplier() { · 10 unmodified lines
13051316 void EntityScriptingInterface::setCostMultiplier(float value) {
13061317 costMultiplier = value;
13071318 }
1319+