Commit 7af93228 authored by Christoffer Ackelman's avatar Christoffer Ackelman

Web: Added DynDigScript

parent bb7eeb89
......@@ -6083,6 +6083,89 @@ class DynDigCommand extends DynElem {
}
}
class DynDigScript extends DynElem {
script = "";
a = null;
first_scan = true;
level = 0;
constructor(dyn) {
super(dyn, DynPrio.DigScript);
this.dyn_type2 = DynType2.DigScript;
}
connect(object) {
this.a = new DynReference(this.dyn, this.attribute);
this.a.connect(this.dyn);
if (!this.a.sts) {
console.log("DigScript: " + this.attribute);
return 1;
}
return 1;
}
disconnect() {
if (this.a) {
this.a.disconnect();
}
}
scan(object) {
if (this.a === null || !this.a.sts) {
return;
}
let value = this.dyn.getDig(this.a.p, this.a.typeid, this.a.bitmask, this.a.database);
value = (this.a.inverted) ? !value : value;
if (this.first_scan) {
this.a.oldValue = value;
this.first_scan = false;
return;
}
if ((!this.level && value && !this.a.oldValue) || (this.level && value)) {
this.dyn.graph.script(this.script);
}
this.a.oldValue = value;
}
open(lines, row) {
let i;
for (i = row; i < lines.length; i++) {
let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10);
switch (key) {
case DynSave.DigScript:
break;
case DynSave.DigScript_attribute:
if (tokens.length > 1) {
this.attribute = tokens[1];
}
break;
case DynSave.DigScript_level:
this.level = parseInt(tokens[1], 10);
break;
case DynSave.DigScript_script_len:
break;
case DynSave.DigScript_script:
this.script = lines.join("\n").split(/[^\\]"/)[0];
break;
case DynSave.End:
return i;
default:
console.log("Syntax error in DynDigScript");
break;
}
}
return i;
}
}
class DynSetDig extends DynElem {
constructor(dyn) {
super(dyn, DynPrio.SetDig);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment