Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mortar shells will now cook off and explode when flamed #6243

Merged
merged 7 commits into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions code/modules/cm_marines/equipment/mortar/mortar_shells.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
var/datum/cause_data/cause_data
ground_offset_x = 7
ground_offset_y = 6
/// is it currently on fire and about to explode?
var/burning = FALSE


/obj/item/mortar_shell/Destroy()
Expand Down Expand Up @@ -154,6 +156,35 @@
icon_state = initial(icon_state) +"_unlocked"
playsound(loc, 'sound/items/Screwdriver2.ogg', 25, 0, 6)

/obj/item/mortar_shell/ex_act(severity, explosion_direction)
if(!burning)
return ..()

/obj/item/mortar_shell/attack_hand(mob/user)
if(burning)
to_chat(user, SPAN_DANGER("[src] is on fire and might explode!"))
return
return ..()

/obj/item/mortar_shell/flamer_fire_act(dam, datum/cause_data/flame_cause_data)
if(burning)
return
burning = TRUE
cause_data = create_cause_data("Burning Mortar Shell", flame_cause_data.resolve_mob(), src)
handle_fire()

/obj/item/mortar_shell/proc/handle_fire()
visible_message(SPAN_WARNING("[src] catches on fire and starts cooking off! It's gonna blow!"))
anchored = TRUE // don't want other explosions launching it elsewhere

var/datum/effect_system/spark_spread/sparks = new()
sparks.set_up(n = 10, loca = loc)
sparks.start()
new /obj/effect/warning/explosive(loc, 5 SECONDS)

addtimer(CALLBACK(src, PROC_REF(detonate), loc), 5 SECONDS)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(qdel), (src)), 5.5 SECONDS)

/obj/structure/closet/crate/secure/mortar_ammo
name = "\improper M402 mortar ammo crate"
desc = "A crate containing live mortar shells with various payloads. DO NOT DROP. KEEP AWAY FROM FIRE SOURCES."
Expand Down
Loading