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

super speshul m4ra #89

Merged
merged 21 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
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
20 changes: 20 additions & 0 deletions code/datums/ammo/bullet/rifle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,26 @@
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)


// PvE M4RA rounds - pens&does toxin to whomever gets hit by it
/datum/ammo/bullet/rifle/m4ra/du
name = "depleted uranium bullet"

damage = 60
penetration = ARMOR_PENETRATION_TIER_10
var/acid_per_hit = 15 //woe, toxin upon ye

/datum/ammo/bullet/rifle/m4ra/du/set_bullet_traits()
. = ..()
LAZYADD(traits_to_give, list(
BULLET_TRAIT_ENTRY(/datum/element/bullet_trait_penetrating)
))

/datum/ammo/bullet/rifle/m4ra/du/on_hit_mob(mob/target, obj/projectile/fired_proj)
target.AddComponent(/datum/component/toxic_buildup, acid_per_hit)
knockback(target, fired_proj, max_range = 2)


/datum/ammo/bullet/rifle/mar40
name = "heavy rifle bullet"

Expand Down
25 changes: 16 additions & 9 deletions code/modules/projectiles/gun_attachables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,11 @@ Defined in conflicts.dm of the #defines folder.
// Apply bullet traits from attachment to gun's current projectile
G.in_chamber.apply_bullet_trait(L)

/obj/item/attachable/proc/Detach(mob/user, obj/item/weapon/gun/detaching_gub)
/obj/item/attachable/proc/Detach(mob/user, obj/item/weapon/gun/detaching_gub, drop_attachment = TRUE)
if(!istype(detaching_gub)) return //Guns only

detaching_gub.on_detach(user)
if(user)
detaching_gub.on_detach(user, src)

if(flags_attach_features & ATTACH_ACTIVATION)
activate_attachment(detaching_gub, null, TRUE)
Expand All @@ -182,7 +183,8 @@ Defined in conflicts.dm of the #defines folder.
qdel(X)
break

forceMove(get_turf(detaching_gub))
if(drop_attachment)
forceMove(get_turf(detaching_gub))

if(sharp)
detaching_gub.sharp = 0
Expand Down Expand Up @@ -556,7 +558,7 @@ Defined in conflicts.dm of the #defines folder.
..()
G.attachable_offset["muzzle_x"] = 27

/obj/item/attachable/mateba/Detach(mob/user, obj/item/weapon/gun/detaching_gub)
/obj/item/attachable/mateba/Detach(mob/user, obj/item/weapon/gun/detaching_gub, drop_attachment = TRUE)
..()
detaching_gub.attachable_offset["muzzle_x"] = 20

Expand Down Expand Up @@ -847,7 +849,7 @@ Defined in conflicts.dm of the #defines folder.
. = ..()
G.AddElement(/datum/element/drop_retrieval/gun, retrieval_slot)

/obj/item/attachable/magnetic_harness/Detach(mob/user, obj/item/weapon/gun/detaching_gub)
/obj/item/attachable/magnetic_harness/Detach(mob/user, obj/item/weapon/gun/detaching_gub, drop_attachment = TRUE)
. = ..()
detaching_gub.RemoveElement(/datum/element/drop_retrieval/gun, retrieval_slot)

Expand All @@ -871,7 +873,7 @@ Defined in conflicts.dm of the #defines folder.
G.attachable_offset["under_y"] = 12


/obj/item/attachable/magnetic_harness/lever_sling/Detach(mob/user, obj/item/weapon/gun/detaching_gub)
/obj/item/attachable/magnetic_harness/lever_sling/Detach(mob/user, obj/item/weapon/gun/detaching_gub, drop_attachment = TRUE)
. = ..()
detaching_gub.attachable_offset["under_x"] = 24
detaching_gub.attachable_offset["under_y"] = 16
Expand Down Expand Up @@ -923,7 +925,7 @@ Defined in conflicts.dm of the #defines folder.
. = ..()
RegisterSignal(gun, COMSIG_GUN_RECALCULATE_ATTACHMENT_BONUSES, PROC_REF(handle_attachment_recalc))

/obj/item/attachable/scope/Detach(mob/user, obj/item/weapon/gun/detaching_gub)
/obj/item/attachable/scope/Detach(mob/user, obj/item/weapon/gun/detaching_gub, drop_attachment = TRUE)
. = ..()
UnregisterSignal(detaching_gub, COMSIG_GUN_RECALCULATE_ATTACHMENT_BONUSES)

Expand Down Expand Up @@ -2228,6 +2230,11 @@ Defined in conflicts.dm of the #defines folder.
if("classic")
attach_icon = new_attach_icon ? new_attach_icon : "c_" + attach_icon

/obj/item/attachable/m4ra_barrel/pve
name = "M4RA-R2 muzzle break"
icon_state = "pve_m4ra_barrel"
attach_icon = "pve_m4ra_barrel"

/obj/item/attachable/upp_rpg_breech
name = "HJRA-12 Breech"
desc = "This isn't supposed to be seperated from the gun, how'd this happen?"
Expand Down Expand Up @@ -2533,7 +2540,7 @@ Defined in conflicts.dm of the #defines folder.
R.flags_equip_slot &= ~SLOT_WAIST //Can't wear it on the belt slot with stock on when we attach it first time.

// When taking it off we want to undo everything not statwise
/obj/item/attachable/stock/revolver/Detach(mob/user, obj/item/weapon/gun/detaching_gub)
/obj/item/attachable/stock/revolver/Detach(mob/user, obj/item/weapon/gun/detaching_gub, drop_attachment = TRUE)
..()
var/obj/item/weapon/gun/revolver/m44/R = detaching_gub
if(!istype(R))
Expand Down Expand Up @@ -3260,7 +3267,7 @@ Defined in conflicts.dm of the #defines folder.

RegisterSignal(G, COMSIG_ITEM_DROPPED, PROC_REF(handle_drop))

/obj/item/attachable/bipod/Detach(mob/user, obj/item/weapon/gun/detaching_gub)
/obj/item/attachable/bipod/Detach(mob/user, obj/item/weapon/gun/detaching_gub, drop_attachment = TRUE)
UnregisterSignal(detaching_gub, COMSIG_ITEM_DROPPED)

if(bipod_deployed)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/gun_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ DEFINES in setup.dm, referenced here.
playsound(user, 'sound/handling/attachment_add.ogg', 15, 1, 4)
return TRUE

/obj/item/weapon/gun/proc/on_detach(obj/item/attachable/attachment)
/obj/item/weapon/gun/proc/on_detach(mob/user, obj/item/attachable/attachment)
return

/obj/item/weapon/gun/proc/update_attachables() //Updates everything. You generally don't need to use this.
Expand Down
61 changes: 61 additions & 0 deletions code/modules/projectiles/guns/rifles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1587,6 +1587,67 @@
/obj/item/weapon/gun/rifle/m4ra/training
current_mag = /obj/item/ammo_magazine/rifle/m4ra/rubber

// pve - kinda weird icon usage, uses urban M4RA sprite w/ custom attachie sprite
/obj/item/weapon/gun/rifle/m4ra/pve
name = "\improper M4RA-R2 battle rifle"
desc = "The M4RA-R2 is a souped-up M4RA, the result of an ARMAT upgrade program that didn't pan out in huge numbers. Its main attraction is the ability to chamber and fire devastating <b>A19 depleted uranium rounds,</b> infamous for their overpenetration abilities and toxic effects on anyone unfortunate enough to survive a hit. The thicker barrel, of course, also has no issue with non-HV ammo."
desc_lore = "The USCMC was not terribly enthusiastic about unproven hand-held plasma weaponry. Before the XM99A was eventually adopted into use, the USCMC instead sought out a traditional squad-portable, precision, armor-piercing weapon, and contracted ARMAT to upgrade their M4RA platform to be capable of firing advanced AP rounds. They succeeded- sort of. <BR> <BR> The R2 was rejected for several reasons. It's a killer, but also a piece of junk. It kicks hard enough that precision sights simply don't stay zeroed, and its oversized muzzle-device extends an already long barrel-length. Additionally, A19 ammo, already expensive, was driven to absurd highs by the ammunition's specs. Depleted uranium is expensive...and cutting the service life of the M4RA's barrel in half is even more expensive. <BR> <BR> Those that were made, however, are still service-ready and were issued where the XM99A was unavailable due to its production only just starting."
icon = 'icons/obj/items/weapons/guns/guns_by_map/urban/guns_obj.dmi'
icon_state = "m4ra"
item_state = "m4ra"
fire_sound = 'sound/weapons/gun_m4ra.ogg'
reload_sound = 'sound/weapons/handling/l42_reload.ogg'
unload_sound = 'sound/weapons/handling/l42_unload.ogg'

current_mag = /obj/item/ammo_magazine/rifle/m4ra/pve
attachable_allowed = list(
/obj/item/attachable/reddot,
/obj/item/attachable/reflex,
/obj/item/attachable/flashlight,
/obj/item/attachable/extended_barrel,
/obj/item/attachable/magnetic_harness,
/obj/item/attachable/bipod,
/obj/item/attachable/verticalgrip,
/obj/item/attachable/angledgrip,
/obj/item/attachable/lasersight,
/obj/item/attachable/scope,
/obj/item/attachable/scope/mini,
/obj/item/attachable/scope/mini_iff,
/obj/item/attachable/flashlight/grip,
)

flags_gun_features = GUN_AUTO_EJECTOR|GUN_CAN_POINTBLANK|GUN_AMMO_COUNTER
wield_delay = WIELD_DELAY_VERY_FAST
aim_slowdown = SLOWDOWN_ADS_QUICK
map_specific_decoration = FALSE

/obj/item/weapon/gun/rifle/m4ra/pve/set_gun_config_values()
..()
set_fire_delay(FIRE_DELAY_TIER_4)
recoil_unwielded = RECOIL_AMOUNT_TIER_1
recoil = RECOIL_AMOUNT_TIER_3


// obnoxiously enough, need to do this manually...
item_icons = list(
WEAR_L_HAND = 'icons/obj/items/weapons/guns/guns_by_map/urban/guns_lefthand.dmi',
WEAR_R_HAND = 'icons/obj/items/weapons/guns/guns_by_map/urban/guns_righthand.dmi',
WEAR_BACK = 'icons/obj/items/weapons/guns/guns_by_map/urban/back.dmi'
)

/obj/item/weapon/gun/rifle/m4ra/pve/handle_starting_attachment()
..()
var/obj/item/attachable/m4ra_barrel/pve/integrated = new(src)
integrated.flags_attach_features &= ~ATTACH_REMOVABLE
var/obj/item/attachable/old_barrel = attachments[integrated.slot]
if(old_barrel)
old_barrel.Detach(detaching_gub = src, drop_attachment = FALSE)
qdel(old_barrel)
integrated.Attach(src)
update_attachable(integrated.slot)



//-------------------------------------------------------

//L42A Battle Rifle
Expand Down
9 changes: 9 additions & 0 deletions code/modules/projectiles/magazines/rifles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,15 @@
default_ammo = /datum/ammo/bullet/rifle/incendiary
ammo_band_color = AMMO_BAND_COLOR_INCENDIARY

/obj/item/ammo_magazine/rifle/m4ra/pve
name = "\improper M4RA depleted uranium magazine (10x24mm)"
desc = "A magazine of wall-penetrating, body-penetrating, toxic 10x24mm rounds for use in the M4RA-R2 battle rifle."
icon_state = "m4ra"
default_ammo = /datum/ammo/bullet/rifle/m4ra/du
max_rounds = 25
gun_type = /obj/item/weapon/gun/rifle/m4ra/pve
ammo_band_color = AMMO_BAND_COLOR_TOXIN

//-------------------------------------------------------
//XM40 AKA SOF RIFLE FROM HELL (It's an EM-2, a prototype of the real world L85A1 way back from the 1940s. We've given it a blue plastic shell and an integral suppressor)
/obj/item/ammo_magazine/rifle/xm40
Expand Down
Binary file modified icons/obj/items/weapons/guns/attachments/barrel.dmi
Binary file not shown.
Loading
Loading