diff --git a/src/004-base/facility.js b/src/004-base/facility.js index be67be3c9701de0b13ca434cd07eb2028bb3d4c3..719fdf7781fc3b08d351315f1707fd60bc3312cc 100644 --- a/src/004-base/facility.js +++ b/src/004-base/facility.js @@ -82,12 +82,6 @@ App.Entity.Facilities.Job = class { return this.hasEmployeeWithId(slave.ID); } - /** - * @callback linkCallback - * @param {string} assignment new assignment - * @returns {string} code to include into the <<link>><</link>> - */ - /** * @callback assignmentCallback * @param {App.Entity.SlaveState} slave the slave whose assignment changes @@ -95,20 +89,6 @@ App.Entity.Facilities.Job = class { * @returns {void} */ - /** - * Returns link text for the penthouse assignment - * @param {number} ID slave ID - * @param {string} [passage] passage to go to - * @param {linkCallback} [callback] - * @param {string} [linkText] - * @returns {string} - */ - assignmentLink(ID, passage, callback, linkText) { - linkText = linkText || this.desc.position; - const linkAction = callback !== undefined ? callback(this.desc.assignment) : ''; - return `<<link "${linkText}"${passage !== undefined ? ' "' + passage + '"' : ''}>><<= assignJob(slaveStateById(${ID}), "${this.desc.assignment}")>>${linkAction}<</link>>`; - } - /** * Returns link text for the penthouse assignment * @param {number} ID slave ID @@ -420,32 +400,6 @@ App.Entity.Facilities.Facility = class { return this.jobs.some(job => job.isEmployed(slave)); } - /** - * Returns link text for the job assignments - * @param {number} ID slave ID - * @param {string} [job] generate link only for this job - * @param {string} [passage] - * @param {linkCallback} callback - * @returns {string[]} - */ - assignmentLinks(ID, job, passage, callback) { - /** @type {App.Entity.SlaveState} */ - const slave = slaveStateById(ID); - const jobs = job === undefined ? this._jobs : {job: this._jobs[job]}; - - let res = []; - for (const jn in jobs) { - const j = jobs[jn]; - let rejects = j.canEmploy(slave); - if (rejects.length === 0) { - res.push(j.assignmentLink(ID, passage, callback)); - } else { - res.push(App.UI.disabledLink(j.desc.position, rejects)); - } - } - return res; - } - /** * Returns link text for the job assignments * @param {number} ID slave ID @@ -472,19 +426,6 @@ App.Entity.Facilities.Facility = class { return res; } - /** - * Returns link text for the facility transfer - * @param {number} ID slave ID - * @param {string} [job] transfer to this job (uses default job if this is undefined) - * @param {string} [passage] - * @param {linkCallback} [callback] - * @returns {string} - */ - transferLink(ID, job, passage, callback) { - job = job || this.desc.defaultJob; - return this._jobs[job].assignmentLink(ID, passage, callback, this.genericName); - } - /** * Returns link text for the facility transfer * @param {number} ID slave ID @@ -558,20 +499,6 @@ App.Entity.Facilities.Facility = class { * Job for a facility with a single job option */ App.Entity.Facilities.FacilitySingleJob = class extends App.Entity.Facilities.Job { - /** - * Returns link text for the penthouse assignment - * @param {number} ID slave ID - * @param {string} [targetPassage] passage to go to - * @param {linkCallback} [callback] - * @param {string} [linkText] - * @returns {string} - */ - assignmentLink(ID, targetPassage, callback, linkText) { - linkText = linkText || this.facility.genericName; - const linkAction = callback !== undefined ? callback(this.desc.assignment) : ''; - return `<<link "${linkText}">>${linkAction}<<run assignmentTransition(slaveStateById(${ID}), "${this.facility.genericName}", "${targetPassage || passage()}")>><</link>>`; - } - /** * @param {number} ID slave ID * @param {string} [targetPassage] passage to go to diff --git a/src/facilities/penthouse/penthouseFramework.js b/src/facilities/penthouse/penthouseFramework.js index 818d2057f7c5ce50c885a62bd011b69fcc1c1156..5531c55fcd93d7caf3b59dbc315cba56f6cabd49 100644 --- a/src/facilities/penthouse/penthouseFramework.js +++ b/src/facilities/penthouse/penthouseFramework.js @@ -140,13 +140,6 @@ App.Entity.Facilities.PenthouseJobs = { return r; } - assignmentLink(ID, passage, callback, linkText) { - return super.assignmentLink(ID, "Subordinate Targeting", - (assignment) => { - return `<<set $activeSlave = slaveStateById(${ID})>>` + (callback !== undefined ? callback(assignment) : ''); - }, linkText); - } - assignmentLinkElement(ID, passage, callback, linkText) { linkText = linkText || this.desc.position; return App.UI.DOM.assignmentLink(slaveStateById(ID), this.desc.assignment, "Subordinate Targeting", diff --git a/src/js/assignJS.js b/src/js/assignJS.js index 36f3fa6f85600cab1b253dc73a307c597eb2a521..e40f3e6136ffa32b284a9bf385a4c6c46b1dd307 100644 --- a/src/js/assignJS.js +++ b/src/js/assignJS.js @@ -761,62 +761,12 @@ App.UI.jobLinks = function() { ]; return { - assignments: assignmentLinks, - transfers: transferLinks, assignmentsFragment: assignmentsFragment, transfersFragment: transfersFragment }; /** - * Generates assignment links (as Sugarcube markup) - * @param {number} ID slave ID - * @param {string} [passage] optional next passage to go to - * @param {linkCallback} [callback] - * @returns {string} - */ - function assignmentLinks(ID, passage, callback) { - let penthouseJobs = App.Entity.facilities.penthouse.assignmentLinks(ID, undefined, passage, callback); - const slave = slaveStateById(ID); - const sp = getPronouns(slave); - - if (slave.fuckdoll === 0) { - const assignment = Job.CHOICE; - if (slave.assignment !== assignment) { - const linkAction = callback !== undefined ? callback(assignment) : ''; - penthouseJobs.push(`<<link "Let ${sp.object} choose" ${passage !== undefined ? `"${passage}"` : ''}>><<= assignJob(slaveStateById(${ID}), "${assignment}")>>${linkAction}<</link>>`); - } - } else { - penthouseJobs.push(App.UI.disabledLink(`Let ${sp.object} choose`, ["Fuckdolls can't choose their job"])); - } - - return penthouseJobs.join(" | "); - } - - /** - * Generates transfer links (as Sugarcube markup) - * @param {number} ID slave ID - * @returns {string} - */ - function transferLinks(ID) { - /** @type {string[]} */ - const transfers = []; - const slave = slaveStateById(ID); - - for (const f of facilitiesOrder) { - if (!f.established || f.jobs.length === 0) { continue; } - const rejects = f.canHostSlave(slave); - if (rejects.length === 0) { - transfers.push(f.transferLink(ID, undefined, passage())); - } else { - transfers.push(App.UI.disabledLink(f.genericName, rejects)); - } - } - - return transfers.join(' | '); - } - - /** - * Generates assigment links (as a DocumentFragment) + * Generates assigment links * @param {number} ID * @param {string} passage * @param {assignmentCallback} [callback] @@ -846,7 +796,7 @@ App.UI.jobLinks = function() { } /** - * Generates transfer links (as a DocumentFragment) + * Generates transfer links * @param {number} ID * @param {assignmentCallback} [callback] * @returns {DocumentFragment}