Remove array allocation from SendEventNode

Remove entires member variable from SendEvent nodes
This commit is contained in:
SunDaw 2021-02-13 16:56:21 +01:00
parent f0d7effb7c
commit a2e4850b12
2 changed files with 3 additions and 11 deletions

View file

@ -5,8 +5,6 @@ import armory.system.Event;
class SendEventNode extends LogicNode {
var entries: Array<TEvent> = null;
public function new(tree: LogicTree) {
super(tree);
}
@ -17,13 +15,9 @@ class SendEventNode extends LogicNode {
if (object == null) return;
var all = Event.get(name);
if (all != null) {
entries = [];
for (e in all) if (e.mask == object.uid) entries.push(e);
}
var entries = Event.get(name);
if (entries == null) return;
for (e in entries) e.onEvent();
for (e in entries) if (e.mask == object.uid) e.onEvent();
runOutput(0);
}

View file

@ -4,8 +4,6 @@ import armory.system.Event;
class SendGlobalEventNode extends LogicNode {
var entries: Array<TEvent> = null;
public function new(tree: LogicTree) {
super(tree);
}
@ -13,7 +11,7 @@ class SendGlobalEventNode extends LogicNode {
override function run(from: Int) {
var name: String = inputs[1].get();
entries = Event.get(name);
var entries = Event.get(name);
if (entries == null) return; // Event does not exist
for (e in entries) e.onEvent();