armory/Sources/armory/logicnode/SendEventNode.hx
SunDaw a2e4850b12 Remove array allocation from SendEventNode
Remove entires member variable from SendEvent nodes
2021-02-13 16:56:21 +01:00

25 lines
509 B
Haxe

package armory.logicnode;
import iron.object.Object;
import armory.system.Event;
class SendEventNode extends LogicNode {
public function new(tree: LogicTree) {
super(tree);
}
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);
if (entries == null) return;
for (e in entries) if (e.mask == object.uid) e.onEvent();
runOutput(0);
}
}