From 4734de3805b8855c19a3f5f1ac53dcff9d601c48 Mon Sep 17 00:00:00 2001 From: skoglol <33292112+kriskog@users.noreply.github.com> Date: Thu, 23 Jan 2020 01:12:03 +0100 Subject: [PATCH] Adds a launch random item option to the podlauncher (#48886) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit About The Pull Request Adds the option of picking a random item from the turf and sending it instead of sending the entire turfs contents. Helpful in situations where you dont want to send clones, but also want to spread out the items sent. Why It's Good For The Game Happy admins, happy life. Changelog 🆑 Skoglol admin: Podlauncher now supports sending a single random item instead of the entire turfs contents. /🆑 --- code/modules/cargo/centcom_podlauncher.dm | 24 ++++++++++++++----- .../tgui/interfaces/CentcomPodLauncher.js | 17 +++++++++---- tgui-next/packages/tgui/public/tgui.bundle.js | 4 ++-- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/code/modules/cargo/centcom_podlauncher.dm b/code/modules/cargo/centcom_podlauncher.dm index 9c884b17a18..a65e126ddfe 100644 --- a/code/modules/cargo/centcom_podlauncher.dm +++ b/code/modules/cargo/centcom_podlauncher.dm @@ -24,6 +24,7 @@ var/client/holder //client of whoever is using this datum var/area/bay //What bay we're using to launch shit from. var/launchClone = FALSE //If true, then we don't actually launch the thing in the bay. Instead we call duplicateObject() and send the result + var/launchRandomItem = FALSE //If true, lauches a single random item instead of everything on a turf. var/launchChoice = 1 //Determines if we launch all at once (0) , in order (1), or at random(2) var/explosionChoice = 0 //Determines if there is no explosion (0), custom explosion (1), or just do a maxcap (2) var/damageChoice = 0 //Determines if we do no damage (0), custom amnt of damage (1), or gib + 5000dmg (2) @@ -65,6 +66,7 @@ force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.adm data["bayNumber"] = B //Holds the bay as a number. Useful for comparisons in centcom_podlauncher.ract data["oldArea"] = (oldTurf ? get_area(oldTurf) : null) //Holds the name of the area that the user was in before using the teleportCentcom action data["launchClone"] = launchClone //Do we launch the actual items in the bay or just launch clones of them? + data["launchRandomItem"] = launchRandomItem //Do we launch a single random item instead of everything on the turf? data["launchChoice"] = launchChoice //Launch turfs all at once (0), ordered (1), or randomly(1) data["explosionChoice"] = explosionChoice //An explosion that occurs when landing. Can be no explosion (0), custom explosion (1), or maxcap (2) data["damageChoice"] = damageChoice //Damage that occurs to any mob under the pod when it lands. Can be no damage (0), custom damage (1), or gib+5000dmg (2) @@ -149,6 +151,9 @@ force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.adm if("launchClone") //Toggles the launchClone var. See variable declarations above for what this specifically means launchClone = !launchClone . = TRUE + if("launchRandomItem") //Pick random turfs from the supplypod bay at centcom to launch + launchRandomItem = !launchRandomItem + . = TRUE if("launchOrdered") //Launch turfs (from the orderedArea list) one at a time in order, from the supplypod bay at centcom if (launchChoice == 1) //launchChoice 1 represents ordered. If we push "ordered" and it already is, then we go to default value launchChoice = 0 @@ -157,7 +162,7 @@ force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.adm launchChoice = 1 updateSelector() . = TRUE - if("launchRandom") //Pick random turfs from the supplypod bay at centcom to launch + if("launchRandomTurf") //Pick random turfs from the supplypod bay at centcom to launch if (launchChoice == 2) launchChoice = 0 updateSelector() @@ -551,13 +556,20 @@ force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.adm var/shippingLane = GLOB.areas_by_type[/area/centcom/supplypod/flyMeToTheMoon] toLaunch.forceMove(shippingLane) if (launchClone) //We arent launching the actual items from the bay, rather we are creating clones and launching those - for (var/atom/movable/O in launchList) - DuplicateObject(O).forceMove(toLaunch) //Duplicate each atom/movable in launchList and forceMove them into the supplypod - new /obj/effect/DPtarget(A, toLaunch) //Create the DPTarget, which will eventually forceMove the temp_pod to it's location + if(launchRandomItem) + var/atom/movable/O = pick_n_take(launchList) + DuplicateObject(O).forceMove(toLaunch) //Duplicate a single atom/movable from launchList and forceMove it into the supplypod + else + for (var/atom/movable/O in launchList) + DuplicateObject(O).forceMove(toLaunch) //Duplicate each atom/movable in launchList and forceMove them into the supplypod else - for (var/atom/movable/O in launchList) //If we aren't cloning the objects, just go through the launchList + if(launchRandomItem) + var/atom/movable/O = pick_n_take(launchList) O.forceMove(toLaunch) //and forceMove any atom/moveable into the supplypod - new /obj/effect/DPtarget(A, toLaunch) //Then, create the DPTarget effect, which will eventually forceMove the temp_pod to it's location + else + for (var/atom/movable/O in launchList) //If we aren't cloning the objects, just go through the launchList + O.forceMove(toLaunch) //and forceMove any atom/moveable into the supplypod + new /obj/effect/DPtarget(A, toLaunch) //Then, create the DPTarget effect, which will eventually forceMove the temp_pod to it's location if (launchClone) launchCounter++ //We only need to increment launchCounter if we are cloning objects. //If we aren't cloning objects, taking and removing the first item each time from the acceptableTurfs list will inherently iterate through the list in order diff --git a/tgui-next/packages/tgui/interfaces/CentcomPodLauncher.js b/tgui-next/packages/tgui/interfaces/CentcomPodLauncher.js index e83d69c7ae7..5602f5f451c 100644 --- a/tgui-next/packages/tgui/interfaces/CentcomPodLauncher.js +++ b/tgui-next/packages/tgui/interfaces/CentcomPodLauncher.js @@ -55,9 +55,9 @@ export const CentcomPodLauncher = props => { disabled={!data.oldArea} onClick={() => act('teleportBack')} /> - +