From 87201198ef631a32f4097807e98dd4de61a39ae9 Mon Sep 17 00:00:00 2001
From: Kyani <65205627+EmeraldCandy@users.noreply.github.com>
Date: Fri, 5 May 2023 15:21:11 -0400
Subject: [PATCH] fixes cherry bombs (#20921)
* fixes cherry bombs
moves prime to AFTER the auto-throw is toggled
added a sleep before the explosion trigger to prevent instant explosions
reafactor'd black powder to explode at its container's location instead of where the black powder's trigger is, to prevent desync between the explosion location and a thrown object
* removed sleep
mistook the desync before as an instant explosion. now that desync was fixed it is shown to not be needed
* Update code/modules/hydroponics/grown/misc_seeds.dm
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
* comments added
* renames location to prime_location
---------
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
---
code/modules/hydroponics/grown/misc_seeds.dm | 2 +-
code/modules/reagents/chemistry/recipes/pyrotechnics.dm | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/code/modules/hydroponics/grown/misc_seeds.dm b/code/modules/hydroponics/grown/misc_seeds.dm
index 2631f20e93a..96cf7450528 100644
--- a/code/modules/hydroponics/grown/misc_seeds.dm
+++ b/code/modules/hydroponics/grown/misc_seeds.dm
@@ -144,10 +144,10 @@
user.visible_message("[user] plucks the stem from [src]!", "You pluck the stem from [src], which begins to hiss loudly!")
message_admins("[user] ([user.key ? user.key : "no key"]) primed a cherry bomb for detonation at [A] ([user.x], [user.y], [user.z]) (JMP)")
log_game("[user] ([user.key ? user.key : "no key"]) primed a cherry bomb for detonation at [A] ([user.x],[user.y],[user.z]).")
- prime()
if(iscarbon(user))
var/mob/living/carbon/C = user
C.throw_mode_on()
+ prime()
/obj/item/reagent_containers/food/snacks/grown/cherry_bomb/deconstruct(disassembled = TRUE)
if(!disassembled)
diff --git a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm
index 07462945e5d..2671ded0ef6 100644
--- a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm
+++ b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm
@@ -166,12 +166,15 @@
do_sparks(2, 1, location)
addtimer(CALLBACK(src, PROC_REF(blackpowder_detonate), holder, location, created_volume), rand(5, 15))
-/datum/chemical_reaction/blackpowder_explosion/proc/blackpowder_detonate(datum/reagents/holder, turf/location, created_volume)
+/datum/chemical_reaction/blackpowder_explosion/proc/blackpowder_detonate(datum/reagents/holder, turf/prime_location, created_volume)
var/ex_severe = round(created_volume / 100)
var/ex_heavy = round(created_volume / 42)
var/ex_light = round(created_volume / 20)
var/ex_flash = round(created_volume / 8)
- explosion(location, ex_severe, ex_heavy,ex_light, ex_flash, 1)
+ if(istype(holder.my_atom)) //ensures the explosion happens at the container, not where its primed at
+ explosion(holder.my_atom.loc, ex_severe, ex_heavy,ex_light, ex_flash, 1)
+ else
+ explosion(prime_location, ex_severe, ex_heavy,ex_light, ex_flash, 1)
// If this black powder is in a decal, remove the decal, because it just exploded
if(istype(holder.my_atom, /obj/effect/decal/cleanable/dirt/blackpowder))
qdel(holder.my_atom)