[SPR part 6] Admins can now edit reverse pod delay times (#53833)

* convert delay vars to a list, UI changes


tgui bundle


Bugfix

* Rebuild tgui

Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
This commit is contained in:
Emmanuel S
2020-09-25 23:56:24 -04:00
committed by GitHub
parent 77338a14a3
commit ec712a2017
7 changed files with 146 additions and 79 deletions

View File

@@ -30,6 +30,11 @@
#define POD_SHAPE_NORML 1
#define POD_SHAPE_OTHER 2
#define POD_TRANSIT "1"
#define POD_FALLING "2"
#define POD_OPENING "3"
#define POD_LEAVING "4"
#define SUPPLYPOD_X_OFFSET -16
GLOBAL_LIST_EMPTY(supplypod_loading_bays)

View File

@@ -73,7 +73,7 @@ GLOBAL_LIST_INIT(skill_types, subtypesof(/datum/skill))
to_chat(mind.current, "<span class='nicegreen'>It seems the Professional [title] Association won't send me another status symbol.</span>")
return
var/obj/structure/closet/supplypod/bluespacepod/pod = new()
pod.landingDelay = 150
pod.delays[POD_TRANSIT] = 150
pod.explosionSize = list(0,0,0,0)
to_chat(mind.current, "<span class='nicegreen'>My legendary skill has attracted the attention of the Professional [title] Association. It seems they are sending me a status symbol to commemorate my abilities.</span>")
var/turf/T = get_turf(mind.current)

View File

@@ -62,9 +62,7 @@
explosionSize = list(0,0,0,0)
reversing = TRUE
reverse_option_list = list("Mobs"=FALSE,"Objects"=FALSE,"Anchored"=FALSE,"Underfloor"=FALSE,"Wallmounted"=FALSE,"Floors"=FALSE,"Walls"=FALSE,"Mecha"=TRUE)
landingDelay = 0
openingDelay = 0
departureDelay = 0
delays = list(POD_TRANSIT = 0, POD_FALLING = 4, POD_OPENING = 0, POD_LEAVING = 0)
effectOrgans = TRUE
effectQuiet = TRUE
leavingSound = 'sound/vehicles/rocketlaunch.ogg'

View File

@@ -55,7 +55,6 @@
var/list/cam_plane_masters
var/obj/screen/background/cam_background
var/tabIndex = 1
var/list/timers = list("landingDelay", "fallDuration", "openingDelay", "departureDelay")
var/renderLighting = FALSE
/datum/centcom_podlauncher/New(user) //user can either be a client or a mob
@@ -147,10 +146,9 @@
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)
data["delay_1"] = temp_pod.landingDelay //How long the pod takes to land after launching
data["delay_2"] = temp_pod.fallDuration //How long the pod's falling animation lasts
data["delay_3"] = temp_pod.openingDelay //How long the pod takes to open after landing
data["delay_4"] = temp_pod.departureDelay //How long the pod takes to leave after opening (if bluespace=true, it deletes. if reversing=true, it flies back to centcom)
data["delays"] = temp_pod.delays
data["rev_delays"] = temp_pod.reverse_delays
data["custom_rev_delay"] = temp_pod.custom_rev_delay
data["styleChoice"] = temp_pod.style //Style is a variable that keeps track of what the pod is supposed to look like. It acts as an index to the GLOB.podstyles list in cargo.dm defines to get the proper icon/name/desc for the pod.
data["effectShrapnel"] = temp_pod.effectShrapnel //If true, creates a cloud of shrapnel of a decided type and magnitude on landing
data["shrapnelType"] = "[temp_pod.shrapnel_type]" //Path2String
@@ -414,13 +412,26 @@
////////////////////////////TIMER DELAYS//////////////////
if("editTiming") //Change the different timers relating to the pod
var/delay = params["timer"]
var/timer = timers[delay]
var/value = params["value"]
temp_pod.vars[timer] = value * 10
var/reverse = params["reverse"]
if (reverse)
message_admins("reversed")
temp_pod.reverse_delays[delay] = value * 10
else
message_admins("not reversed")
temp_pod.delays[delay] = value * 10
message_admins("output:")
for (var/thing in temp_pod.reverse_delays)
message_admins(temp_pod.reverse_delays[thing])
for (var/thing in temp_pod.delays)
message_admins(temp_pod.delays[thing])
. = TRUE
if("resetTiming")
for (var/timer in timers)
temp_pod.vars[timer] = initial(temp_pod.vars[timer])
temp_pod.delays = list(POD_TRANSIT = 20, POD_FALLING = 4, POD_OPENING = 30, POD_LEAVING = 30)
temp_pod.reverse_delays = list(POD_TRANSIT = 20, POD_FALLING = 4, POD_OPENING = 30, POD_LEAVING = 30)
. = TRUE
if("toggleRevDelays")
temp_pod.custom_rev_delay = !temp_pod.custom_rev_delay
. = TRUE
////////////////////////////ADMIN SOUNDS//////////////////
if("fallingSound") //Admin sound from a local file that plays when the pod lands
@@ -799,10 +810,9 @@
launchChoice = dataToLoad["launchChoice"] //Launch turfs all at once (0), ordered (1), or randomly(1)
explosionChoice = dataToLoad["explosionChoice"] //An explosion that occurs when landing. Can be no explosion (0), custom explosion (1), or maxcap (2)
damageChoice = dataToLoad["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)
temp_pod.landingDelay = dataToLoad["delay_1"] //How long the pod takes to land after launching
temp_pod.fallDuration = dataToLoad["delay_2"] //How long the pod's falling animation lasts
temp_pod.openingDelay = dataToLoad["delay_3"] //How long the pod takes to open after landing
temp_pod.departureDelay = dataToLoad["delay_4"] //How long the pod takes to leave after opening (if bluespace=true, it deletes. if reversing=true, it flies back to centcom)
temp_pod.delays = dataToLoad["delays"]
temp_pod.reverse_delays = dataToLoad["rev_delays"]
temp_pod.custom_rev_delay = dataToLoad["custom_rev_delay"]
temp_pod.setStyle(dataToLoad["styleChoice"]) //Style is a variable that keeps track of what the pod is supposed to look like. It acts as an index to the GLOB.podstyles list in cargo.dm defines to get the proper icon/name/desc for the pod.
temp_pod.effectShrapnel = dataToLoad["effectShrapnel"] //If true, creates a cloud of shrapnel of a decided type and magnitude on landing
temp_pod.shrapnel_type = text2path(dataToLoad["shrapnelType"])

View File

@@ -23,9 +23,9 @@
//*****NOTE*****: Many of these comments are similarly described in centcom_podlauncher.dm. If you change them here, please consider doing so in the centcom podlauncher code as well!
var/adminNamed = FALSE //Determines whether or not the pod has been named by an admin. If true, the pod's name will not get overridden when the style of the pod changes (changing the style of the pod normally also changes the name+desc)
var/bluespace = FALSE //If true, the pod deletes (in a shower of sparks) after landing
var/landingDelay = 30 //How long the pod takes to land after launching
var/openingDelay = 30 //How long the pod takes to open after landing
var/departureDelay = 30 //How long the pod takes to leave after opening. If bluespace = TRUE, it deletes. If reversing = TRUE, it flies back to centcom.
var/delays = list(POD_TRANSIT = 30, POD_FALLING = 4, POD_OPENING = 30, POD_LEAVING = 30)
var/reverse_delays = list(POD_TRANSIT = 30, POD_FALLING = 4, POD_OPENING = 30, POD_LEAVING = 30)
var/custom_rev_delay = FALSE
var/damage = 0 //Damage that occurs to any mob under the pod when it lands.
var/effectStun = FALSE //If true, stuns anyone under the pod when it launches until it lands, forcing them to get hit by the pod. Devilish!
var/effectLimb = FALSE //If true, pops off a limb (if applicable) from anyone caught under the pod when it lands
@@ -38,7 +38,6 @@
var/style = STYLE_STANDARD //Style is a variable that keeps track of what the pod is supposed to look like. It acts as an index to the GLOB.podstyles list in cargo.dm defines to get the proper icon/name/desc for the pod.
var/reversing = FALSE //If true, the pod will not send any items. Instead, after opening, it will close again (picking up items/mobs) and fly back to centcom
var/list/reverse_dropoff_coords //Turf that the reverse pod will drop off it's newly-acquired cargo to
var/fallDuration = 4
var/fallingSoundLength = 11
var/fallingSound = 'sound/weapons/mortar_long_whistle.ogg'//Admin sound to play before the pod lands
var/landingSound //Admin sound to play when the pod lands
@@ -64,7 +63,7 @@
style = STYLE_BLUESPACE
bluespace = TRUE
explosionSize = list(0,0,1,2)
landingDelay = 15 //Slightly quicker than the supplypod
delays = list(POD_TRANSIT = 15, POD_FALLING = 4, POD_OPENING = 30, POD_LEAVING = 30)
/obj/structure/closet/supplypod/extractionpod
name = "Syndicate Extraction Pod"
@@ -73,13 +72,13 @@
style = STYLE_SYNDICATE
bluespace = TRUE
explosionSize = list(0,0,1,2)
landingDelay = 25 //Longer than others
delays = list(POD_TRANSIT = 25, POD_FALLING = 4, POD_OPENING = 30, POD_LEAVING = 30)
/obj/structure/closet/supplypod/centcompod
style = STYLE_CENTCOM
bluespace = TRUE
explosionSize = list(0,0,0,0)
landingDelay = 20 //Very speedy!
delays = list(POD_TRANSIT = 20, POD_FALLING = 4, POD_OPENING = 30, POD_LEAVING = 30)
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
/obj/structure/closet/supplypod/Initialize(var/customStyle = FALSE)
@@ -212,9 +211,8 @@
var/obj/error_landmark = locate(/obj/effect/landmark/error) in GLOB.landmarks_list
var/turf/error_landmark_turf = get_turf(error_landmark)
reverse_dropoff_coords = list(error_landmark_turf.x, error_landmark_turf.y, error_landmark_turf.z)
landingDelay = initial(landingDelay) //Reset the landing timers so we land on whatever turf we're aiming at normally. Will be changed to be editable later (tm)
fallDuration = initial(fallDuration) //This is so if someone adds a really long dramatic landing time they don't have to sit through it twice on the pod's return trip
openingDelay = initial(openingDelay)
if (custom_rev_delay)
delays = reverse_delays
backToNonReverseIcon()
var/turf/return_turf = locate(reverse_dropoff_coords[1], reverse_dropoff_coords[2], reverse_dropoff_coords[3])
new /obj/effect/pod_landingzone(return_turf, src)
@@ -274,11 +272,11 @@
var/mob/living/simple_animal/pet/gondola/gondolapod/benis = new(turf_underneath, src)
benis.contents |= contents //Move the contents of this supplypod into the gondolapod mob.
moveToNullspace()
addtimer(CALLBACK(src, .proc/open_pod, benis), openingDelay) //After the openingDelay passes, we use the open proc from this supplyprod while referencing the contents of the "holder", in this case the gondolapod mob
addtimer(CALLBACK(src, .proc/open_pod, benis), delays[POD_OPENING]) //After the opening delay passes, we use the open proc from this supplyprod while referencing the contents of the "holder", in this case the gondolapod mob
else if (style == STYLE_SEETHROUGH)
open_pod(src)
else
addtimer(CALLBACK(src, .proc/open_pod, src), openingDelay) //After the openingDelay passes, we use the open proc from this supplypod, while referencing this supplypod's contents
addtimer(CALLBACK(src, .proc/open_pod, src), delays[POD_OPENING]) //After the opening delay passes, we use the open proc from this supplypod, while referencing this supplypod's contents
/obj/structure/closet/supplypod/proc/open_pod(atom/movable/holder, broken = FALSE, forced = FALSE) //The holder var represents an atom whose contents we will be working with
if (!holder)
@@ -306,9 +304,9 @@
startExitSequence(src)
else
if (reversing)
addtimer(CALLBACK(src, .proc/SetReverseIcon), departureDelay/2) //Finish up the pod's duties after a certain amount of time
addtimer(CALLBACK(src, .proc/SetReverseIcon), delays[POD_LEAVING]/2) //Finish up the pod's duties after a certain amount of time
if(!stay_after_drop) // Departing should be handled manually
addtimer(CALLBACK(src, .proc/startExitSequence, holder), departureDelay*(4/5)) //Finish up the pod's duties after a certain amount of time
addtimer(CALLBACK(src, .proc/startExitSequence, holder), delays[POD_LEAVING]*(4/5)) //Finish up the pod's duties after a certain amount of time
/obj/structure/closet/supplypod/proc/startExitSequence(atom/movable/holder)
if (leavingSound)
@@ -329,7 +327,7 @@
take_contents(holder)
playsound(holder, close_sound, soundVolume*0.75, TRUE, -3)
holder.setClosed()
addtimer(CALLBACK(src, .proc/preReturn, holder), departureDelay * 0.2) //Start to leave a bit after closing for cinematic effect
addtimer(CALLBACK(src, .proc/preReturn, holder), delays[POD_LEAVING] * 0.2) //Start to leave a bit after closing for cinematic effect
/obj/structure/closet/supplypod/take_contents(atom/movable/holder)
var/turf/turf_underneath = holder.drop_location()
@@ -457,7 +455,7 @@
if(!glow_effect)
return
glow_effect.layer = LOW_ITEM_LAYER
glow_effect.fadeAway(openingDelay)
glow_effect.fadeAway(delays[POD_OPENING])
/obj/structure/closet/supplypod/Destroy()
deleteRubble()
@@ -536,7 +534,7 @@
/obj/effect/pod_landingzone_effect/Initialize(mapload, obj/structure/closet/supplypod/pod)
. = ..()
transform = matrix() * 1.5
animate(src, transform = matrix()*0.01, time = pod.landingDelay+pod.fallDuration)
animate(src, transform = matrix()*0.01, time = pod.delays[POD_TRANSIT]+pod.delays[POD_FALLING])
/obj/effect/pod_landingzone //This is the object that forceMoves the supplypod to it's location
name = "Landing Zone Indicator"
@@ -562,7 +560,7 @@
if (!pod.effectStealth)
helper = new (drop_location(), pod)
alpha = 255
animate(src, transform = matrix().Turn(90), time = pod.landingDelay+pod.fallDuration)
animate(src, transform = matrix().Turn(90), time = pod.delays[POD_TRANSIT]+pod.delays[POD_FALLING])
if (single_order)
if (istype(single_order, /datum/supply_order))
var/datum/supply_order/SO = single_order
@@ -574,16 +572,16 @@
mob_in_pod.reset_perspective(src)
if(pod.effectStun) //If effectStun is true, stun any mobs caught on this pod_landingzone until the pod gets a chance to hit them
for (var/mob/living/target_living in get_turf(src))
target_living.Stun(pod.landingDelay+10, ignore_canstun = TRUE)//you ain't goin nowhere, kid.
if (pod.fallDuration == initial(pod.fallDuration) && pod.landingDelay + pod.fallDuration < pod.fallingSoundLength)
target_living.Stun(pod.delays[POD_TRANSIT]+10, ignore_canstun = TRUE)//you ain't goin nowhere, kid.
if (pod.delays[POD_FALLING] == initial(pod.delays[POD_FALLING]) && pod.delays[POD_TRANSIT] + pod.delays[POD_FALLING] < pod.fallingSoundLength)
pod.fallingSoundLength = 3 //The default falling sound is a little long, so if the landing time is shorter than the default falling sound, use a special, shorter default falling sound
pod.fallingSound = 'sound/weapons/mortar_whistle.ogg'
var/soundStartTime = pod.landingDelay - pod.fallingSoundLength + pod.fallDuration
var/soundStartTime = pod.delays[POD_TRANSIT] - pod.fallingSoundLength + pod.delays[POD_FALLING]
if (soundStartTime < 0)
soundStartTime = 1
if (!pod.effectQuiet && !(pod.pod_flags & FIRST_SOUNDS))
addtimer(CALLBACK(src, .proc/playFallingSound), soundStartTime)
addtimer(CALLBACK(src, .proc/beginLaunch, pod.effectCircle), pod.landingDelay)
addtimer(CALLBACK(src, .proc/beginLaunch, pod.effectCircle), pod.delays[POD_TRANSIT])
/obj/effect/pod_landingzone/proc/playFallingSound()
playsound(src, pod.fallingSound, pod.soundVolume, TRUE, 6)
@@ -604,9 +602,9 @@
pod.transform = matrix().Turn(rotation)
pod.layer = FLY_LAYER
if (pod.style != STYLE_INVISIBLE)
animate(pod.get_filter("motionblur"), y = 0, time = pod.fallDuration, flags = ANIMATION_PARALLEL)
animate(pod, pixel_z = -1 * abs(sin(rotation))*4, pixel_x = SUPPLYPOD_X_OFFSET + (sin(rotation) * 20), time = pod.fallDuration, easing = LINEAR_EASING, flags = ANIMATION_PARALLEL) //Make the pod fall! At an angle!
addtimer(CALLBACK(src, .proc/endLaunch), pod.fallDuration, TIMER_CLIENT_TIME) //Go onto the last step after a very short falling animation
animate(pod.get_filter("motionblur"), y = 0, time = pod.delays[POD_FALLING], flags = ANIMATION_PARALLEL)
animate(pod, pixel_z = -1 * abs(sin(rotation))*4, pixel_x = SUPPLYPOD_X_OFFSET + (sin(rotation) * 20), time = pod.delays[POD_FALLING], easing = LINEAR_EASING, flags = ANIMATION_PARALLEL) //Make the pod fall! At an angle!
addtimer(CALLBACK(src, .proc/endLaunch), pod.delays[POD_FALLING], TIMER_CLIENT_TIME) //Go onto the last step after a very short falling animation
/obj/effect/pod_landingzone/proc/setupSmoke(rotation)
if (pod.style == STYLE_INVISIBLE || pod.style == STYLE_SEETHROUGH)
@@ -621,9 +619,9 @@
smoke_part.pixel_x = sin(rotation)*32 * i
smoke_part.pixel_y = abs(cos(rotation))*32 * i
smoke_part.filters += filter(type = "blur", size = 4)
var/time = (pod.fallDuration / length(smoke_effects))*(length(smoke_effects)-i)
var/time = (pod.delays[POD_FALLING] / length(smoke_effects))*(length(smoke_effects)-i)
addtimer(CALLBACK(smoke_part, /obj/effect/supplypod_smoke/.proc/drawSelf, i), time, TIMER_CLIENT_TIME) //Go onto the last step after a very short falling animation
QDEL_IN(smoke_part, pod.fallDuration + 35)
QDEL_IN(smoke_part, pod.delays[POD_FALLING] + 35)
/obj/effect/pod_landingzone/proc/drawSmoke()
if (pod.style == STYLE_INVISIBLE || pod.style == STYLE_SEETHROUGH)

View File

@@ -167,6 +167,25 @@ const DELAYS = [
},
];
const REV_DELAYS = [
{
title: 'Pre',
tooltip: 'Time until pod appears above dropoff point',
},
{
title: 'Fall',
tooltip: 'Duration of pods\nfalling animation',
},
{
title: 'Open',
tooltip: 'Time it takes pod to open after landing',
},
{
title: 'Exit',
tooltip: 'Time for pod to\nleave after opening',
},
];
const SOUNDS = [
{
title: 'Fall',
@@ -1068,12 +1087,12 @@ const Bays = (props, context) => {
const Timing = (props, context) => {
const { act, data } = useBackend(context);
return (
<Section
fill
title="Delay"
title="Time"
buttons={(
<Fragment>
<Button
icon="undo"
color="transparent"
@@ -1083,35 +1102,72 @@ const Timing = (props, context) => {
tooltipOverrideLong
tooltipPosition="bottom-right"
onClick={() => act('resetTiming')} />
<Button
icon={data.custom_rev_delay === 1 ? "toggle-on" : "toggle-off"}
selected={data.custom_rev_delay}
disabled={!data.effectReverse}
color="transparent"
tooltip={multiline`
Toggle Reverse Delays
Note: Top set is
normal delays, bottom set
is reversing pod's delays`}
tooltipOverrideLong
tooltipPosition="bottom-right"
onClick={() => act('toggleRevDelays')} />
</Fragment>
)}>
<DelayHelper
delay_list={DELAYS}
/>
{data.custom_rev_delay && (
<Fragment>
<Divider horizontal />
<DelayHelper
delay_list={REV_DELAYS}
reverse
/>
</Fragment>
)||""}
</Section>
);
};
const DelayHelper = (props, context) => {
const { act, data } = useBackend(context);
const {
delay_list,
reverse = false,
} = props;
return (
<LabeledControls wrap>
{DELAYS.map((delay, i) => (
{delay_list.map((delay, i) => (
<LabeledControls.Item
key={i}
label={delay.title}>
label={data.custom_rev_delay ? "" : delay.title}>
<Knob
inline
step={0.02}
value={data["delay_"+(i+1)]/10}
size={data.custom_rev_delay ? 0.75 : 1}
value={(reverse ? data.rev_delays[i+1] : data.delays[i+1]) / 10}
unclamped
minValue={0}
unit={"s"}
format={value => toFixed(value, 2)}
maxValue={10}
color={(data["delay_"+(i+1)]/10) > 10 ? "orange" : "default"}
color={((reverse ? data.rev_delays[i+1] : data.delays[i+1]) / 10)
> 10 ? "orange" : "default"}
onDrag={(e, value) => {
act('editTiming', {
timer: i + 1,
timer: ""+(i + 1),
value: Math.max(value, 0),
reverse: reverse,
});
}} />
</LabeledControls.Item>
))}
</LabeledControls>
</Section>
);
};
const Sounds = (props, context) => {
const { act, data } = useBackend(context);
return (

File diff suppressed because one or more lines are too long