From 6a4c79ac3c47dff908e46fc90642ef5267c32e46 Mon Sep 17 00:00:00 2001 From: Emmanuel S Date: Mon, 6 Jul 2020 09:23:34 -0400 Subject: [PATCH] The Supplypod Renaissance Part 3: Admins can add shrapnel to supplypods (#51957) * test get code up to speed finished? polish fixes mergies * tgui --- code/__DEFINES/dcs/signals.dm | 2 ++ code/__DEFINES/is_helpers.dm | 2 ++ code/datums/components/pellet_cloud.dm | 6 ++++-- code/modules/cargo/centcom_podlauncher.dm | 18 ++++++++++++++++++ code/modules/cargo/supplypod.dm | 6 ++++++ .../tgui/interfaces/CentcomPodLauncher.js | 8 ++++++++ tgui/packages/tgui/public/tgui.bundle.js | 2 +- 7 files changed, 41 insertions(+), 3 deletions(-) diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 285a9bd15ce..2742c4a619c 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -475,6 +475,8 @@ #define COMSIG_ITEM_DISABLE_EMBED "item_disable_embed" ///from [/obj/effect/mine/proc/triggermine]: #define COMSIG_MINE_TRIGGERED "minegoboom" +///from [/obj/structure/closet/supplypod/proc/endlaunch]: +#define COMSIG_SUPPLYPOD_LANDED "supplypodgoboom" // /obj/item signals for economy ///called when an item is sold by the exports subsystem diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm index 26381b25d8c..3b7903dd57c 100644 --- a/code/__DEFINES/is_helpers.dm +++ b/code/__DEFINES/is_helpers.dm @@ -160,6 +160,8 @@ GLOBAL_LIST_INIT(turfs_without_ground, typecacheof(list( #define islandmine(A) (istype(A, /obj/effect/mine)) +#define issupplypod(A) (istype(A, /obj/structure/closet/supplypod)) + #define isammocasing(A) (istype(A, /obj/item/ammo_casing)) #define isidcard(I) (istype(I, /obj/item/card/id)) diff --git a/code/datums/components/pellet_cloud.dm b/code/datums/components/pellet_cloud.dm index 2fc4fd929c6..ef659be0b4e 100644 --- a/code/datums/components/pellet_cloud.dm +++ b/code/datums/components/pellet_cloud.dm @@ -47,7 +47,7 @@ var/mob/living/shooter /datum/component/pellet_cloud/Initialize(projectile_type=/obj/item/shrapnel, magnitude=5) - if(!isammocasing(parent) && !isgrenade(parent) && !islandmine(parent)) + if(!isammocasing(parent) && !isgrenade(parent) && !islandmine(parent) && !issupplypod(parent)) return COMPONENT_INCOMPATIBLE if(magnitude < 1) @@ -58,7 +58,7 @@ if(isammocasing(parent)) num_pellets = magnitude - else if(isgrenade(parent) || islandmine(parent)) + else if(isgrenade(parent) || islandmine(parent) || issupplypod(parent)) radius = magnitude /datum/component/pellet_cloud/Destroy(force, silent) @@ -77,6 +77,8 @@ RegisterSignal(parent, COMSIG_GRENADE_PRIME, .proc/create_blast_pellets) else if(islandmine(parent)) RegisterSignal(parent, COMSIG_MINE_TRIGGERED, .proc/create_blast_pellets) + else if(issupplypod(parent)) + RegisterSignal(parent, COMSIG_SUPPLYPOD_LANDED, .proc/create_blast_pellets) /datum/component/pellet_cloud/UnregisterFromParent() UnregisterSignal(parent, list(COMSIG_PARENT_PREQDELETED, COMSIG_PELLET_CLOUD_INIT, COMSIG_GRENADE_PRIME, COMSIG_GRENADE_ARMED, COMSIG_MOVABLE_MOVED, COMSIG_MOVABLE_UNCROSSED, COMSIG_MINE_TRIGGERED, COMSIG_ITEM_DROPPED)) diff --git a/code/modules/cargo/centcom_podlauncher.dm b/code/modules/cargo/centcom_podlauncher.dm index c3040336338..48db4feb9d6 100644 --- a/code/modules/cargo/centcom_podlauncher.dm +++ b/code/modules/cargo/centcom_podlauncher.dm @@ -75,6 +75,7 @@ force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.adm data["openingDelay"] = temp_pod.openingDelay //How long the pod takes to open after landing data["departureDelay"] = 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["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 POD_STYLES 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["effectStun"] = temp_pod.effectStun //If true, stuns anyone under the pod when it launches until it lands, forcing them to get hit by the pod. Devilish! data["effectLimb"] = temp_pod.effectLimb //If true, pops off a limb (if applicable) from anyone caught under the pod when it lands data["effectOrgans"] = temp_pod.effectOrgans //If true, yeets the organs out of any bodies caught under the pod when it lands @@ -236,6 +237,23 @@ force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.adm temp_pod.desc = descInput temp_pod.adminNamed = TRUE //This variable is checked in the supplypod/setStyle() proc . = TRUE + if("effectShrapnel") //Creates a cloud of shrapnel on landing + if (temp_pod.effectShrapnel == TRUE) //If already doing custom damage, set back to default (no shrapnel) + temp_pod.effectShrapnel = FALSE + return + var/shrapnelInput = input("Projectile Typepath", "Please enter the type of pellet cloud you'd like to create on landing (Can be any projectile!)", 0) in sortList(subtypesof(/obj/projectile), /proc/cmp_typepaths_asc) + if (isnull(shrapnelInput)) + return + var/shrapnelMagnitude = input("Shrapnel Magnitude", "Enter the magnitude of the pellet cloud. This is usually a value around 1-5. Please note that Ryll-Ryll has asked me to tell you that if you go too crazy with the projectiles you might crash the server. So uh, be gentle!", 0) as null|num + if (isnull(shrapnelMagnitude)) + return + if (!isnum(shrapnelMagnitude)) + alert(usr, "That wasn't a number! Value set to 3 instead.") + shrapnelMagnitude = 3 + temp_pod.shrapnel_type = shrapnelInput + temp_pod.shrapnel_magnitude = shrapnelMagnitude + temp_pod.effectShrapnel = TRUE + . = TRUE if("effectStun") //Toggle: Any mob under the pod is stunned (cant move) until the pod lands, hitting them! temp_pod.effectStun = !temp_pod.effectStun . = TRUE diff --git a/code/modules/cargo/supplypod.dm b/code/modules/cargo/supplypod.dm index 147fb99638f..be02785d09d 100644 --- a/code/modules/cargo/supplypod.dm +++ b/code/modules/cargo/supplypod.dm @@ -44,6 +44,9 @@ var/list/explosionSize = list(0,0,2,3) var/stay_after_drop = FALSE var/specialised = TRUE // It's not a general use pod for cargo/admin use + var/effectShrapnel = FALSE + var/shrapnel_type = /obj/projectile/bullet/shrapnel + var/shrapnel_magnitude = 3 /obj/structure/closet/supplypod/bluespacepod style = STYLE_BLUESPACE @@ -350,6 +353,9 @@ /obj/effect/dp_target/proc/endLaunch() pod.update_icon() pod.forceMove(drop_location()) //The fallingPod animation is over, now's a good time to forceMove the actual pod into position + pod.AddComponent(/datum/component/pellet_cloud, projectile_type=pod.shrapnel_type, magnitude=pod.shrapnel_magnitude) + if(pod.effectShrapnel) + SEND_SIGNAL(pod, COMSIG_SUPPLYPOD_LANDED) QDEL_NULL(fallingPod) //Delete the falling pod effect, because at this point its animation is over. We dont use temp_visual because we want to manually delete it as soon as the pod appears for (var/mob/living/M in src) //Remember earlier (initialization) when we moved mobs into the DPTarget so they wouldnt get lost in nullspace? Time to get them out M.forceMove(pod) diff --git a/tgui/packages/tgui/interfaces/CentcomPodLauncher.js b/tgui/packages/tgui/interfaces/CentcomPodLauncher.js index 28ff827f78f..eb73d9b2e3b 100644 --- a/tgui/packages/tgui/interfaces/CentcomPodLauncher.js +++ b/tgui/packages/tgui/interfaces/CentcomPodLauncher.js @@ -147,6 +147,14 @@ export const CentcomPodLauncherContent = (props, context) => { onClick={() => act('damageGib')} /> +