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

Explosives overhaul pt3 #719

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
71 changes: 39 additions & 32 deletions code/datums/ammo/rocket.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
name = "high explosive rocket"
icon_state = "missile"
ping = null //no bounce off.
sound_bounce = "rocket_bounce"
sound_bounce = "rocket_ricochet"
damage_falloff = 0
flags_ammo_behavior = AMMO_EXPLOSIVE|AMMO_ROCKET|AMMO_STRIKES_SURFACE
var/datum/effect_system/smoke_spread/smoke

accuracy = HIT_ACCURACY_TIER_2
accurate_range = 7
max_range = 7
max_range = 11
damage = 15
shell_speed = AMMO_SPEED_TIER_2

Expand All @@ -29,24 +29,24 @@
. = ..()

/datum/ammo/rocket/on_hit_mob(mob/mob, obj/projectile/projectile)
cell_explosion(get_turf(mob), 150, 50, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, projectile.weapon_cause_data)
if(iscarbon(mob)) // Doesn't matter how build-different you are, it's an explosive rocket-propelled projectile hitting you.
mob.ex_act(650, null, projectile.weapon_cause_data, 100)
cell_explosion(get_turf(mob), 250, 40, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, projectile.weapon_cause_data)
smoke.set_up(1, get_turf(mob))
if(ishuman_strict(mob)) // No yautya or synths. Makes humans gib on direct hit.
mob.ex_act(350, null, projectile.weapon_cause_data, 100)
smoke.start()

/datum/ammo/rocket/on_hit_obj(obj/object, obj/projectile/projectile)
cell_explosion(get_turf(object), 150, 50, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, projectile.weapon_cause_data)
cell_explosion(get_turf(object), 250, 40, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, projectile.weapon_cause_data)
smoke.set_up(1, get_turf(object))
smoke.start()

/datum/ammo/rocket/on_hit_turf(turf/turf, obj/projectile/projectile)
cell_explosion(turf, 150, 50, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, projectile.weapon_cause_data)
cell_explosion(turf, 250, 40, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, projectile.weapon_cause_data)
smoke.set_up(1, turf)
smoke.start()

/datum/ammo/rocket/do_at_max_range(obj/projectile/projectile)
cell_explosion(get_turf(projectile), 150, 50, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, projectile.weapon_cause_data)
cell_explosion(get_turf(projectile), 250, 40, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, projectile.weapon_cause_data)
smoke.set_up(1, get_turf(projectile))
smoke.start()

Expand All @@ -57,56 +57,66 @@

accuracy = HIT_ACCURACY_TIER_8
accuracy_var_low = PROJECTILE_VARIANCE_TIER_9
accurate_range = 6
max_range = 6
damage = 10
accurate_range = 9
max_range = 11
damage = 250
shrapnel_chance = 5
shrapnel_type = /obj/item/large_shrapnel/at_rocket_dud
penetration= ARMOR_PENETRATION_TIER_10

var/vehicle_slowdown_time = 2 SECONDS

/datum/ammo/rocket/ap/on_hit_mob(mob/mob, obj/projectile/projectile)
var/turf/turf = get_turf(mob)
mob.ex_act(150, projectile.dir, projectile.weapon_cause_data, 100)
mob.ex_act(400, projectile.dir, projectile.weapon_cause_data, 100)
mob.apply_effect(3, WEAKEN)
mob.apply_effect(3, PARALYZE)
if(ishuman_strict(mob)) // No yautya or synths. Makes humans gib on direct hit.
mob.ex_act(300, null, projectile.weapon_cause_data, 100)
cell_explosion(turf, 100, 50, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, projectile.weapon_cause_data)
if(iscarbon(mob)) // Doesn't matter how build-different you are, it's an explosive rocket-propelled projectile hitting you.
mob.ex_act(650, null, projectile.weapon_cause_data, 100)
cell_explosion(turf, 150, 50, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, projectile.weapon_cause_data)
smoke.set_up(1, turf)
smoke.start()

/datum/ammo/rocket/ap/on_hit_obj(obj/object, obj/projectile/projectile)
var/turf/turf = get_turf(object)
object.ex_act(150, projectile.dir, projectile.weapon_cause_data, 100)
cell_explosion(turf, 100, 50, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, projectile.weapon_cause_data)
smoke.set_up(1, turf)
smoke.start()
if(istype(object, /obj/vehicle/multitile))
var/obj/vehicle/multitile/mob = object
mob.next_move = world.time + vehicle_slowdown_time
playsound(mob, 'sound/effects/meteorimpact.ogg', 35)
mob.at_munition_interior_explosion_effect(cause_data = create_cause_data("Anti-Armor Rocket"))
mob.interior_crash_effect()
mob.ex_act(400, projectile.dir, projectile.weapon_cause_data, 100)
else
var/turf/turf = get_turf(object)
object.ex_act(400, projectile.dir, projectile.weapon_cause_data, 100)
cell_explosion(turf, 150, 50, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, projectile.weapon_cause_data)
smoke.set_up(1, turf)
smoke.start()

/datum/ammo/rocket/ap/on_hit_turf(turf/turf, obj/projectile/projectile)
var/hit_something = 0
for(var/mob/mob in turf)
mob.ex_act(150, projectile.dir, projectile.weapon_cause_data, 100)
mob.ex_act(400, projectile.dir, projectile.weapon_cause_data, 100)
mob.apply_effect(3, WEAKEN)
mob.apply_effect(3, PARALYZE)
hit_something = 1
continue
if(!hit_something)
for(var/obj/object in turf)
if(object.density)
object.ex_act(150, projectile.dir, projectile.weapon_cause_data, 100)
object.ex_act(400, projectile.dir, projectile.weapon_cause_data, 100)
hit_something = 1
continue
if(!hit_something)
turf.ex_act(150, projectile.dir, projectile.weapon_cause_data, 200)

cell_explosion(turf, 100, 50, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, projectile.weapon_cause_data)
cell_explosion(turf, 150, 50, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, projectile.weapon_cause_data)
smoke.set_up(1, turf)
smoke.start()

/datum/ammo/rocket/ap/do_at_max_range(obj/projectile/projectile)
var/turf/turf = get_turf(projectile)
var/hit_something = 0
for(var/mob/mob in turf)
mob.ex_act(150, projectile.dir, projectile.weapon_cause_data, 100)
mob.ex_act(450, projectile.dir, projectile.weapon_cause_data, 100)
mob.apply_effect(3, WEAKEN)
mob.apply_effect(3, PARALYZE)
hit_something = 1
Expand All @@ -119,18 +129,15 @@
break
if(!hit_something)
turf.ex_act(150, projectile.dir, projectile.weapon_cause_data)
cell_explosion(turf, 100, 50, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, projectile.weapon_cause_data)
cell_explosion(turf, 150, 50, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, projectile.weapon_cause_data)
smoke.set_up(1, turf)
smoke.start()

/datum/ammo/rocket/ap/anti_tank
name = "anti-tank rocket"
damage = 1000
damage_var_high = 100
var/vehicle_slowdown_time = 5 SECONDS
shrapnel_chance = 5
shrapnel_type = /obj/item/large_shrapnel/at_rocket_dud
max_range = 22
vehicle_slowdown_time = 5 SECONDS

/datum/ammo/rocket/ap/anti_tank/on_hit_obj(obj/object, obj/projectile/projectile)
if(istype(object, /obj/vehicle/multitile))
Expand Down Expand Up @@ -190,7 +197,7 @@
accuracy_var_low = PROJECTILE_VARIANCE_TIER_6
accurate_range = 8
damage = 90
max_range = 8
max_range = 11

/datum/ammo/rocket/wp/set_bullet_traits()
. = ..()
Expand All @@ -206,7 +213,7 @@
var/datum/reagent/napalm/blue/reagent = new()
new /obj/flamer_fire(turf, cause_data, reagent, 3)

var/datum/effect_system/smoke_spread/phosphorus/landingSmoke = new /datum/effect_system/smoke_spread/phosphorus
var/datum/effect_system/smoke_spread/phosphorus/strong/landingSmoke = new /datum/effect_system/smoke_spread/phosphorus/strong
landingSmoke.set_up(3, 0, turf, null, 6, cause_data)
landingSmoke.start()
landingSmoke = null
Expand Down
25 changes: 19 additions & 6 deletions code/datums/ammo/shrapnel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,35 @@
name = "low velocity canister shot"
icon_state = "buckshot"

accuracy_var_low = PROJECTILE_VARIANCE_TIER_6
accuracy_var_low = PROJECTILE_VARIANCE_TIER_4
accuracy_var_high = PROJECTILE_VARIANCE_TIER_8
damage = 65
penetration = 0
penetration = ARMOR_PENETRATION_TIER_2
shell_speed = AMMO_SPEED_TIER_1
damage_armor_punch = 1
pen_armor_punch = 0
accurate_range = 3
effective_range_max = 3
effective_range_max = 5
damage_falloff = DAMAGE_FALLOFF_TIER_1
max_range = 5
max_range = 7

/datum/ammo/bullet/shrapnel/canister/on_hit_mob(mob/M, obj/projectile/P)
knockback(M, P, 2)
slowdown(M, P)
knockback(M, P, 4)
/datum/ammo/bullet/shrapnel/canister/knockback_effects(mob/living/living_mob, obj/projectile/fired_projectile)
if(iscarbonsizexeno(living_mob))
var/mob/living/carbon/xenomorph/target = living_mob
to_chat(target, SPAN_XENODANGER("You are shaken and slowed by the sudden impact!"))
target.KnockDown(2.5)
target.Stun(2.5)
target.Slow(4)
else
if(!isyautja(living_mob)) //Not predators.
living_mob.KnockDown(3)
living_mob.Stun(3)
living_mob.Slow(5)
to_chat(living_mob, SPAN_HIGHDANGER("The impact knocks you off-balance!"))
living_mob.apply_stamina_damage(fired_projectile.ammo.damage, fired_projectile.def_zone, ARMOR_BULLET)


/datum/ammo/bullet/shrapnel/canister/set_bullet_traits()
. = ..()
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/effects/effect_system/smoke.dm
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
time_to_live = 25
spread_speed = 2
smokeranking = SMOKE_RANK_LOW
color = "#adadad"

/obj/effect/particle_effect/smoke/bad/Move()
. = ..()
Expand Down Expand Up @@ -311,6 +312,7 @@
/obj/effect/particle_effect/smoke/phosphorus
time_to_live = 25
smokeranking = SMOKE_RANK_MED
color = "#dddddd"
var/next_cough = 2 SECONDS
var/burn_damage = 40
var/applied_fire_stacks = 3
Expand Down
70 changes: 45 additions & 25 deletions code/game/objects/items/explosives/grenades/marines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,11 @@
var/fire_resistance = 15 //to prevent highly controlled massive explosions
falloff_mode = EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL_HALF


/obj/item/explosive/grenade/high_explosive/New()
..()

fire_resistance = rand(GRENADE_FIRE_RESISTANCE_MIN, GRENADE_FIRE_RESISTANCE_MAX)



/obj/item/explosive/grenade/high_explosive/prime(mob/living/user)
set waitfor = 0
if(fuse_type == IMPACT_FUSE)
Expand Down Expand Up @@ -148,19 +145,6 @@
antigrief_protection = FALSE
dual_purpose = FALSE

/obj/item/explosive/grenade/high_explosive/tmfrag
name = "\improper M51A BFAB grenade"
desc = "Bounding Fragmentation, Air-Burst. Rather than traditionally detonating on impact, this round propels itself up into the air prior to exploding into a lethal hail of shrapnel a second later. Effective against troops in the open or in foxholes. Not a hand-grenade, as marked by the yellow color-band on its hull, launcher-fired only."
icon_state = "grenade_bfab"
item_state = "grenade_bfab"
hand_throwable = FALSE
dual_purpose = FALSE
det_time = 10
explosion_power = 40
shrapnel_count = 48
shrapnel_type = /datum/ammo/bullet/shrapnel/heavy
falloff_mode = EXPLOSION_FALLOFF_SHAPE_LINEAR

/obj/item/explosive/grenade/high_explosive/m15
name = "\improper M15 fragmentation grenade"
desc = "An outdated USCM Fragmentation Grenade. With decades of service in the USCM, the old M15 Fragmentation Grenade is slowly being replaced by the slightly safer M40-series grenades. It is set to detonate in 4 seconds."
Expand All @@ -175,10 +159,9 @@
arm_sound = 'sound/weapons/pinpull.ogg'
falloff_mode = EXPLOSION_FALLOFF_SHAPE_LINEAR


/*
+//================================================
+ Canister Grenades
+ Canister Grenade
+//================================================
+*/

Expand All @@ -193,9 +176,10 @@
explosion_power = 0
explosion_falloff = 25
det_time = 0 //this should mean that it will explode instantly when fired and thus generate the shotshell effect.
shrapnel_count = 10
shrapnel_count = 18
shrapnel_type = /datum/ammo/bullet/shrapnel/canister
dispersion_angle = 15 //hopefully this means the cone spread is pretty small

/obj/item/explosive/grenade/high_explosive/airburst/canister/proc/canister_fire(mob/living/user, target)
var/direction = Get_Compass_Dir(user, target)
var/position = get_step(user, direction) //otherwise we buckshot ourselves
Expand All @@ -207,7 +191,6 @@
/obj/item/explosive/grenade/high_explosive/airburst/canister/launch_impact(atom/hit_atom)
return


/*
//================================================
Airburst Grenades
Expand Down Expand Up @@ -354,9 +337,10 @@
desc = "This is a 40mm grenade, designed to be launched by a grenade launcher and detonate on impact. This one bears markings of the UPP."
icon_state = "grenade_40mm_upp"
item_state = "grenade_hedp"
explosion_power = 120 //Slightly stronger than HEDP
explosion_power = 180 //Stronger than HEDP to make up for one shot in the tube
explosion_falloff = 40 //But quicker to lose blast damage
falloff_mode = EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL_HALF
shrapnel_count = 16
falloff_mode = EXPLOSION_FALLOFF_SHAPE_LINEAR

/obj/item/explosive/grenade/high_explosive/airburst/buckshot
name = "\improper 40mm Buckshot Shell"
Expand All @@ -370,7 +354,7 @@

/*
//================================================
Impact HEAP Grenades
Impact HEAP Grenade
//================================================
*/

Expand All @@ -384,9 +368,46 @@
shrapnel_count = 0
falloff_mode = EXPLOSION_FALLOFF_SHAPE_LINEAR

/*
+//================================================
+ Bounding Fragmentation Grenade
+//================================================
+*/

/obj/item/explosive/grenade/high_explosive/impact/tmfrag
name = "\improper M51A BFAB grenade"
desc = "Bounding Fragmentation, Air-Burst. Rather than traditionally detonating on impact, this round propels itself up into the air prior to exploding into a lethal hail of shrapnel a second later. Effective against troops in the open or in foxholes. Not a hand-grenade, as marked by the yellow color-band on its hull, launcher-fired only."
icon_state = "grenade_bfab"
item_state = "grenade_bfab"
explosion_power = 40
shrapnel_count = 48
shrapnel_type = /datum/ammo/bullet/shrapnel/heavy
falloff_mode = EXPLOSION_FALLOFF_SHAPE_LINEAR

/obj/item/explosive/grenade/high_explosive/impact/tmfrag/launch_impact(atom/hit_atom)
if(fuse_type != IMPACT_FUSE)
return
var/detonate = TRUE
if(isobj(hit_atom) && !rebounding)
detonate = FALSE
if(isturf(hit_atom) && hit_atom.density && !rebounding)
detonate = FALSE
if(active && detonate) // Active, and we reached our destination.
sleep(2)
qdel(src)
for(var/mob/mob in range(5, hit_atom))
mob.show_message(SPAN_USERDANGER("The grenade flies up into the air before exploding!"), SHOW_MESSAGE_VISIBLE)
sleep(5) //simulating it bounding up into the air before detonating
if(shrapnel_count)
create_shrapnel(hit_atom, shrapnel_count, , ,shrapnel_type, cause_data)
sleep(2) //so that mobs are not knocked down before being hit by shrapnel. shrapnel might also be getting deleted by explosions?
apply_explosion_overlay()
if(explosion_power)
cell_explosion(hit_atom, explosion_power, explosion_falloff, falloff_mode, null, cause_data)

/*
//================================================
Airborne Starshell Grenades
Airborne Starshell Grenade
//================================================
*/

Expand Down Expand Up @@ -496,7 +517,6 @@
playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 35, 1, 4)
..()


/*
//================================================
Airburst Incendiary Grenades
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/storage/boxes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -702,8 +702,8 @@
desc = "A secure box holding 25 M51A Bounding Fragmentation, Air-Burst grenades. Highly explosive, don't store near the flamer fuel."
model_icon = "model_m51a"
type_icon = "bfab"
can_hold = list(/obj/item/explosive/grenade/high_explosive/tmfrag)
grenade_type = /obj/item/explosive/grenade/high_explosive/tmfrag
can_hold = list(/obj/item/explosive/grenade/high_explosive/impact/tmfrag)
grenade_type = /obj/item/explosive/grenade/high_explosive/impact/tmfrag

/obj/item/storage/box/nade_box/heap
name = "\improper M38 HEAP grenade box"
Expand Down
Loading