armory/Sources/armory/logicnode/SendEventNode.hx

25 lines
509 B
Haxe
Raw Permalink Normal View History

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;
var entries = Event.get(name);
2018-06-28 20:12:11 +02:00
if (entries == null) return;
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
}
}