Merge pull request #2247 from QuantumCoderQC/LogicNodeFix

Add check to LogicNode run
This commit is contained in:
Lubos Lenco 2021-07-04 23:19:57 +02:00 committed by GitHub
commit 50c8ceec1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,12 +38,16 @@ class LogicNode {
**/
function runOutput(i: Int) {
if (i >= outputs.length) return;
for (o in outputs[i]) {
for (output in outputs[i]) {
// Check which input activated the node
for (j in 0...o.inputs.length) {
if (o.inputs[j].node == this) {
o.run(j);
break;
for (j in 0...output.inputs.length) {
// Check if the node is connected to the current node
if (output.inputs[j].node == this) {
// Check if the input socekt is linked to current output socket
if (output.inputs[j].from == i) {
output.run(j);
break;
}
}
}
}
@ -60,6 +64,7 @@ class LogicNodeInput {
@:allow(armory.logicnode.LogicNode)
var node: LogicNode;
@:allow(armory.logicnode.LogicNode)
var from: Int; // Socket index
public function new(node: LogicNode, from: Int) {