mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-15 00:53:23 +01:00
Update saw-off code
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 << "<span class='notice'>You begin to shorten \the [src].</span>"
|
||||
if(get_ammo())
|
||||
afterattack(user, user)
|
||||
playsound(user, fire_sound, 50, 1)
|
||||
user.visible_message("<span class='danger'>The [src] goes off!</span>", "<span class='danger'>The [src] goes off in your face!</span>")
|
||||
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 << "<span class='warning'>You shorten \the [src]!</span>"
|
||||
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 << "<span class='warning'>You need at least ten lengths of cable if you want to make a sling.</span>"
|
||||
return
|
||||
|
||||
/obj/item/weapon/gun/projectile/revolver/doublebarrel/improvised/sawoff(mob/user as mob)
|
||||
user << "<span class='warning'>Shortening \the [src] will break it.</span>"
|
||||
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("<span class='danger'>The [src] goes off!</span>", "<span class='danger'>The [src] goes off in your face!</span>")
|
||||
return
|
||||
|
||||
/obj/item/weapon/gun/projectile/proc/sawoff(mob/user as mob)
|
||||
if(sawn_state == SAWN_OFF)
|
||||
user << "<span class='notice'>\The [src] is already shortened.</span>"
|
||||
return
|
||||
|
||||
if(sawn_state == SAWN_SAWING)
|
||||
return
|
||||
|
||||
user.visible_message("<span class='notice'>[user] begins to shorten \the [src].</span>", "<span class='notice'>You begin to shorten \the [src].</span>")
|
||||
|
||||
//if there's any live ammo inside the gun, makes it go off
|
||||
if(blow_up(user))
|
||||
user.visible_message("<span class='danger'>\The [src] goes off!</span>", "<span class='danger'>\The [src] goes off in your face!</span>")
|
||||
return
|
||||
|
||||
sawn_state = SAWN_SAWING
|
||||
|
||||
if(do_after(user, 30))
|
||||
user.visible_message("<span class='warning'>[user] shortens \the [src]!</span>", "<span class='warning'>You shorten \the [src]!</span>")
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user