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

M108 Canister, Redux #192

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 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
25 changes: 25 additions & 0 deletions code/datums/ammo/shrapnel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,31 @@
stamina_damage = 25
shrapnel_chance = 0

/datum/ammo/bullet/shrapnel/canister
name = "low velocity canister shot"
icon_state = "buckshot"

accuracy_var_low = PROJECTILE_VARIANCE_TIER_6
accuracy_var_high = PROJECTILE_VARIANCE_TIER_8
accurate_range = 5
max_range = 8
damage = 25
penetration = 0
shell_speed = AMMO_SPEED_TIER_1
damage_armor_punch = 1
pen_armor_punch = 0

/datum/ammo/bullet/shrapnel/canister/on_hit_mob(mob/M, obj/projectile/P)
knockback(M, P, 4)
slowdown(M, P)

/datum/ammo/bullet/shrapnel/canister/set_bullet_traits()
. = ..()
LAZYADD(traits_to_give, list(
BULLET_TRAIT_ENTRY_ID("turfs", /datum/element/bullet_trait_damage_boost, 6, GLOB.damage_boost_turfs),
BULLET_TRAIT_ENTRY_ID("breaching", /datum/element/bullet_trait_damage_boost, 6, GLOB.damage_boost_breaching),
BULLET_TRAIT_ENTRY_ID("pylons", /datum/element/bullet_trait_damage_boost, 5, GLOB.damage_boost_pylons)
))

/datum/ammo/bullet/shrapnel/hornet_rounds
name = ".22 hornet round"
Expand Down
30 changes: 30 additions & 0 deletions code/game/objects/items/explosives/grenades/marines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,36 @@
shrapnel_count = 56
falloff_mode = EXPLOSION_FALLOFF_SHAPE_LINEAR

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

/obj/item/explosive/grenade/high_explosive/airburst/canister
name = "\improper M108 canister grenade"
desc = "30mm canister grenade, effectively low velocity buckshot. Substantial close combat impact when paired with the 5 round PN pump action grenade launcher. No, you can't set it off with a hammer, moron."
icon_state = "grenade"
item_state = "grenade_hedp"
hand_throwable = FALSE
underslug_launchable = TRUE
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 = 20
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
create_shrapnel(position, min(direct_hit_shrapnel, shrapnel_count), direction , dispersion_angle, shrapnel_type, cause_data, FALSE, 100)
if(shrapnel_count)
create_shrapnel(loc, shrapnel_count, direction, dispersion_angle, shrapnel_type, cause_data, FALSE, 0)
qdel(src)
// canister has no impact explosion.
/obj/item/explosive/grenade/high_explosive/airburst/canister/launch_impact(atom/hit_atom)
return

/*
//================================================
Airburst Grenades
Expand Down
19 changes: 12 additions & 7 deletions code/modules/projectiles/gun_attachables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2795,13 +2795,18 @@ Defined in conflicts.dm of the #defines folder.
msg_admin_attack("[key_name_admin(user)] fired an underslung grenade launcher [ADMIN_JMP_USER(user)]")
log_game("[key_name_admin(user)] used an underslung grenade launcher.")

var/pass_flags = NO_FLAGS
pass_flags |= grenade_pass_flags
G.det_time = min(15, G.det_time)
G.throw_range = max_range
G.activate(user, FALSE)
G.forceMove(get_turf(gun))
G.throw_atom(target, max_range, SPEED_VERY_FAST, user, null, NORMAL_LAUNCH, pass_flags)
// canister nades explode immediately and don't leave the barrel of the weapon.
if(istype(G, /obj/item/explosive/grenade/high_explosive/airburst/canister))
var/obj/item/explosive/grenade/high_explosive/airburst/canister/canister_round = G
canister_round.canister_fire(user, target)
else
var/pass_flags = NO_FLAGS
pass_flags |= grenade_pass_flags
G.det_time = min(15, G.det_time)
G.throw_range = max_range
G.activate(user, FALSE)
G.forceMove(get_turf(gun))
G.throw_atom(target, max_range, SPEED_VERY_FAST, user, null, NORMAL_LAUNCH, pass_flags)
current_rounds--
cocked = FALSE // we have fired so uncock the gun
loaded_grenades.Cut(1,2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,18 @@
msg_admin_attack("[key_name_admin(user)] fired a grenade ([fired.name]) from \a ([name]).")
log_game("[key_name_admin(user)] used a grenade ([name]).")

// canister rounds explode before leaving the barrel of the launcher.
if(istype(fired, /obj/item/explosive/grenade/high_explosive/airburst/canister))
var/obj/item/explosive/grenade/high_explosive/airburst/canister/canister_round = fired
canister_round.canister_fire(user, target)
return

fired.throw_range = 20
fired.det_time = min(10, fired.det_time)
fired.activate(user, FALSE)
fired.forceMove(get_turf(src))
fired.throw_atom(target, 20, SPEED_VERY_FAST, user, null, NORMAL_LAUNCH, pass_flags)



//Doesn't use these. Listed for reference.
/obj/item/weapon/gun/launcher/grenade/load_into_chamber()
return
Expand Down
Loading