Skip to content

Commit

Permalink
Cooked mortar shell explosion is now fixed (#6638)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->

# About the pull request
Fixed as in static, doesn't change for different mortar shell types
Makes the explosion when setting mortar shells on fire fixed and small
<!-- Remove this text and explain what the purpose of your PR is.

Mention if you have tested your changes. If you changed a map, make sure
you used the mapmerge tool.
If this is an Issue Correction, you can type "Fixes Issue #169420" to
link the PR to the corresponding Issue number #169420.

Remember: something that is self-evident to you might not be to others.
Explain your rationale fully, even if you feel it goes without saying.
-->

# Explain why it's good for the game
This was supposed to be a niche feature like ammo boxes exploding and
instead it is being used to blow up inside pylons \ caves or even on
shipside. This is why we can't have nice things.
<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding, and may discourage maintainers from reviewing or merging
your PR. This section is not strictly required for (non-controversial)
fix PRs or backend PRs. -->


# Testing Photographs and Procedure
<!-- Include any screenshots/videos/debugging steps of the modified code
functioning successfully, ideally including edge cases. -->

<!-- !! If you are modifying sprites, you **must** include one or more
in-game screenshots or videos of the new sprites. !! -->

<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
label your changes in the changelog. Please note that maintainers freely
reserve the right to remove and add tags should they deem it
appropriate. You can attempt to finagle the system all you want, but
it's best to shoot for clear communication right off the bat. -->
<!-- If you add a name after the ':cl', that name will be used in the
changelog. You must add your CKEY after the CL if your GitHub name
doesn't match. Maintainers freely reserve the right to remove and add
tags should they deem it appropriate. -->

:cl:
del: Mortar shells no longer blow up their payload, instead they will
create a small fixed explosion.
/:cl:

<!-- Both :cl:'s are required for the changelog to work! -->
  • Loading branch information
Git-Nivrak committed Jul 15, 2024
1 parent 90a6fdd commit 534e1b4
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions code/modules/cm_marines/equipment/mortar/mortar_shells.dm
Original file line number Diff line number Diff line change
Expand Up @@ -167,23 +167,43 @@
return ..()

/obj/item/mortar_shell/flamer_fire_act(dam, datum/cause_data/flame_cause_data)
addtimer(VARSET_CALLBACK(src, burning, FALSE), 5 SECONDS, TIMER_UNIQUE|TIMER_OVERRIDE|TIMER_DELETE_ME)

if(burning)
return
burning = TRUE
cause_data = create_cause_data("Burning Mortar Shell", flame_cause_data.resolve_mob(), src)
handle_fire()
handle_fire(cause_data)

/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
/obj/item/mortar_shell/proc/can_explode()
return TRUE

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)
/obj/item/mortar_shell/custom/can_explode()
for(var/obj/item/reagent_container/glass/container in warhead?.containers)
for(var/datum/reagent/reagent in container?.reagents?.reagent_list)
if(reagent.explosive)
return TRUE

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

/obj/item/mortar_shell/flare/can_explode()
return FALSE

/obj/item/mortar_shell/proc/handle_fire(cause_data)
if(can_explode())
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(explode), cause_data), 5 SECONDS)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(qdel), (src)), 5.5 SECONDS)


/obj/item/mortar_shell/proc/explode(flame_cause_data)
cell_explosion(src, 100, 25, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, flame_cause_data)

/obj/structure/closet/crate/secure/mortar_ammo
name = "\improper M402 mortar ammo crate"
Expand Down

0 comments on commit 534e1b4

Please sign in to comment.