2017-04-16 14:46:35 +02:00
|
|
|
package armory.logicnode;
|
|
|
|
|
2017-11-20 15:16:52 +01:00
|
|
|
import iron.object.Object;
|
2017-04-16 14:46:35 +02:00
|
|
|
import armory.system.Event;
|
|
|
|
|
|
|
|
class SendEventNode extends LogicNode {
|
|
|
|
|
2019-12-19 23:54:08 +01:00
|
|
|
public function new(tree: LogicTree) {
|
2017-04-16 14:46:35 +02:00
|
|
|
super(tree);
|
|
|
|
}
|
|
|
|
|
2019-12-19 23:54:08 +01:00
|
|
|
override function run(from: Int) {
|
|
|
|
var name: String = inputs[1].get();
|
|
|
|
var object: Object = inputs.length > 2 ? inputs[2].get() : tree.object;
|
|
|
|
|
|
|
|
if (object == null) return;
|
2018-07-13 08:46:25 +02:00
|
|
|
|
2021-02-13 16:56:21 +01:00
|
|
|
var entries = Event.get(name);
|
2018-06-28 20:12:11 +02:00
|
|
|
if (entries == null) return;
|
2021-02-13 16:56:21 +01:00
|
|
|
for (e in entries) if (e.mask == object.uid) e.onEvent();
|
2017-04-16 14:46:35 +02:00
|
|
|
|
2018-10-22 10:10:33 +02:00
|
|
|
runOutput(0);
|
2017-04-16 14:46:35 +02:00
|
|
|
}
|
|
|
|
}
|