Lumberjack Powercreep (Added Chainsaws) (#4104)

Added Chainsaws. They can be held with two hands, and powered on. Sprites ripped from /tg/station. Mechanics ripped from chainsword + two handed weapon code. Sounds ripped from various websites,
This commit is contained in:
BurgerLUA
2018-02-25 20:32:27 +02:00
committed by Erki
parent bfced36a28
commit 8333089845
11 changed files with 336 additions and 32 deletions
@@ -67,6 +67,9 @@
else
user << "<span class='notice'>Access Denied</span>"
/obj/structure/closet/secure_closet/proc/CanChainsaw(var/obj/item/weapon/material/twohanded/chainsaw/ChainSawVar)
return (ChainSawVar.powered && !opened && !broken)
/obj/structure/closet/secure_closet/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(opened)
if(istype(W, /obj/item/weapon/grab))
@@ -137,7 +140,24 @@
wrenched = 1
anchored = 1
else if(!opened)
if(istype(W, /obj/item/weapon/melee/energy/blade))//Attempt to cut open locker if locked
if(!broken && istype(W,/obj/item/weapon/material/twohanded/chainsaw))
var/obj/item/weapon/material/twohanded/chainsaw/ChainSawVar = W
ChainSawVar.cutting = 1
user.visible_message(\
"<span class='danger'>[user.name] starts cutting the [src] with the [W]!</span>",\
"<span class='warning'>You start cutting the [src]...</span>",\
"<span class='notice'>You hear a loud buzzing sound and metal grinding on metal...</span>"\
)
if(do_after(user, ChainSawVar.opendelay SECONDS, act_target = user, extra_checks = CALLBACK(src, .proc/CanChainsaw, W)))
user.visible_message(\
"<span class='warning'>[user.name] finishes cutting open the [src] with the [W].</span>",\
"<span class='warning'>You finish cutting open the [src].</span>",\
"<span class='notice'>You hear a metal clank and some sparks.</span>"\
)
emag_act(INFINITY, user, "<span class='danger'>The locker has been sliced open by [user] with \an [W]</span>!", "<span class='danger'>You hear metal being sliced and sparks flying.</span>")
spark(src, 5)
ChainSawVar.cutting = 0
else if(istype(W, /obj/item/weapon/melee/energy/blade))//Attempt to cut open locker if locked
if(emag_act(INFINITY, user, "<span class='danger'>The locker has been sliced open by [user] with \an [W]</span>!", "<span class='danger'>You hear metal being sliced and sparks flying.</span>"))
spark(src, 5)
playsound(loc, 'sound/weapons/blade1.ogg', 50, 1)
@@ -245,3 +265,4 @@
var/obj/structure/bigDelivery/BD = loc
BD.unwrap()
open()
@@ -301,10 +301,39 @@
new path(src.loc, src)
qdel(src)
else if(istype(W, /obj/item/weapon/material/twohanded/chainsaw))
var/obj/item/weapon/material/twohanded/chainsaw/ChainSawVar = W
if(!ChainSawVar.wielded)
user << "<span class='notice'>Cutting the airlock requires the strength of two hands.</span>"
else if(ChainSawVar.cutting)
user << "<span class='notice'>You are already cutting an airlock open.</span>"
else if(!ChainSawVar.powered)
user << "<span class='notice'>The [W] needs to be on in order to open this door.</span>"
else
ChainSawVar.cutting = 1
user.visible_message(\
"<span class='danger'>[user.name] starts cutting the rest of the airlock with the [W]!</span>",\
"<span class='warning'>You start cutting the rest of the airlock...</span>",\
"<span class='notice'>You hear a loud buzzing sound and metal grinding on metal...</span>"\
)
if(do_after(user, ChainSawVar.opendelay SECONDS, act_target = user, extra_checks = CALLBACK(src, .proc/CanChainsaw, W)))
user.visible_message(\
"<span class='warning'>[user.name] finishes cutting the airlock with the [W].</span>",\
"<span class='warning'>You finish cutting the airlock.</span>",\
"<span class='notice'>You hear a metal clank and some sparks.</span>"\
)
new /obj/item/stack/material/steel(src.loc, 2)
ChainSawVar.cutting = 0
qdel(src)
else
ChainSawVar.cutting = 0
else
..()
update_state()
/obj/structure/door_assembly/proc/CanChainsaw(var/obj/item/weapon/material/twohanded/chainsaw/ChainSawVar)
return (ChainSawVar.powered)
/obj/structure/door_assembly/proc/update_state()
icon_state = "door_as_[glass == 1 ? "g" : ""][istext(glass) ? glass : base_icon_state][state]"
name = ""