diff --git a/src/facilities/penthouse/penthouseFramework.js b/src/facilities/penthouse/penthouseFramework.js index 3b8102501b2a3a4658115845a92be3e75b06d066..39e0163060950aa45083b376903ce5f986ea24e2 100644 --- a/src/facilities/penthouse/penthouseFramework.js +++ b/src/facilities/penthouse/penthouseFramework.js @@ -132,7 +132,10 @@ App.Entity.Facilities.PenthouseJobs = { } assignmentLink(i, passage, callback, linkText) { - return super.assignmentLink(i, "Subordinate Targeting", callback, linkText); + return super.assignmentLink(i, "Subordinate Targeting", + (assignment) => { + return `<<run App.Utils.setActiveSlaveByIndex(${i})>>` + (callback !== undefined ? callback(assignment) : ''); + }, linkText); } }, Cow: class extends App.Entity.Facilities.PenthouseJob { diff --git a/src/js/utilJS.js b/src/js/utilJS.js index d3b1c2915198930e44d95ac7a96ae257e1011cc0..69e26e93bdc1f36a5b6c7cafeef927bfb5a0f116 100644 --- a/src/js/utilJS.js +++ b/src/js/utilJS.js @@ -2198,3 +2198,13 @@ App.Utils.slaveRefString = function(i) { App.Utils.slaveByIndex = function(i) { return i === -1 ? State.variables.activeSlave : State.variables.slaves[i]; }; + +/** + * Sets active slave to the slave with the given index. Does nothing if index < 0 + * @param {number} index + */ +App.Utils.setActiveSlaveByIndex = function(index) { + if (index >= 0) { + State.variables.activeSlave = State.variables.slaves[index]; + } +}