Skip to content

Commit

Permalink
Fixes CAS killing players with ammo crates instead of bullets (#5205)
Browse files Browse the repository at this point in the history
# About the pull request

Fixes #3211 by making GAU-21 and Laser Cannon ammo pass the weapon to
its `cause_data` rather than the ammo crate/battery.

# Explain why it's good for the game

The dropship is meant to be firing the ammunition inside the crate, not
the crate itself. (Although that is fun to imagine)

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

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

</details>


# Changelog
:cl:
fix: Fixed the death message from GAU-21 and Laser Cannon strikes saying
that the player was killed by the ammo crate.
/:cl:
  • Loading branch information
SabreML authored Dec 26, 2023
1 parent baa01eb commit ca3d9c8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
39 changes: 17 additions & 22 deletions code/modules/cm_marines/dropship_ammo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
var/fire_mission_delay = 4
/// Time to impact in deciseconds
var/travelling_time = 100
/// Type of equipment that accept this type of ammo.
var/equipment_type
/// Type of dropship equipment that accepts this type of ammo.
var/obj/structure/dropship_equipment/equipment_type
/// Ammunition count remaining
var/ammo_count
/// Maximal ammunition count
Expand Down Expand Up @@ -84,7 +84,7 @@
/obj/structure/ship_ammo/proc/show_loaded_desc(mob/user)
return "It's loaded with \a [src]."

/obj/structure/ship_ammo/proc/detonate_on(turf/impact)
/obj/structure/ship_ammo/proc/detonate_on(turf/impact, obj/structure/dropship_equipment/weapon/fired_from)
return

/obj/structure/ship_ammo/proc/can_fire_at(turf/impact, mob/user)
Expand Down Expand Up @@ -159,7 +159,7 @@
else
return "It's loaded with an empty [name]."

/obj/structure/ship_ammo/heavygun/detonate_on(turf/impact)
/obj/structure/ship_ammo/heavygun/detonate_on(turf/impact, obj/structure/dropship_equipment/weapon/fired_from)
set waitfor = 0
var/list/turf_list = list()
for(var/turf/T in range(bullet_spread_range, impact))
Expand All @@ -171,7 +171,7 @@
sleep(1)
for(var/j in 1 to 2) //rather than halving the sleep, were doubling the bullets shot "bang"
var/turf/impact_tile = pick(turf_list)
var/datum/cause_data/cause_data = create_cause_data(initial(name), source_mob)
var/datum/cause_data/cause_data = create_cause_data(fired_from.name, source_mob)
impact_tile.ex_act(EXPLOSION_THRESHOLD_VLOW, pick(GLOB.alldirs), cause_data)
create_shrapnel(impact_tile,1,0,0,shrapnel_type,cause_data,FALSE,100) //simulates a bullet
for(var/atom/movable/explosion_effect in impact_tile)
Expand Down Expand Up @@ -242,7 +242,7 @@
return "It's loaded with an empty [name]."


/obj/structure/ship_ammo/laser_battery/detonate_on(turf/impact)
/obj/structure/ship_ammo/laser_battery/detonate_on(turf/impact, obj/structure/dropship_equipment/weapon/fired_from)
set waitfor = 0
var/list/turf_list = list()
for(var/turf/T in range(impact, 3)) //This is its area of effect
Expand All @@ -251,17 +251,12 @@
for(var/i=1 to 16) //This is how many tiles within that area of effect will be randomly ignited
var/turf/U = pick(turf_list)
turf_list -= U
laser_burn(U)
fire_spread_recur(impact, create_cause_data(fired_from.name, source_mob), 1, null, 5, 75, "#EE6515")//Very, very intense, but goes out very quick

if(!ammo_count && !QDELETED(src))
qdel(src) //deleted after last laser beam is fired and impact the ground.



/obj/structure/ship_ammo/laser_battery/proc/laser_burn(turf/T)
fire_spread_recur(T, create_cause_data(initial(name), source_mob), 1, null, 5, 75, "#EE6515")//Very, very intense, but goes out very quick


//Rockets

/obj/structure/ship_ammo/rocket
Expand All @@ -279,7 +274,7 @@
max_inaccuracy = 5
point_cost = 0

/obj/structure/ship_ammo/rocket/detonate_on(turf/impact)
/obj/structure/ship_ammo/rocket/detonate_on(turf/impact, obj/structure/dropship_equipment/weapon/fired_from)
qdel(src)


Expand All @@ -293,7 +288,7 @@
point_cost = 300
fire_mission_delay = 4 //We don't care because our ammo has just 1 rocket

/obj/structure/ship_ammo/rocket/widowmaker/detonate_on(turf/impact)
/obj/structure/ship_ammo/rocket/widowmaker/detonate_on(turf/impact, obj/structure/dropship_equipment/weapon/fired_from)
impact.ceiling_debris_check(3)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cell_explosion), impact, 300, 40, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, create_cause_data(initial(name)), source_mob), 0.5 SECONDS) //Your standard HE splash damage rocket. Good damage, good range, good speed, it's an all rounder
QDEL_IN(src, 0.5 SECONDS)
Expand All @@ -306,7 +301,7 @@
point_cost = 300
fire_mission_delay = 4 //We don't care because our ammo has just 1 rocket

/obj/structure/ship_ammo/rocket/banshee/detonate_on(turf/impact)
/obj/structure/ship_ammo/rocket/banshee/detonate_on(turf/impact, obj/structure/dropship_equipment/weapon/fired_from)
impact.ceiling_debris_check(3)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cell_explosion), impact, 175, 20, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, create_cause_data(initial(name)), source_mob), 0.5 SECONDS) //Small explosive power with a small fall off for a big explosion range
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(fire_spread), impact, create_cause_data(initial(name), source_mob), 4, 15, 50, "#00b8ff"), 0.5 SECONDS) //Very intense but the fire doesn't last very long
Expand All @@ -321,7 +316,7 @@
point_cost = 300
fire_mission_delay = 4 //We don't care because our ammo has just 1 rocket

/obj/structure/ship_ammo/rocket/keeper/detonate_on(turf/impact)
/obj/structure/ship_ammo/rocket/keeper/detonate_on(turf/impact, obj/structure/dropship_equipment/weapon/fired_from)
impact.ceiling_debris_check(3)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cell_explosion), impact, 450, 100, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, create_cause_data(initial(name)), source_mob), 0.5 SECONDS) //Insane fall off combined with insane damage makes the Keeper useful for single targets, but very bad against multiple.
QDEL_IN(src, 0.5 SECONDS)
Expand All @@ -336,7 +331,7 @@
fire_mission_delay = 4

//Looks kinda OP but all it can actually do is just to blow windows and some of other things out, cant do much damage.
/obj/structure/ship_ammo/rocket/harpoon/detonate_on(turf/impact)
/obj/structure/ship_ammo/rocket/harpoon/detonate_on(turf/impact, obj/structure/dropship_equipment/weapon/fired_from)
impact.ceiling_debris_check(3)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cell_explosion), impact, 150, 16, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, create_cause_data(initial(name)), source_mob), 0.5 SECONDS)
QDEL_IN(src, 0.5 SECONDS)
Expand All @@ -349,7 +344,7 @@
point_cost = 500
fire_mission_delay = 0 //0 means unusable

/obj/structure/ship_ammo/rocket/napalm/detonate_on(turf/impact)
/obj/structure/ship_ammo/rocket/napalm/detonate_on(turf/impact, obj/structure/dropship_equipment/weapon/fired_from)
impact.ceiling_debris_check(3)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cell_explosion), impact, 200, 25, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, create_cause_data(initial(name)), source_mob), 0.5 SECONDS)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(fire_spread), impact, create_cause_data(initial(name), source_mob), 6, 60, 30, "#EE6515"), 0.5 SECONDS) //Color changed into napalm's color to better convey how intense the fire actually is.
Expand All @@ -364,7 +359,7 @@
point_cost = 300
fire_mission_delay = 4

/obj/structure/ship_ammo/rocket/thermobaric/detonate_on(turf/impact)
/obj/structure/ship_ammo/rocket/thermobaric/detonate_on(turf/impact, obj/structure/dropship_equipment/weapon/fired_from)
impact.ceiling_debris_check(3)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(fire_spread), impact, create_cause_data(initial(name), source_mob), 4, 25, 50, "#c96500"), 0.5 SECONDS) //Very intense but the fire doesn't last very long
for(var/mob/living/carbon/victim in orange(5, impact))
Expand All @@ -388,7 +383,7 @@
point_cost = 300
fire_mission_delay = 3 //high cooldown

/obj/structure/ship_ammo/minirocket/detonate_on(turf/impact)
/obj/structure/ship_ammo/minirocket/detonate_on(turf/impact, obj/structure/dropship_equipment/weapon/fired_from)
impact.ceiling_debris_check(2)
spawn(5)
cell_explosion(impact, 200, 44, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, create_cause_data(initial(name), source_mob))
Expand Down Expand Up @@ -418,7 +413,7 @@
point_cost = 500
fire_mission_delay = 3 //high cooldown

/obj/structure/ship_ammo/minirocket/incendiary/detonate_on(turf/impact)
/obj/structure/ship_ammo/minirocket/incendiary/detonate_on(turf/impact, obj/structure/dropship_equipment/weapon/fired_from)
..()
spawn(5)
fire_spread(impact, create_cause_data(initial(name), source_mob), 3, 25, 20, "#EE6515")
Expand All @@ -438,7 +433,7 @@
/// Special structures it needs to break with drop pod
var/list/breakeable_structures = list(/obj/structure/barricade, /obj/structure/surface/table)

/obj/structure/ship_ammo/sentry/detonate_on(turf/impact)
/obj/structure/ship_ammo/sentry/detonate_on(turf/impact, obj/structure/dropship_equipment/weapon/fired_from)
var/obj/structure/droppod/equipment/sentry/droppod = new(impact, /obj/structure/machinery/defenses/sentry/launchable, source_mob)
droppod.special_structures_to_damage = breakeable_structures
droppod.special_structure_damage = 500
Expand Down
6 changes: 3 additions & 3 deletions code/modules/cm_marines/dropship_equipment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@
new /obj/effect/overlay/temp/blinking_laser (impact)
sleep(10)
SA.source_mob = user
SA.detonate_on(impact)
SA.detonate_on(impact, src)

/obj/structure/dropship_equipment/weapon/proc/open_fire_firemission(obj/selected_target, mob/user = usr)
set waitfor = 0
Expand All @@ -727,7 +727,7 @@
var/turf/impact = pick(possible_turfs)
sleep(3)
SA.source_mob = user
SA.detonate_on(impact)
SA.detonate_on(impact, src)

/obj/structure/dropship_equipment/weapon/heavygun
name = "\improper GAU-21 30mm cannon"
Expand Down Expand Up @@ -1432,4 +1432,4 @@
var/turf/impact = pick(possible_turfs)
sleep(3)
SA.source_mob = user
SA.detonate_on(impact)
SA.detonate_on(impact, src)

0 comments on commit ca3d9c8

Please sign in to comment.