diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 6500acbaf88..36e0ecaff12 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -1,3 +1,7 @@ + #define SAWN_INTACT 0 + #define SAWN_OFF 1 + #define SAWN_SAWING -1 + /obj/item/weapon/gun name = "gun" desc = "Its a gun. It's pretty terrible, though." @@ -23,6 +27,7 @@ var/can_suppress = 0 var/clumsy_check = 1 var/sawn_desc = null + var/sawn_state = SAWN_INTACT var/obj/item/ammo_casing/chambered = null // The round (not bullet) that is in the chamber. THIS MISPLACED ITEM BROUGHT TO YOU BY HACKY BUCKSHOT. var/tmp/list/mob/living/target //List of who yer targeting. var/tmp/lock_time = -100 diff --git a/code/modules/projectiles/guns/projectile/shotgun.dm b/code/modules/projectiles/guns/projectile/shotgun.dm index 7fa8d646e47..96f20d316a3 100644 --- a/code/modules/projectiles/guns/projectile/shotgun.dm +++ b/code/modules/projectiles/guns/projectile/shotgun.dm @@ -157,25 +157,6 @@ if(istype(A, /obj/item/weapon/circular_saw) || istype(A, /obj/item/weapon/melee/energy) || istype(A, /obj/item/weapon/pickaxe/plasmacutter)) sawoff(user) -/obj/item/weapon/gun/projectile/proc/sawoff(mob/user as mob) - user << "You begin to shorten \the [src]." - if(get_ammo()) - afterattack(user, user) - playsound(user, fire_sound, 50, 1) - user.visible_message("The [src] goes off!", "The [src] goes off in your face!") - return - if(do_after(user, 30)) - name = "sawn-off [src.name]" - desc = sawn_desc - icon_state = initial(icon_state) + "-sawn" - w_class = 3.0 - item_state = "gun" - 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) - user << "You shorten \the [src]!" - update_icon() - return - /obj/item/weapon/gun/projectile/revolver/doublebarrel/attack_self(mob/living/user as mob) var/num_unloaded = 0 while (get_ammo() > 0) @@ -206,7 +187,7 @@ /obj/item/weapon/gun/projectile/revolver/doublebarrel/improvised/attackby(var/obj/item/A as obj, mob/user as mob, params) ..() - if(istype(A, /obj/item/stack/cable_coil)) + if(istype(A, /obj/item/stack/cable_coil) && !sawn_state) var/obj/item/stack/cable_coil/C = A if(C.use(10)) slot_flags = SLOT_BACK @@ -217,7 +198,44 @@ user << "You need at least ten lengths of cable if you want to make a sling." return -/obj/item/weapon/gun/projectile/revolver/doublebarrel/improvised/sawoff(mob/user as mob) - user << "Shortening \the [src] will break it." - return +// Sawing guns related procs // + +/obj/item/weapon/gun/projectile/proc/blow_up(mob/user as mob) + if(get_ammo()) + afterattack(user, user) + playsound(user, fire_sound, 50, 1) + user.visible_message("The [src] goes off!", "The [src] goes off in your face!") + return + +/obj/item/weapon/gun/projectile/proc/sawoff(mob/user as mob) + if(sawn_state == SAWN_OFF) + user << "\The [src] is already shortened." + return + + if(sawn_state == SAWN_SAWING) + return + + user.visible_message("[user] begins to shorten \the [src].", "You begin to shorten \the [src].") + + //if there's any live ammo inside the gun, makes it go off + if(blow_up(user)) + user.visible_message("\The [src] goes off!", "\The [src] goes off in your face!") + return + + sawn_state = SAWN_SAWING + + if(do_after(user, 30)) + user.visible_message("[user] shortens \the [src]!", "You shorten \the [src]!") + name = "sawn-off [src.name]" + desc = sawn_desc + icon_state = "[icon_state]-sawn" + w_class = 3.0 + item_state = "gun" + 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 + update_icon() + return + else + sawn_state = SAWN_INTACT \ No newline at end of file