No limit to shoulder and pelvis implants using rules assistant
Expected Behavior
limit to {type}Implants should be in the range of -2:2 depending on surgeryUpgrade falg
Current Behavior
function pelvisShouldersImplants(label, target)
will expand {type}Implants infinitely
rulesAutosurgery.js
:
function pelvisShouldersImplants(label, target){
const request = thisSurgery[`${target}Implant`];
if (Math.abs(request) > 0) {
if (Math.abs(request) < 2 || V.surgeryUpgrade) {
const change = request > 0 ? 1 : -1;
commitProcedure(`surgery to ${request > 0 ? "broaden" : "narrow"} ${his} ${label}`,
s => { s[target] += change; s[`${target}Implant`] += change; },
40);
}
}
}
the issue is that thisSurgery[${target}Implant]
is always 1 or 2 if broadening rule is set, slave[${target}Implant]
is never taken into account when deciding whether to broaden/shrink or not
it might be rulesAssistantOptions.js
:class HipsAndShoulderSurgeryList extends ListSelector
thats at fault but i don't really know
here is what i did to fix it for myself
function pelvisShouldersImplants(label, target){
const request = thisSurgery[`${target}Implant`];
if (Math.abs(request) > 0) {
if (Math.abs(request) < 2 || V.surgeryUpgrade) {
const change = compareValues(request, slave[`${target}Implant`]);
if (change !== 0)
{
commitProcedure(`surgery to ${request > 0 ? "broaden" : "narrow"} ${his} ${label}`,
s => { s[target] += change; s[`${target}Implant`] += change; },
40);
}
}
}
}
function compareValues(target, current) {
if (target === current) {
return 0;
} else if (target > current && target > 0) {
return 1;
} else if (target < current && target < 0) {
return -1;
}
}
Additional information
mod version: 4.0.0-alpha.28, build: 1219, commit: dcad3920