From ceb940c27bfe7018ec4672610f910dcaf2a90f03 Mon Sep 17 00:00:00 2001 From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io> Date: Fri, 3 Jun 2022 03:47:56 +0000 Subject: [PATCH] fixesBatch --- src/Mods/SecExp/js/Unit.js | 18 ++++++++---------- src/events/RE/reCitizenHookup.js | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Mods/SecExp/js/Unit.js b/src/Mods/SecExp/js/Unit.js index 76b01e3197c..18a53b2d1bb 100644 --- a/src/Mods/SecExp/js/Unit.js +++ b/src/Mods/SecExp/js/Unit.js @@ -171,13 +171,7 @@ App.Mods.SecExp.unit = (function() { linkArray = []; App.UI.DOM.appendNewElement("div", unitDetail, describe(unit, false)); linkArray.push(App.UI.DOM.makeTextBox(unit.platoonName, str => { unit.platoonName = str; App.UI.reload(); })); - linkArray.push(App.UI.DOM.link(`Disband the unit`, () => { - unitFree(type).add(unit.troops); - V.SecExp.units[type].squads.deleteAt(unit); - V.SecExp.battles.lastSelection.deleteAt(unit); - App.UI.reload(); - } - )); + linkArray.push(App.UI.DOM.link(`Disband the unit`, () => { removeUnit(); App.UI.reload(); })); if (unit.active === 1) { if (unit.troops < unit.maxTroops && unitFree(unit).canUpgrade()) { @@ -223,9 +217,7 @@ App.Mods.SecExp.unit = (function() { linkArray.push(App.UI.DOM.link(`Send this unit to improve your relationship with General ${V.peacekeepers.generalName}. Costs ${cashFormat(cost)}.`, () => { V.peacekeepers.attitude += Math.ceil(unitAdjust / 5); cashX(cost, "securityExpansion"); - unitFree(type).add(unit.troops); - V.SecExp.units[type].squads.deleteAt(unit); - V.SecExp.battles.lastSelection.deleteAt(unit); + removeUnit(); App.UI.reload(); } )); @@ -376,6 +368,12 @@ App.Mods.SecExp.unit = (function() { } } App.UI.DOM.appendNewElement("p", list, unitDetail); + + function removeUnit() { + unitFree(type).add(unit.troops); + V.SecExp.units[type].squads.delete(unit); + V.SecExp.battles.lastSelection.delete(unit); + } } return list; diff --git a/src/events/RE/reCitizenHookup.js b/src/events/RE/reCitizenHookup.js index c4c71ac0758..39e8a0b1379 100644 --- a/src/events/RE/reCitizenHookup.js +++ b/src/events/RE/reCitizenHookup.js @@ -514,7 +514,7 @@ App.Events.RECitizenHookup = class RECitizenHookup extends App.Events.BaseEvent default: r.push(`hot young body`); } - r.push(`is obvious to everyone. The message is clear, and your guest of honor is the center of attention as you take her there in view of the arcology's leading citizens. Naturally, the story percolates, making it clear that there's nothing you won't do to <span class="green">further acceptance of ${fsArray.length > 0 ? FutureSocieties.displayAdj(FS) : "societal"}} principles.</span>`); + r.push(`is obvious to everyone. The message is clear, and your guest of honor is the center of attention as you take her there in view of the arcology's leading citizens. Naturally, the story percolates, making it clear that there's nothing you won't do to <span class="green">further acceptance of ${fsArray.length > 0 ? FutureSocieties.displayAdj(FS) : "societal"} principles.</span>`); App.Events.addParagraph(frag, r); return frag; -- GitLab