diff --git a/src/facilities/nursery/nursery.tw b/src/facilities/nursery/nursery.tw index ca6251730abed2ea7a8085736b4336af3cc8bfd1..55a031a0a9955242aaf34e07473cda0ef3712f98 100644 --- a/src/facilities/nursery/nursery.tw +++ b/src/facilities/nursery/nursery.tw @@ -129,7 +129,7 @@ <div class="choices"> <<if _NL > 0>> - <<removeFacilityWorkers "nursery" "rest" "rest">> + <<= removeFacilityWorkers("nursery", "rest", "rest")>> <</if>> </div> diff --git a/src/facilities/widgets/misc.tw b/src/facilities/widgets/misc.tw deleted file mode 100644 index a6bf858541db3ebe093621382dd7a8ca3d163755..0000000000000000000000000000000000000000 --- a/src/facilities/widgets/misc.tw +++ /dev/null @@ -1,17 +0,0 @@ -:: FacilityMiscWidgets [nobr widget] - -/* Call as removeFacilityWorkers <facilityName> <managerAssignment> <workerAssignment> */ -<<widget "removeFacilityWorkers">> - <<set _facility = App.Entity.facilities[$args[0]]>> - <<set _count = _facility.totalEmployeesCount>> - <<set _NewPop = _count+$dormitoryPopulation>> - <<if _count > 0>> - <<set _passage = passage()>> - <<link "Remove all slaves" _passage>> - <<run App.Utils.moveFacilityWorkers(_facility, $args[1], $args[2])>> - <</link>> - <<if _NewPop > $dormitory>> - @@.red;Dormitory capacity will be exceeded.@@ - <</if>> - <</if>> -<</widget>> diff --git a/src/js/assignJS.js b/src/js/assignJS.js index 16eeef675674422bd8919f312995716c9230dd62..1feba67f71ae861a82ea49b18aba50c298204118 100644 --- a/src/js/assignJS.js +++ b/src/js/assignJS.js @@ -924,3 +924,34 @@ globalThis.assignmentTransition = function(slave, assignTo, passage) { Engine.play(passage); } }; + + +/** + * Creates a link that will remove all slaves from a facility, including manager. + * @param {string} facilityName + * @param {string} managerAssignment + * @param {string} workerAssignment + * @returns {string} + */ +globalThis.removeFacilityWorkers = function(facilityName, managerAssignment, workerAssignment) { + const facility = App.Entity.facilities[facilityName]; + const count = facility.totalEmployeesCount; + const array = []; + if (count > 0) { + array.push( + App.UI.link( + "Remove all slaves", + () => { + App.Utils.moveFacilityWorkers(facility, managerAssignment, workerAssignment); + penthouseCensus(); + }, + [], + passage(), + ) + ); + if ((count + V.dormitoryPopulation) > V.dormitory) { + array.push(`<span class="red">Dormitory capacity will be exceeded.</span>`); + } + } + return array.join(" "); +}; diff --git a/src/uncategorized/arcade.tw b/src/uncategorized/arcade.tw index 7d6d6beb78806115219db5436d434774e08ebaee..79d106b253378b79b3539e44cfcf9f22dddb6f63 100644 --- a/src/uncategorized/arcade.tw +++ b/src/uncategorized/arcade.tw @@ -104,7 +104,7 @@ </div> <div class="choices"> <<if _AL > 0>> - <<removeFacilityWorkers "arcade" "" "work a glory hole">> + <<=removeFacilityWorkers("arcade", "", "work a glory hole")>> <</if>> </div> diff --git a/src/uncategorized/brothel.tw b/src/uncategorized/brothel.tw index 7d41fd1475a5989dfdfcca77dc1d6592e04b33a9..ecc658f13b40a3dd44dc6a2bfc6fb6dff82c25fa 100644 --- a/src/uncategorized/brothel.tw +++ b/src/uncategorized/brothel.tw @@ -173,7 +173,7 @@ </div> <div class="choices"> <<if _BL > 0>> - <<removeFacilityWorkers "brothel" "rest" "whore">> + <<= removeFacilityWorkers("brothel", "rest", "whore",)>> <</if>> </div> </div> diff --git a/src/uncategorized/cellblock.tw b/src/uncategorized/cellblock.tw index 90b64622ccfb757dd33e685d463525ea0b5883b7..7dc373f2894a7035c9cb9cf43ef460bccc763e42 100644 --- a/src/uncategorized/cellblock.tw +++ b/src/uncategorized/cellblock.tw @@ -84,7 +84,7 @@ </p> <<if _CL > 0>> - <<removeFacilityWorkers "cellblock" "rest" "stay confined">> + <<= removeFacilityWorkers("cellblock", "rest", "stay confined")>> <</if>> <div> <<set _Tmult0 = Math.trunc($cellblock*1000*$upgradeMultiplierArcology)>> diff --git a/src/uncategorized/clinic.tw b/src/uncategorized/clinic.tw index 7e88681d257203e0e68d675d22ba91e9a5a1fc77..2f179502e407076d80bd03f8deb0ad33415632f0 100644 --- a/src/uncategorized/clinic.tw +++ b/src/uncategorized/clinic.tw @@ -94,7 +94,7 @@ </div> <div class="choices"> <<if _CL > 0>> - <<removeFacilityWorkers "clinic" "rest" "rest">> + <<= removeFacilityWorkers("clinic", "rest", "rest")>> <</if>> </div> </div> diff --git a/src/uncategorized/club.tw b/src/uncategorized/club.tw index e486cb76f31e48767cfb96fce1442efc062c13cd..dad4b25d4ba7b4a9730891ec39a63f349215368a 100644 --- a/src/uncategorized/club.tw +++ b/src/uncategorized/club.tw @@ -236,7 +236,7 @@ </div> <div class="choices"> <<if _CL > 0>> - <<removeFacilityWorkers "club" "rest" "serve the public">> + <<= removeFacilityWorkers("club", "rest", "serve the public")>> <</if>> </div> </div> diff --git a/src/uncategorized/dairy.tw b/src/uncategorized/dairy.tw index e3747483292ca12c0c085a5954c10e3bf266c578..5fd03af26300934fc0356e5ad1c8440eb4533a7a 100644 --- a/src/uncategorized/dairy.tw +++ b/src/uncategorized/dairy.tw @@ -353,7 +353,7 @@ </div> <div class="choices"> <<if _DL > 0>> - <<removeFacilityWorkers "dairy" "rest" "get milked">> + <<= removeFacilityWorkers("dairy", "rest", "get milked")>> <</if>> </div> </div> diff --git a/src/uncategorized/masterSuite.tw b/src/uncategorized/masterSuite.tw index 42a8792219a00200441e8f5582cef00220be59b0..08027e52b9752bfaa5ee29efd0d53de03f6f7ae1 100644 --- a/src/uncategorized/masterSuite.tw +++ b/src/uncategorized/masterSuite.tw @@ -329,7 +329,7 @@ $masterSuiteNameCaps is furnished </div> <<if _MsL > 0>> - <<removeFacilityWorkers "masterSuite" "rest" "please you">> + <<= removeFacilityWorkers("masterSuite", "rest", "please you")>> <</if>> <<if $seePreg != 0>> diff --git a/src/uncategorized/schoolroom.tw b/src/uncategorized/schoolroom.tw index 4e0ea70ca30a3e9f2749ba841bf8ba57cf6a324c..c70cb29d377dbe280aa89fbdf30ea5ccfc96e255 100644 --- a/src/uncategorized/schoolroom.tw +++ b/src/uncategorized/schoolroom.tw @@ -94,7 +94,7 @@ </div> <div class="choices"> <<if _DL > 0>> - <<removeFacilityWorkers "schoolroom" "rest" "take classes">> + <<= removeFacilityWorkers("schoolroom", "rest", "take classes")>> <</if>> </div> diff --git a/src/uncategorized/servantsQuarters.tw b/src/uncategorized/servantsQuarters.tw index ffd1cec37fd131f76556c31cf62aca76fcc13402..bd67b81a594a7d923d217eb277dfc2eca5cbb696 100644 --- a/src/uncategorized/servantsQuarters.tw +++ b/src/uncategorized/servantsQuarters.tw @@ -96,7 +96,7 @@ <div class="choices"> <<if _DL > 0>> - <<removeFacilityWorkers "servantsQuarters" "rest" "be a servant">> + <<= removeFacilityWorkers("servantsQuarters", "rest", "be a servant")>> <</if>> </div> </div> diff --git a/src/uncategorized/spa.tw b/src/uncategorized/spa.tw index a3ef59996152c693a576c88a34c8ff1fc63ca28d..5e5554c39e2bed9ab4cfd42202d4a75b20dd681f 100644 --- a/src/uncategorized/spa.tw +++ b/src/uncategorized/spa.tw @@ -103,7 +103,7 @@ </div> <div class="choices"> <<if _DL > 0>> - <<removeFacilityWorkers "spa" "rest" "rest">> + <<= removeFacilityWorkers("spa", "rest", "rest")>> <</if>> </div> </div>