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 {
|
const atree_render = new (class extends ComputeNode {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('builder-atree-render');
|
super('builder-atree-render');
|
||||||
this.fail_cb = true;
|
|
||||||
this.UI_elem = document.getElementById("atree-ui");
|
this.UI_elem = document.getElementById("atree-ui");
|
||||||
this.list_elem = document.getElementById("atree-header");
|
this.list_elem = document.getElementById("atree-header");
|
||||||
}
|
}
|
||||||
|
|
|
@ -429,6 +429,7 @@ class PlayerClassNode extends ValueCheckComputeNode {
|
||||||
compute_func(input_map) {
|
compute_func(input_map) {
|
||||||
if (input_map.size !== 1) { throw "PlayerClassNode accepts exactly one input (build)"; }
|
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
|
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'));
|
return wep_to_class.get(build.weapon.statMap.get('type'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ class ComputeNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ValueCheckComputeNode extends 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,
|
* 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);
|
calc_inputs.set(this.input_translation.get(input.name), input.value);
|
||||||
}
|
}
|
||||||
let val = this.compute_func(calc_inputs);
|
let val = this.compute_func(calc_inputs);
|
||||||
if (val !== this.value) {
|
if (val !== null) {
|
||||||
super.mark_dirty(2);
|
if (val !== this.valid_val) { super.mark_dirty(2); } // don't mark dirty if NULL (no update)
|
||||||
}
|
this.valid_val = val;
|
||||||
else {
|
|
||||||
console.log("soft update");
|
|
||||||
}
|
}
|
||||||
this.value = val;
|
this.value = val;
|
||||||
|
|
||||||
this.dirty = 0;
|
this.dirty = 0;
|
||||||
for (const child of this.children) {
|
for (const child of this.children) {
|
||||||
child.mark_input_clean(this.name, this.value);
|
child.mark_input_clean(this.name, this.value);
|
||||||
|
|
Loading…
Reference in a new issue