Files
GS13NG/code/modules/projectiles/guns/ballistic/shotgun.dm

255 lines
8.0 KiB
Plaintext

/obj/item/gun/ballistic/shotgun
name = "shotgun"
desc = "A traditional shotgun with wood furniture and a four-shell capacity underneath."
icon_state = "shotgun"
item_state = "shotgun"
w_class = WEIGHT_CLASS_BULKY
force = 10
flags_1 = CONDUCT_1
slot_flags = ITEM_SLOT_BACK
mag_type = /obj/item/ammo_box/magazine/internal/shot
casing_ejector = FALSE
var/recentpump = 0 // to prevent spammage
weapon_weight = WEAPON_MEDIUM
/obj/item/gun/ballistic/shotgun/attackby(obj/item/A, mob/user, params)
. = ..()
if(.)
return
var/num_loaded = magazine.attackby(A, user, params, 1)
if(num_loaded)
to_chat(user, "<span class='notice'>You load [num_loaded] shell\s into \the [src]!</span>")
playsound(user, 'sound/weapons/shotguninsert.ogg', 60, 1)
A.update_icon()
update_icon()
/obj/item/gun/ballistic/shotgun/process_chamber(empty_chamber = 0)
return ..() //changed argument value
/obj/item/gun/ballistic/shotgun/chamber_round()
return
/obj/item/gun/ballistic/shotgun/can_shoot()
if(!chambered)
return 0
return (chambered.BB ? 1 : 0)
/obj/item/gun/ballistic/shotgun/attack_self(mob/living/user)
if(recentpump > world.time)
return
if(istype(user) && user.getStaminaLoss() >= STAMINA_SOFTCRIT)//CIT CHANGE - makes pumping shotguns impossible in stamina softcrit
to_chat(user, "<span class='warning'>You're too exhausted for that.</span>")//CIT CHANGE - ditto
return//CIT CHANGE - ditto
pump(user)
recentpump = world.time + 10
if(istype(user))//CIT CHANGE - makes pumping shotguns cost a lil bit of stamina.
user.adjustStaminaLossBuffered(2) //CIT CHANGE - DITTO. make this scale inversely to the strength stat when stats/skills are added
return
/obj/item/gun/ballistic/shotgun/blow_up(mob/user)
. = 0
if(chambered && chambered.BB)
process_fire(user, user, FALSE)
. = 1
/obj/item/gun/ballistic/shotgun/proc/pump(mob/M)
playsound(M, 'sound/weapons/shotgunpump.ogg', 60, 1)
pump_unload(M)
pump_reload(M)
update_icon() //I.E. fix the desc
return 1
/obj/item/gun/ballistic/shotgun/proc/pump_unload(mob/M)
if(chambered)//We have a shell in the chamber
chambered.forceMove(drop_location())//Eject casing
chambered.bounce_away()
chambered = null
/obj/item/gun/ballistic/shotgun/proc/pump_reload(mob/M)
if(!magazine.ammo_count())
return 0
var/obj/item/ammo_casing/AC = magazine.get_round() //load next casing.
chambered = AC
/obj/item/gun/ballistic/shotgun/examine(mob/user)
..()
if (chambered)
to_chat(user, "A [chambered.BB ? "live" : "spent"] one is in the chamber.")
/obj/item/gun/ballistic/shotgun/lethal
mag_type = /obj/item/ammo_box/magazine/internal/shot/lethal
// RIOT SHOTGUN //
/obj/item/gun/ballistic/shotgun/riot //for spawn in the armory
name = "riot shotgun"
desc = "A sturdy shotgun with a longer magazine and a fixed tactical stock designed for non-lethal riot control."
icon_state = "riotshotgun"
mag_type = /obj/item/ammo_box/magazine/internal/shot/riot
sawn_desc = "Come with me if you want to live."
/obj/item/gun/ballistic/shotgun/riot/attackby(obj/item/A, mob/user, params)
..()
if(istype(A, /obj/item/circular_saw) || istype(A, /obj/item/gun/energy/plasmacutter))
sawoff(user)
if(istype(A, /obj/item/melee/transforming/energy))
var/obj/item/melee/transforming/energy/W = A
if(W.active)
sawoff(user)
///////////////////////
// BOLT ACTION RIFLE //
///////////////////////
/obj/item/gun/ballistic/shotgun/boltaction
name = "\improper Mosin Nagant"
desc = "This piece of junk looks like something that could have been used 700 years ago. It feels slightly moist."
icon_state = "moistnugget"
item_state = "moistnugget"
slot_flags = 0 //no ITEM_SLOT_BACK sprite, alas
mag_type = /obj/item/ammo_box/magazine/internal/boltaction
var/bolt_open = FALSE
can_bayonet = TRUE
knife_x_offset = 27
knife_y_offset = 13
/obj/item/gun/ballistic/shotgun/boltaction/pump(mob/M)
playsound(M, 'sound/weapons/shotgunpump.ogg', 60, 1)
if(bolt_open)
pump_reload(M)
else
pump_unload(M)
bolt_open = !bolt_open
update_icon() //I.E. fix the desc
return 1
/obj/item/gun/ballistic/shotgun/boltaction/attackby(obj/item/A, mob/user, params)
if(!bolt_open)
to_chat(user, "<span class='notice'>The bolt is closed!</span>")
return
. = ..()
/obj/item/gun/ballistic/shotgun/boltaction/examine(mob/user)
..()
to_chat(user, "The bolt is [bolt_open ? "open" : "closed"].")
/obj/item/gun/ballistic/shotgun/boltaction/enchanted
name = "enchanted bolt action rifle"
desc = "Careful not to lose your head."
var/guns_left = 30
var/gun_type
mag_type = /obj/item/ammo_box/magazine/internal/boltaction/enchanted
/obj/item/gun/ballistic/shotgun/boltaction/enchanted/arcane_barrage
name = "arcane barrage"
desc = "Pew Pew Pew."
fire_sound = 'sound/weapons/emitter.ogg'
pin = /obj/item/firing_pin/magic
icon_state = "arcane_barrage"
item_state = "arcane_barrage"
can_bayonet = FALSE
item_flags = NEEDS_PERMIT | DROPDEL
flags_1 = NONE
mag_type = /obj/item/ammo_box/magazine/internal/boltaction/enchanted/arcane_barrage
/obj/item/gun/ballistic/shotgun/boltaction/enchanted/Initialize()
. = ..()
bolt_open = TRUE
pump()
gun_type = type
/obj/item/gun/ballistic/shotgun/boltaction/enchanted/dropped()
..()
guns_left = 0
/obj/item/gun/ballistic/shotgun/boltaction/enchanted/proc/discard_gun(mob/user)
throw_at(pick(oview(7,get_turf(user))),1,1)
user.visible_message("<span class='warning'>[user] tosses aside the spent rifle!</span>")
/obj/item/gun/ballistic/shotgun/boltaction/enchanted/arcane_barrage/discard_gun(mob/user)
return
/obj/item/gun/ballistic/shotgun/boltaction/enchanted/attack_self()
return
/obj/item/gun/ballistic/shotgun/boltaction/enchanted/shoot_live_shot(mob/living/user as mob|obj, pointblank = 0, mob/pbtarget = null, message = 1)
..()
if(guns_left)
var/obj/item/gun/ballistic/shotgun/boltaction/enchanted/GUN = new gun_type
GUN.guns_left = guns_left - 1
user.dropItemToGround(src, TRUE)
user.swap_hand()
user.put_in_hands(GUN)
else
user.dropItemToGround(src, TRUE)
discard_gun(user)
// Automatic Shotguns//
/obj/item/gun/ballistic/shotgun/automatic/shoot_live_shot(mob/living/user as mob|obj)
..()
src.pump(user)
/obj/item/gun/ballistic/shotgun/automatic/combat
name = "combat shotgun"
desc = "A semi automatic shotgun with tactical furniture and a six-shell capacity underneath."
icon_state = "cshotgun"
mag_type = /obj/item/ammo_box/magazine/internal/shot/com
w_class = WEIGHT_CLASS_HUGE
/obj/item/gun/ballistic/shotgun/automatic/combat/compact
name = "compact combat shotgun"
desc = "A compact version of the semi automatic combat shotgun. For close encounters."
icon_state = "cshotgunc"
mag_type = /obj/item/ammo_box/magazine/internal/shot/com/compact
w_class = WEIGHT_CLASS_NORMAL
//Dual Feed Shotgun
/obj/item/gun/ballistic/shotgun/automatic/dual_tube
name = "cycler shotgun"
desc = "An advanced shotgun with two separate magazine tubes, allowing you to quickly toggle between ammo types."
icon_state = "cycler"
mag_type = /obj/item/ammo_box/magazine/internal/shot/tube
w_class = WEIGHT_CLASS_HUGE
var/toggled = FALSE
var/obj/item/ammo_box/magazine/internal/shot/alternate_magazine
/obj/item/gun/ballistic/shotgun/automatic/dual_tube/examine(mob/user)
..()
to_chat(user, "<span class='notice'>Alt-click to pump it.</span>")
/obj/item/gun/ballistic/shotgun/automatic/dual_tube/Initialize()
. = ..()
if (!alternate_magazine)
alternate_magazine = new mag_type(src)
/obj/item/gun/ballistic/shotgun/automatic/dual_tube/attack_self(mob/living/user)
if(!chambered && magazine.contents.len)
pump()
else
toggle_tube(user)
/obj/item/gun/ballistic/shotgun/automatic/dual_tube/proc/toggle_tube(mob/living/user)
var/current_mag = magazine
var/alt_mag = alternate_magazine
magazine = alt_mag
alternate_magazine = current_mag
toggled = !toggled
if(toggled)
to_chat(user, "You switch to tube B.")
else
to_chat(user, "You switch to tube A.")
/obj/item/gun/ballistic/shotgun/automatic/dual_tube/AltClick(mob/living/user)
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
return
pump()
// DOUBLE BARRELED SHOTGUN and IMPROVISED SHOTGUN are in revolver.dm