mirror of
https://github.com/fluxscape/fluxscape.git
synced 2026-01-11 23:02:55 +01:00
Co-Authored-By: Eric Tuvesson <eric.tuvesson@gmail.com> Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com> Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com> Co-Authored-By: Anders Larsson <64838990+anders-topp@users.noreply.github.com> Co-Authored-By: Johan <4934465+joolsus@users.noreply.github.com> Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com> Co-Authored-By: victoratndl <99176179+victoratndl@users.noreply.github.com>
47 lines
887 B
JavaScript
47 lines
887 B
JavaScript
'use strict';
|
|
|
|
const OrNode = {
|
|
name: 'Or',
|
|
docs: 'https://docs.noodl.net/nodes/logic/or',
|
|
category: 'Logic',
|
|
initialize: function () {
|
|
this._internal.inputs = [];
|
|
},
|
|
getInspectInfo() {
|
|
return this._internal.inputs.some(isTrue);
|
|
},
|
|
numberedInputs: {
|
|
input: {
|
|
type: 'boolean',
|
|
displayPrefix: 'Input',
|
|
createSetter(index) {
|
|
return function (value) {
|
|
if (this._internal.inputs[index] === value) {
|
|
return;
|
|
}
|
|
|
|
this._internal.inputs[index] = value;
|
|
this.flagOutputDirty('result');
|
|
};
|
|
}
|
|
}
|
|
},
|
|
outputs: {
|
|
result: {
|
|
type: 'boolean',
|
|
displayName: 'Result',
|
|
getter: function () {
|
|
return this._internal.inputs.some(isTrue);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
module.exports = {
|
|
node: OrNode
|
|
};
|
|
|
|
function isTrue(value) {
|
|
return value ? true : false;
|
|
}
|