Files
Polaris/code/modules/projectiles/guns/projectile/shotgun.dm
2015-02-10 20:25:41 -05:00

97 lines
3.3 KiB
Plaintext

/obj/item/weapon/gun/projectile/shotgun/pump
name = "shotgun"
desc = "Useful for sweeping alleys."
icon_state = "shotgun"
item_state = "shotgun"
max_shells = 4
w_class = 4.0
force = 10
flags = CONDUCT
slot_flags = SLOT_BACK
caliber = "shotgun"
origin_tech = "combat=4;materials=2"
load_method = SINGLE_CASING
ammo_type = /obj/item/ammo_casing/shotgun/pellet
var/recentpump = 0 // to prevent spammage
var/pumped = 0
var/obj/item/ammo_casing/current_shell = null
/obj/item/weapon/gun/projectile/shotgun/pump/load_into_chamber()
if(in_chamber)
return 1
return 0
/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/getAmmo()
. = ..()
if(current_shell) .++
/obj/item/weapon/gun/projectile/shotgun/pump/proc/pump(mob/M as mob)
playsound(M, 'sound/weapons/shotgunpump.ogg', 60, 1)
pumped = 0
if(current_shell)//We have a shell in the chamber
current_shell.loc = get_turf(src)//Eject casing
current_shell = null
if(in_chamber)
in_chamber = null
if(!loaded.len) return 0
var/obj/item/ammo_casing/AC = loaded[1] //load next casing.
loaded -= AC //Remove casing from loaded list.
current_shell = AC
if(AC.BB)
in_chamber = AC.BB //Load projectile into chamber.
update_icon() //I.E. fix the desc
return 1
/obj/item/weapon/gun/projectile/shotgun/pump/combat
name = "combat shotgun"
icon_state = "cshotgun"
origin_tech = "combat=5;materials=2"
max_shells = 8
ammo_type = /obj/item/ammo_casing/shotgun
/obj/item/weapon/gun/projectile/shotgun/doublebarrel
name = "double-barreled shotgun"
desc = "A true classic."
icon_state = "dshotgun"
item_state = "shotgun"
//SPEEDLOADER because rapid unloading.
//In principle someone could make a speedloader for it, so it makes sense.
load_method = SINGLE_CASING|SPEEDLOADER
eject_casings = 0
max_shells = 2
w_class = 4
force = 10
flags = CONDUCT
slot_flags = SLOT_BACK
caliber = "shotgun"
origin_tech = "combat=3;materials=1"
ammo_type = /obj/item/ammo_casing/shotgun/beanbag
//this is largely hacky and bad :( -Pete
/obj/item/weapon/gun/projectile/shotgun/doublebarrel/attackby(var/obj/item/A as obj, mob/user as mob)
if(istype(A, /obj/item/weapon/circular_saw) || istype(A, /obj/item/weapon/melee/energy) || istype(A, /obj/item/weapon/pickaxe/plasmacutter))
user << "<span class='notice'>You begin to shorten the barrel of \the [src].</span>"
if(loaded.len)
for(var/i in 1 to max_shells)
afterattack(user, user) //will this work? //it will. we call it twice, for twice the FUN
playsound(user, fire_sound, 50, 1)
user.visible_message("<span class='danger'>The shotgun goes off!</span>", "<span class='danger'>The shotgun goes off in your face!</span>")
return
if(do_after(user, 30)) //SHIT IS STEALTHY EYYYYY
icon_state = "sawnshotgun"
w_class = 3
item_state = "gun"
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!"
user << "<span class='warning'>You shorten the barrel of \the [src]!</span>"
else
..()