diff --git a/code/modules/projectiles/guns/projectile/shotgun.dm b/code/modules/projectiles/guns/projectile/shotgun.dm
index 997fecbda33..903d18798d7 100644
--- a/code/modules/projectiles/guns/projectile/shotgun.dm
+++ b/code/modules/projectiles/guns/projectile/shotgun.dm
@@ -80,38 +80,79 @@
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
- var/style = 1
+ sawn_desc = "Come with me if you want to live."
+ sawn_state = SAWN_INTACT
/obj/item/gun/projectile/shotgun/riot/attackby(obj/item/A, mob/user, params)
..()
if(istype(A, /obj/item/circular_saw) || istype(A, /obj/item/gun/energy/plasmacutter))
- sawoff(A, user, 0)
+ sawoff(user)
if(istype(A, /obj/item/melee/energy))
var/obj/item/melee/energy/W = A
if(W.active)
- sawoff(A, user, 0)
+ sawoff(user)
if(istype(A, /obj/item/pipe))
- sawoff(A, user, 1)
+ unsaw(A, user)
-/obj/item/gun/projectile/shotgun/riot/sawoff(obj/item/A, mob/user, style = 0)
- //Check to see if they match
- if(sawn_state == SAWN_OFF & style == 0)
- to_chat(user, "\The [src] is already shortened!")
+/obj/item/gun/projectile/sawoff(mob/user)
+ if(sawn_state == SAWN_OFF)
+ to_chat(user, "[src] has already been shortened!")
return
- if(sawn_state != SAWN_OFF & style == 1)
- to_chat(user, "[src] already has a full barrel and magazine!")
- return
- //Make sure it isn't in a bag
- if(istype(loc, /obj/item/storage))
+ if(istype(loc, /obj/item/storage)) //To prevent inventory exploits
to_chat(user, "How do you plan to modify [src] while it's in a bag.")
return
- //if there's any live ammo inside the gun, makes it go off
- if(chambered)
- afterattack(user, user)
- user.visible_message("\The [src] goes off!", "\The [src] goes off in your face!")
+ if(chambered) //if the gun is chambering live ammo, shoot self, if chambering empty ammo, 'click'
+ if(chambered.BB)
+ afterattack(user, user)
+ user.visible_message("\The [src] goes off!", "\The [src] goes off in your face!")
+ return
+ else
+ afterattack(user, user)
+ user.visible_message("The [src] goes click!", "The [src] you are holding goes click.")
+ if(magazine.ammo_count()) //Spill the mag onto the floor
+ user.visible_message("[user.name] opens [src] up and the shells go goes flying around!", "You open [src] up and the shells go goes flying everywhere!!")
+ while(get_ammo(0) > 0)
+ var/obj/item/ammo_casing/CB
+ CB = magazine.get_round(0)
+ if(CB)
+ CB.loc = get_turf(loc)
+ CB.update_icon()
+
+ if(do_after(user, 30, target = src))
+ user.visible_message("[user] shortens \the [src]!", "You shorten \the [src].")
+ post_sawoff()
+ return 1
+
+
+/obj/item/gun/projectile/proc/post_sawoff()
+ name = "assault shotgun"
+ desc = sawn_desc
+ w_class = WEIGHT_CLASS_NORMAL
+ current_skin = "riotshotgun-short"
+ item_state = "gun" //phil235 is it different with different skin?
+ slot_flags &= ~SLOT_BACK //you can't sling it on your back
+ slot_flags |= SLOT_BELT //but you can wear it on your belt (poorly concealed under a trenchcoat, ideally)
+ sawn_state = SAWN_OFF
+ magazine.max_ammo = 3
+ update_icon()
+
+
+/obj/item/gun/projectile/proc/unsaw(obj/item/A, mob/user)
+ if(sawn_state == SAWN_INTACT)
+ to_chat(user, "[src] has not been shortened!")
return
- //Spill the mag onto the floor
- if(magazine.ammo_count())
+ if(istype(loc, /obj/item/storage)) //To prevent inventory exploits
+ to_chat(user, "How do you plan to modify [src] while it's in a bag.")
+ return
+ if(chambered) //if the gun is chambering live ammo, shoot self, if chambering empty ammo, 'click'
+ if(chambered.BB)
+ afterattack(user, user)
+ user.visible_message("\The [src] goes off!", "\The [src] goes off in your face!")
+ return
+ else
+ afterattack(user, user)
+ user.visible_message("The [src] goes click!", "The [src] you are holding goes click.")
+ if(magazine.ammo_count()) //Spill the mag onto the floor
user.visible_message("[user.name] opens [src] up and the shells go goes flying around!", "You open [src] up and the shells go goes flying everywhere!!")
while(get_ammo() > 0)
var/obj/item/ammo_casing/CB
@@ -119,30 +160,24 @@
if(CB)
CB.loc = get_turf(loc)
CB.update_icon()
- if(style == 0)
- if(do_after(user, 10, target = src))
- to_chat(user, "You saw the barrel and magazine of the [src].")
- w_class = WEIGHT_CLASS_NORMAL
- slot_flags = null
- magazine.max_ammo = 3
- name = "assault shotgun"
- current_skin = "riotshotgun-short"
- desc = "A shortened riot shotgun that has been shortened enough to fit inside a bag."
- sawn_state = SAWN_OFF
- update_icon()
- else
- if(do_after(user, 10, target = src))
- to_chat(user, "You install the longer barrel and magazine onto [src].")
- w_class = WEIGHT_CLASS_BULKY
- slot_flags = SLOT_BACK
- magazine.max_ammo = 6
- name = "riot shotgun"
- current_skin = "riotshotgun"
- desc = "A sturdy shotgun with a longer magazine and a fixed tactical stock designed for non-lethal riot control."
- sawn_state = null
- update_icon()
- qdel(A)
- return
+
+ if(do_after(user, 30, target = src))
+ qdel(A)
+ user.visible_message("[user] lengthens [src]!", "You lengthen [src].")
+ post_unsaw(user)
+ return 1
+
+/obj/item/gun/projectile/proc/post_unsaw()
+ name = initial(name)
+ desc = initial(desc)
+ w_class = initial(w_class)
+ current_skin = "riotshotgun"
+ item_state = initial(item_state)
+ slot_flags &= ~SLOT_BELT
+ slot_flags |= SLOT_BACK
+ sawn_state = SAWN_INTACT
+ magazine.max_ammo = 6
+ update_icon()
/obj/item/gun/projectile/shotgun/riot/update_icon() //Can't use the old proc as it makes it go to riotshotgun-short_sawn
..()
@@ -152,13 +187,13 @@
icon_state = "[initial(icon_state)]"
/obj/item/gun/projectile/shotgun/riot/short
- name = "assault shotgun"
- desc = "A shortened riot shotgun that has been shortened enough to fit inside a bag."
- icon_state = "riotshotgun-short"
mag_type = /obj/item/ammo_box/magazine/internal/shot/riot/short
- w_class = WEIGHT_CLASS_NORMAL
- slot_flags = null
- sawn_state = SAWN_OFF
+
+/obj/item/gun/projectile/shotgun/riot/short/New()
+ ..()
+ post_sawoff()
+
+
///////////////////////
// BOLT ACTION RIFLE //