mirror of
https://github.com/mehotkhan/BandersnatchInteractive.git
synced 2025-07-27 17:23:22 +00:00
assets/scripts.js: Implement more precondition expression types
This commit is contained in:
parent
f9b7bc840c
commit
3fbed6886b
1 changed files with 8 additions and 0 deletions
|
@ -25,6 +25,14 @@ function preconditionToJS(cond) {
|
|||
return '(' + cond.slice(1).map(preconditionToJS).join(' && ') + ')';
|
||||
} else if (cond[0] == 'or') {
|
||||
return '(' + cond.slice(1).map(preconditionToJS).join(' || ') + ')';
|
||||
} else if (cond[0] == 'eql' && cond.length == 3) {
|
||||
return '(' + cond.slice(1).map(preconditionToJS).join(' == ') + ')';
|
||||
} else if (cond === false) {
|
||||
return false;
|
||||
} else if (cond === true) {
|
||||
return true;
|
||||
} else if (typeof cond === 'string') {
|
||||
return cond;
|
||||
} else {
|
||||
console.log('unsupported condition!', cond);
|
||||
return 'true';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue