Files
CHOMPStation2/code/modules/projectiles/guns/projectile/shotgun.dm
2022-04-10 09:03:20 -06:00

249 lines
9.6 KiB
Plaintext

/*
* Shotgun
*/
// TGMC Ammo HUD Insertion
/obj/item/weapon/gun/projectile/shotgun/has_ammo_counter()
return TRUE
/obj/item/weapon/gun/projectile/shotgun/get_ammo_type()
if(load_method == MAGAZINE)
if(!ammo_magazine)
else if(load_method == SINGLE_CASING|SPEEDLOADER && loaded.len)
else
return list("unknown", "unknown")
/obj/item/weapon/gun/projectile/shotgun/get_ammo_count()
if(load_method == MAGAZINE)
if(!ammo_magazine)
return chambered ? 1 : 0
else
return chambered ? (ammo_magazine.stored_ammo + 1) : ammo_magazine.stored_ammo
else if(load_method == SINGLE_CASING|SPEEDLOADER)
if(chambered)
else
/obj/item/weapon/gun/projectile/shotgun/pump
name = "shotgun"
// desc = "The mass-produced MarsTech Meteor 29 shotgun is a favourite of police and security forces on many worlds. Uses 12g rounds." //CHOMP Disable
desc = "I used the shotgun. You know why? Cause the shotgun doesn't miss, and unlike the shitty hybrid taser it stops \
a criminal in their tracks in two hits. Bang, bang, and they're fucking done. I use four shots just to make damn sure. \
Because, once again, I'm not there to coddle a buncha criminal scum sucking losers, I'm there to 1) Survive the fucking round. \
2) Guard the armory. So you can absolutely get fucked. If I get unbanned, which I won't, you can guarantee I will continue to use \
the shotgun to apprehend criminals. Because it's quick, clean and effective as fuck. Why in the seven hells would I fuck around \
with the disabler shots, which take half a clip just to bring someone down, or with the tazer bolts which are slow as balls, \
impossible to aim and do about next to jack shit, fuck all. The shotgun is the superior law enforcement weapon. Because it stops crime. \
And it stops crime by reducing the number of criminals roaming the fucking halls." //CHOMP Add
description_fluff = "The leading civilian-sector high-quality small arms brand of Hephaestus Industries, \
MarsTech has been the provider of choice for law enforcement and security forces for over 300 years."
icon_state = "shotgun"
item_state = "shotgun"
max_shells = 4
w_class = ITEMSIZE_HUGE //CHOMP Edit.
force = 10
slot_flags = SLOT_BACK
caliber = "12g"
origin_tech = list(TECH_COMBAT = 4, TECH_MATERIAL = 2)
load_method = SINGLE_CASING|SPEEDLOADER
ammo_type = /obj/item/ammo_casing/a12g/beanbag
projectile_type = /obj/item/projectile/bullet/shotgun
handle_casings = HOLD_CASINGS
var/recentpump = 0 //To prevent spammage
var/action_sound = 'sound/weapons/shotgunpump.ogg'
var/empty_sprite = 0 //This is just a dirty var so it doesn't fudge up.
var/pump_animation = "shotgun-pump" //You put the reference to the animation in question here. Frees up namming. Ex: "shotgun_old_pump" or "sniper_cycle"
/obj/item/weapon/gun/projectile/shotgun/pump/consume_next_projectile()
if(chambered)
return chambered.BB
return null
/obj/item/weapon/gun/projectile/shotgun/pump/attack_self(mob/living/user as mob)
if(world.time >= recentpump + 10)
pump(user)
recentpump = world.time
/obj/item/weapon/gun/projectile/shotgun/pump/proc/pump(mob/M as mob)
playsound(src, action_sound, 60, 1)
// We have a shell in the chamber
if(chambered)
if(chambered.caseless)
qdel(chambered) // Delete casing
else
chambered.loc = get_turf(src) // Eject casing
chambered = null
// Load next shell
if(loaded.len)
var/obj/item/ammo_casing/AC = loaded[1] // Load next casing.
loaded -= AC // Remove casing from loaded list.
chambered = AC
if(pump_animation) // This affects all bolt action and shotguns.
flick("[pump_animation]", src) // This plays any pumping
update_icon()
/obj/item/weapon/gun/projectile/shotgun/pump/update_icon()//This adds empty sprite capability for shotguns.
..()
if(!empty_sprite)//Just a dirty check
return
if((loaded.len) || (chambered))
icon_state = "[icon_state]"
else
icon_state = "[icon_state]-empty"
/obj/item/weapon/gun/projectile/shotgun/pump/empty
ammo_type = null
/obj/item/weapon/gun/projectile/shotgun/pump/slug
ammo_type = /obj/item/ammo_casing/a12g
pump_animation = null
/*
* Combat Shotgun
*/
/obj/item/weapon/gun/projectile/shotgun/pump/combat
name = "combat shotgun"
desc = "Built for close quarters combat, the Hephaestus Industries KS-40 is widely regarded as a weapon of choice for repelling boarders. Uses 12g rounds."
description_fluff = "The leading arms producer in the SCG, Hephaestus typically only uses its 'top level' \
branding for its military-grade equipment used by armed forces across human space."
icon_state = "cshotgun"
item_state = "cshotgun"
origin_tech = list(TECH_COMBAT = 5, TECH_MATERIAL = 2)
max_shells = 7 //match the ammo box capacity, also it can hold a round in the chamber anyways, for a total of 8.
ammo_type = /obj/item/ammo_casing/a12g
load_method = SINGLE_CASING|SPEEDLOADER
pump_animation = "cshotgun-pump"
/obj/item/weapon/gun/projectile/shotgun/pump/combat/empty
ammo_type = null
/*
* Double-Barreled Shotgun
*/
/obj/item/weapon/gun/projectile/shotgun/doublebarrel
name = "double-barreled shotgun"
desc = "A truely classic weapon. No need to change what works. Uses 12g rounds."
icon_state = "dshotgun"
item_state = "dshotgun"
//SPEEDLOADER because rapid unloading.
//In principle someone could make a speedloader for it, so it makes sense.
load_method = SINGLE_CASING|SPEEDLOADER
handle_casings = CYCLE_CASINGS
max_shells = 2
w_class = ITEMSIZE_LARGE
force = 10
slot_flags = SLOT_BACK
caliber = "12g"
origin_tech = list(TECH_COMBAT = 3, TECH_MATERIAL = 1)
ammo_type = /obj/item/ammo_casing/a12g/beanbag
// var/unique_reskin CHOMP Remove
var/sawn_off = FALSE
burst_delay = 0
firemodes = list(
list(mode_name="fire one barrel at a time", burst=1),
list(mode_name="fire both barrels at once", burst=2),
)
/obj/item/weapon/gun/projectile/shotgun/doublebarrel/pellet
ammo_type = /obj/item/ammo_casing/a12g/pellet
/obj/item/weapon/gun/projectile/shotgun/doublebarrel/flare
name = "signal shotgun"
desc = "A double-barreled shotgun meant to fire signal flash shells. Uses 12g rounds."
ammo_type = /obj/item/ammo_casing/a12g/flash
/obj/item/weapon/gun/projectile/shotgun/doublebarrel/unload_ammo(user, allow_dump)
..(user, allow_dump=1)
/*CHOMP Remove start
/obj/item/weapon/gun/projectile/shotgun/doublebarrel/verb/rename_gun()
set name = "Name Gun"
set category = "Object"
set desc = "Rename your gun."
var/input = sanitizeSafe(input(usr, "What do you want to name the gun?", ,""), MAX_NAME_LEN)
var/mob/M = usr
if(src && input && !M.stat && in_range(M,src))
name = input
to_chat(M, "You name the gun [input]. Say hello to your new friend.")
return 1
/obj/item/weapon/gun/projectile/shotgun/doublebarrel/verb/reskin_gun()
set name = "Resprite gun"
set category = "Object"
set desc = "Click to choose a sprite for your gun."
var/mob/M = usr
var/list/options = list()
options["Default"] = "dshotgun"
options["Cherry Red"] = "dshotgun_d"
options["Ash"] = "dshotgun_f"
options["Faded Grey"] = "dshotgun_g"
options["Maple"] = "dshotgun_l"
options["Rosewood"] = "dshotgun_p"
options["Olive Green"] = "dshotgun_o"
options["Blued"] = "dshotgun_b"
var/choice = tgui_input_list(M,"Choose your sprite!","Resprite Gun", options)
if(sawn_off)
to_chat(M, "<span class='warning'>The [src] is already shortened and cannot be resprited!</span>")
return
if(src && choice && !M.stat && in_range(M,src))
icon_state = options[choice]
unique_reskin = options[choice]
to_chat(M, "Your gun is now sprited as [choice]. Say hello to your new friend.")
return 1
*/ //CHOMP Remove end
//this is largely hacky and bad :( -Pete //less hacky and bad now :) -Ghost
/obj/item/weapon/gun/projectile/shotgun/doublebarrel/attackby(var/obj/item/A as obj, mob/user as mob)
if(sawn_off)
to_chat(user, "<span class='warning'>The [src] is already shortened!</span>")
return
if(istype(A, /obj/item/weapon/surgical/circular_saw) || istype(A, /obj/item/weapon/melee/energy) || istype(A, /obj/item/weapon/pickaxe/plasmacutter))
to_chat(user, "<span class='notice'>You begin to shorten the barrel of \the [src].</span>")
if(loaded.len)
var/burstsetting = burst
burst = 2
user.visible_message("<span class='danger'>The shotgun goes off!</span>", "<span class='danger'>The shotgun goes off in your face!</span>")
Fire_userless(user)
burst = burstsetting
return
if(do_after(user, 30)) // SHIT IS STEALTHY EYYYYY
if(sawn_off)
return
// if(unique_reskin) //CHOMP Remove
// icon_state = "[unique_reskin]_sawn" //CHOMP Remove
// else //CHOMP Remove
// icon_state = "dshotgun_sawn" //CHOMP Remove
item_state = "sawnshotgun"
w_class = ITEMSIZE_NORMAL
force = 5
slot_flags &= ~SLOT_BACK // you can't sling it on your back
slot_flags |= (SLOT_BELT|SLOT_HOLSTER) // but you can wear it on your belt (poorly concealed under a trenchcoat, ideally) - or in a holster, why not.
name = "sawn-off shotgun"
desc = "Omar's coming!"
to_chat(user, "<span class='warning'>You shorten the barrel of \the [src]!</span>")
sawn_off = TRUE
else
..()
/*
* Sawn-Off Shotgun
*/
/obj/item/weapon/gun/projectile/shotgun/doublebarrel/sawn
name = "sawn-off shotgun"
desc = "Omar's coming!" // I'm not gonna add "Uses 12g rounds." to this one. I'll just let this reference go undisturbed.
icon_state = "dshotgun_sawn"
item_state = "sawnshotgun"
slot_flags = SLOT_BELT|SLOT_HOLSTER
ammo_type = /obj/item/ammo_casing/a12g/pellet
w_class = ITEMSIZE_NORMAL
force = 5
sawn_off = TRUE