Don't update the ability tree when NONE weapon is selected
so u can delete weapon and switch to the same class weapon and keep tree
This commit is contained in:
parent
dcdf281612
commit
74b1d480fa
3 changed files with 5 additions and 8 deletions
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue