Adds a launch random item option to the podlauncher (#48886)

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.
/🆑
This commit is contained in:
skoglol
2020-01-23 13:12:03 +13:00
committed by oranges
parent 6acedf62ae
commit 4734de3805
3 changed files with 33 additions and 12 deletions
+18 -6
View File
@@ -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
@@ -55,9 +55,9 @@ export const CentcomPodLauncher = props => {
disabled={!data.oldArea}
onClick={() => act('teleportBack')} />
</LabeledList.Item>
<LabeledList.Item label="Clone Mode" >
<LabeledList.Item label="Item Mode" >
<Button
content="Launch Clones"
content="Clone Items"
selected={data.launchClone}
tooltip={multiline`
Choosing this will create a duplicate of the item to be
@@ -66,6 +66,15 @@ export const CentcomPodLauncher = props => {
the supplypod after it lands (but before it opens).
`}
onClick={() => act('launchClone')} />
<Button
content="Random Items"
selected={data.launchRandomItem}
tooltip={multiline`
Choosing this will pick a random item from the selected turf
instead of the entire turfs contents. Best combined with
single/random turf.
`}
onClick={() => act('launchRandomItem')} />
</LabeledList.Item>
<LabeledList.Item label="Launch style">
<Button
@@ -79,13 +88,13 @@ export const CentcomPodLauncher = props => {
`}
onClick={() => act('launchOrdered')} />
<Button
content="Random"
content="Random Turf"
selected={data.launchChoice === 2}
tooltip={multiline`
Instead of launching everything in the bay at once, this
will launch one random turf of items at a time.
`}
onClick={() => act('launchRandom')} />
onClick={() => act('launchRandomTurf')} />
</LabeledList.Item>
<LabeledList.Item label="Explosion">
<Button
File diff suppressed because one or more lines are too long