diff --git a/js/atree.js b/js/atree.js index 4a9d492..519349b 100644 --- a/js/atree.js +++ b/js/atree.js @@ -199,7 +199,6 @@ const atree_node = new (class extends ComputeNode { const atree_render = new (class extends ComputeNode { constructor() { super('builder-atree-render'); - this.fail_cb = true; this.UI_elem = document.getElementById("atree-ui"); this.list_elem = document.getElementById("atree-header"); } diff --git a/js/builder_graph.js b/js/builder_graph.js index b2ed8cb..0ae6fbd 100644 --- a/js/builder_graph.js +++ b/js/builder_graph.js @@ -429,6 +429,7 @@ class PlayerClassNode extends ValueCheckComputeNode { compute_func(input_map) { if (input_map.size !== 1) { throw "PlayerClassNode accepts exactly one input (build)"; } const [build] = input_map.values(); // Extract values, pattern match it into size one list and bind to first element + if (build.weapon.statMap.has('NONE')) { return null; } return wep_to_class.get(build.weapon.statMap.get('type')); } } diff --git a/js/computation_graph.js b/js/computation_graph.js index d144e29..bd46036 100644 --- a/js/computation_graph.js +++ b/js/computation_graph.js @@ -135,7 +135,7 @@ class ComputeNode { } class ValueCheckComputeNode extends ComputeNode { - constructor(name) { super(name); } + constructor(name) { super(name); this.valid_val = null; } /** * Request update of this compute node. Pushes updates to children, @@ -154,14 +154,11 @@ class ValueCheckComputeNode extends ComputeNode { calc_inputs.set(this.input_translation.get(input.name), input.value); } let val = this.compute_func(calc_inputs); - if (val !== this.value) { - super.mark_dirty(2); - } - else { - console.log("soft update"); + if (val !== null) { + if (val !== this.valid_val) { super.mark_dirty(2); } // don't mark dirty if NULL (no update) + this.valid_val = val; } this.value = val; - this.dirty = 0; for (const child of this.children) { child.mark_input_clean(this.name, this.value);