mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-01-06 07:22:42 +00:00
Fixes fireaxe cabinets
This commit is contained in:
@@ -1216,7 +1216,7 @@ var/list/WALLITEMS = list(
|
||||
/obj/machinery/newscaster, /obj/machinery/firealarm, /obj/structure/noticeboard, /obj/machinery/button/remote,
|
||||
/obj/machinery/computer/security/telescreen, /obj/machinery/embedded_controller/radio,
|
||||
/obj/item/weapon/storage/secure/safe, /obj/machinery/door_timer, /obj/machinery/flasher, /obj/machinery/keycard_auth,
|
||||
/obj/structure/mirror, /obj/structure/closet/fireaxecabinet, /obj/machinery/computer/security/telescreen/entertainment
|
||||
/obj/structure/mirror, /obj/structure/fireaxecabinet, /obj/machinery/computer/security/telescreen/entertainment
|
||||
)
|
||||
/proc/gotwallitem(loc, dir)
|
||||
for(var/obj/O in loc)
|
||||
|
||||
@@ -145,4 +145,4 @@
|
||||
icon = 'icons/obj/closet.dmi'
|
||||
icon_state = "fireaxe0101"
|
||||
refund_amt = 4
|
||||
build_machine_type = /obj/structure/closet/fireaxecabinet
|
||||
build_machine_type = /obj/structure/fireaxecabinet
|
||||
@@ -64,7 +64,6 @@
|
||||
/obj/structure/closet/cabinet,
|
||||
/obj/structure/closet/crate,
|
||||
/obj/structure/closet/coffin,
|
||||
/obj/structure/closet/fireaxecabinet,
|
||||
/obj/structure/closet/hydrant,
|
||||
/obj/structure/closet/medical_wall,
|
||||
/obj/structure/closet/statue,
|
||||
|
||||
@@ -1,214 +0,0 @@
|
||||
//I still dont think this should be a closet but whatever
|
||||
/obj/structure/closet/fireaxecabinet
|
||||
name = "fire axe cabinet"
|
||||
desc = "There is small label that reads \"For Emergency use only\" along with details for safe use of the axe. As if."
|
||||
var/obj/item/weapon/material/twohanded/fireaxe/fireaxe
|
||||
icon_state = "fireaxe1000"
|
||||
icon_closed = "fireaxe1000"
|
||||
icon_opened = "fireaxe1100"
|
||||
anchored = 1
|
||||
density = 0
|
||||
var/localopened = 0 //Setting this to keep it from behaviouring like a normal closet and obstructing movement in the map. -Agouri
|
||||
opened = 1
|
||||
var/hitstaken = 0
|
||||
var/locked = 1
|
||||
var/smashed = 0
|
||||
|
||||
starts_with = list(/obj/item/weapon/material/twohanded/fireaxe)
|
||||
|
||||
/obj/structure/closet/fireaxecabinet/Initialize()
|
||||
..()
|
||||
fireaxe = locate() in contents
|
||||
|
||||
/obj/structure/closet/fireaxecabinet/attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri
|
||||
//..() //That's very useful, Erro
|
||||
|
||||
// This could stand to be put further in, made better, etc. but fuck you. Fuck whoever
|
||||
// wrote this code. Fuck everything about this object. I hope you step on a Lego.
|
||||
user.setClickCooldown(10)
|
||||
// Seriously why the fuck is this even a closet aghasjdhasd I hate you
|
||||
|
||||
var/hasaxe = 0 //gonna come in handy later~ // FUCK YOUR TILDES.
|
||||
if(fireaxe)
|
||||
hasaxe = 1
|
||||
|
||||
if (isrobot(usr) || src.locked)
|
||||
if(istype(O, /obj/item/device/multitool))
|
||||
user << "<span class='warning'>Resetting circuitry...</span>"
|
||||
playsound(user, 'sound/machines/lockreset.ogg', 50, 1)
|
||||
if(do_after(user, 20 * O.toolspeed))
|
||||
src.locked = 0
|
||||
to_chat(user, "<span class = 'caution'> You disable the locking modules.</span>")
|
||||
update_icon()
|
||||
return
|
||||
else if(istype(O, /obj/item/weapon))
|
||||
var/obj/item/weapon/W = O
|
||||
if(src.smashed || src.localopened)
|
||||
if(localopened)
|
||||
localopened = 0
|
||||
icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed)
|
||||
spawn(10) update_icon()
|
||||
return
|
||||
else
|
||||
playsound(user, 'sound/effects/Glasshit.ogg', 100, 1) //We don't want this playing every time
|
||||
if(W.force < 15)
|
||||
to_chat(user, "<span class='notice'>The cabinet's protective glass glances off the hit.</span>")
|
||||
else
|
||||
src.hitstaken++
|
||||
if(src.hitstaken == 4)
|
||||
playsound(user, 'sound/effects/Glassbr3.ogg', 100, 1) //Break cabinet, receive goodies. Cabinet's fucked for life after that.
|
||||
src.smashed = 1
|
||||
src.locked = 0
|
||||
src.localopened = 1
|
||||
update_icon()
|
||||
return
|
||||
if (istype(O, /obj/item/weapon/material/twohanded/fireaxe) && src.localopened)
|
||||
if(!fireaxe)
|
||||
if(O:wielded)
|
||||
O:wielded = 0
|
||||
O.update_icon()
|
||||
//to_chat(user, "<span class='warning'>Unwield the axe first.</span>")
|
||||
//return
|
||||
fireaxe = O
|
||||
user.remove_from_mob(O)
|
||||
src.contents += O
|
||||
to_chat(user, "<span class='notice'>You place the fire axe back in the [src.name].</span>")
|
||||
update_icon()
|
||||
else
|
||||
if(src.smashed)
|
||||
return
|
||||
else
|
||||
localopened = !localopened
|
||||
if(localopened)
|
||||
icon_state = text("fireaxe[][][][]opening",hasaxe,src.localopened,src.hitstaken,src.smashed)
|
||||
spawn(10) update_icon()
|
||||
else
|
||||
icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed)
|
||||
spawn(10) update_icon()
|
||||
else
|
||||
if(src.smashed)
|
||||
return
|
||||
if(istype(O, /obj/item/device/multitool))
|
||||
if(localopened)
|
||||
localopened = 0
|
||||
icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed)
|
||||
spawn(10) update_icon()
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Resetting circuitry...</span>")
|
||||
playsound(user, 'sound/machines/lockenable.ogg', 50, 1)
|
||||
if(do_after(user,20 * O.toolspeed))
|
||||
src.locked = 1
|
||||
to_chat(user, "<span class = 'caution'> You re-enable the locking modules.</span>")
|
||||
return
|
||||
else
|
||||
localopened = !localopened
|
||||
if(localopened)
|
||||
icon_state = text("fireaxe[][][][]opening",hasaxe,src.localopened,src.hitstaken,src.smashed)
|
||||
spawn(10) update_icon()
|
||||
else
|
||||
icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed)
|
||||
spawn(10) update_icon()
|
||||
|
||||
|
||||
/obj/structure/closet/fireaxecabinet/attack_hand(mob/user as mob)
|
||||
var/hasaxe = 0
|
||||
if(fireaxe)
|
||||
hasaxe = 1
|
||||
|
||||
if(src.locked)
|
||||
to_chat(user, "<span class='warning'>The cabinet won't budge!</span>")
|
||||
return
|
||||
|
||||
if(localopened)
|
||||
if(fireaxe)
|
||||
user.put_in_hands(fireaxe)
|
||||
fireaxe = null
|
||||
to_chat (user, "<span class='notice'>You take the fire axe from the [name].</span>")
|
||||
src.add_fingerprint(user)
|
||||
update_icon()
|
||||
else
|
||||
if(src.smashed)
|
||||
return
|
||||
else
|
||||
localopened = !localopened
|
||||
if(localopened)
|
||||
src.icon_state = text("fireaxe[][][][]opening",hasaxe,src.localopened,src.hitstaken,src.smashed)
|
||||
spawn(10) update_icon()
|
||||
else
|
||||
src.icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed)
|
||||
spawn(10) update_icon()
|
||||
|
||||
else
|
||||
localopened = !localopened //I'm pretty sure we don't need an if(src.smashed) in here. In case I'm wrong and it fucks up teh cabinet, **MARKER**. -Agouri
|
||||
if(localopened)
|
||||
src.icon_state = text("fireaxe[][][][]opening",hasaxe,src.localopened,src.hitstaken,src.smashed)
|
||||
spawn(10) update_icon()
|
||||
else
|
||||
src.icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed)
|
||||
spawn(10) update_icon()
|
||||
|
||||
/obj/structure/closet/fireaxecabinet/attack_tk(mob/user as mob)
|
||||
if(localopened && fireaxe)
|
||||
fireaxe.forceMove(loc)
|
||||
to_chat(user, "<span class='notice'>You telekinetically remove the fire axe.</span>")
|
||||
fireaxe = null
|
||||
update_icon()
|
||||
return
|
||||
attack_hand(user)
|
||||
|
||||
/obj/structure/closet/fireaxecabinet/verb/toggle_openness() //nice name, huh? HUH?! -Erro //YEAH -Agouri
|
||||
set name = "Open/Close"
|
||||
set category = "Object"
|
||||
|
||||
if (isrobot(usr) || src.locked || src.smashed)
|
||||
if(src.locked)
|
||||
to_chat(usr, "<span class='warning'>The cabinet won't budge!</span>")
|
||||
else if(src.smashed)
|
||||
to_chat(usr, "<span class='notice'>The protective glass is broken!</span>")
|
||||
return
|
||||
|
||||
localopened = !localopened
|
||||
update_icon()
|
||||
|
||||
/obj/structure/closet/fireaxecabinet/verb/remove_fire_axe()
|
||||
set name = "Remove Fire Axe"
|
||||
set category = "Object"
|
||||
|
||||
if (isrobot(usr))
|
||||
return
|
||||
|
||||
if (localopened)
|
||||
if(fireaxe)
|
||||
usr.put_in_hands(fireaxe)
|
||||
fireaxe = null
|
||||
to_chat(usr, "<span class='notice'>You take the Fire axe from the [name].</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>The [src.name] is empty.</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>The [src.name] is closed.</span>")
|
||||
update_icon()
|
||||
|
||||
/obj/structure/closet/fireaxecabinet/attack_ai(mob/user as mob)
|
||||
if(src.smashed)
|
||||
to_chat(user, "<span class='warning'>The security of the cabinet is compromised.</span>")
|
||||
return
|
||||
else
|
||||
locked = !locked
|
||||
if(locked)
|
||||
to_chat(user, "<span class='warning'>Cabinet locked.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>Cabinet unlocked.</span>")
|
||||
return
|
||||
|
||||
/obj/structure/closet/fireaxecabinet/update_icon() //Template: fireaxe[has fireaxe][is opened][hits taken][is smashed]. If you want the opening or closing animations, add "opening" or "closing" right after the numbers
|
||||
var/hasaxe = 0
|
||||
if(fireaxe)
|
||||
hasaxe = 1
|
||||
icon_state = text("fireaxe[][][][]",hasaxe,src.localopened,src.hitstaken,src.smashed)
|
||||
|
||||
/obj/structure/closet/fireaxecabinet/open()
|
||||
return
|
||||
|
||||
/obj/structure/closet/fireaxecabinet/close()
|
||||
return
|
||||
185
code/game/objects/structures/fireaxe.dm
Normal file
185
code/game/objects/structures/fireaxe.dm
Normal file
@@ -0,0 +1,185 @@
|
||||
//I still dont think this should be a closet but whatever
|
||||
/obj/structure/fireaxecabinet
|
||||
name = "fire axe cabinet"
|
||||
desc = "There is small label that reads \"For Emergency use only\" along with details for safe use of the axe. As if."
|
||||
var/obj/item/weapon/material/twohanded/fireaxe/fireaxe
|
||||
icon = 'icons/obj/closet.dmi' //Not bothering to move icons out for now. But its dumb still.
|
||||
icon_state = "fireaxe1000"
|
||||
anchored = 1
|
||||
density = 0
|
||||
var/open = 0
|
||||
var/hitstaken = 0
|
||||
var/locked = 1
|
||||
var/smashed = 0
|
||||
|
||||
/obj/structure/fireaxecabinet/Initialize()
|
||||
..()
|
||||
fireaxe = new /obj/item/weapon/material/twohanded/fireaxe()
|
||||
|
||||
/obj/structure/fireaxecabinet/attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri
|
||||
//..() //That's very useful, Erro
|
||||
|
||||
// This could stand to be put further in, made better, etc. but fuck you. Fuck whoever
|
||||
// wrote this code. Fuck everything about this object. I hope you step on a Lego.
|
||||
user.setClickCooldown(10)
|
||||
// Seriously why the fuck is this even a closet aghasjdhasd I hate you
|
||||
|
||||
//var/hasaxe = 0 //gonna come in handy later~ // FUCK YOUR TILDES.
|
||||
//if(fireaxe)
|
||||
// hasaxe = 1
|
||||
|
||||
if (isrobot(user) || locked)
|
||||
if(istype(O, /obj/item/device/multitool))
|
||||
to_chat(user, "<span class='warning'>Resetting circuitry...</span>")
|
||||
playsound(user, 'sound/machines/lockreset.ogg', 50, 1)
|
||||
if(do_after(user, 20 * O.toolspeed))
|
||||
locked = 0
|
||||
to_chat(user, "<span class = 'caution'> You disable the locking modules.</span>")
|
||||
update_icon()
|
||||
return
|
||||
else if(istype(O, /obj/item/weapon))
|
||||
var/obj/item/weapon/W = O
|
||||
if(smashed || open)
|
||||
if(open)
|
||||
toggle_close_open()
|
||||
return
|
||||
else
|
||||
playsound(user, 'sound/effects/Glasshit.ogg', 100, 1) //We don't want this playing every time
|
||||
if(W.force < 15)
|
||||
to_chat(user, "<span class='notice'>The cabinet's protective glass glances off the hit.</span>")
|
||||
else
|
||||
hitstaken++
|
||||
if(hitstaken == 4)
|
||||
playsound(user, 'sound/effects/Glassbr3.ogg', 100, 1) //Break cabinet, receive goodies. Cabinet's fucked for life after that.
|
||||
smashed = 1
|
||||
locked = 0
|
||||
open= 1
|
||||
update_icon()
|
||||
return
|
||||
if (istype(O, /obj/item/weapon/material/twohanded/fireaxe) && open)
|
||||
if(!fireaxe)
|
||||
if(O:wielded)
|
||||
O:wielded = 0
|
||||
O.update_icon()
|
||||
fireaxe = O
|
||||
user.remove_from_mob(O)
|
||||
contents += O
|
||||
to_chat(user, "<span class='notice'>You place the fire axe back in the [name].</span>")
|
||||
update_icon()
|
||||
else
|
||||
if(smashed)
|
||||
return
|
||||
else
|
||||
toggle_close_open()
|
||||
else
|
||||
if(smashed)
|
||||
return
|
||||
if(istype(O, /obj/item/device/multitool))
|
||||
if(open)
|
||||
open = 0
|
||||
update_icon()
|
||||
flick("[icon_state]closing", src)
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Resetting circuitry...</span>")
|
||||
playsound(user, 'sound/machines/lockenable.ogg', 50, 1)
|
||||
if(do_after(user,20 * O.toolspeed))
|
||||
locked = 1
|
||||
to_chat(user, "<span class = 'caution'> You re-enable the locking modules.</span>")
|
||||
return
|
||||
else
|
||||
toggle_close_open()
|
||||
|
||||
|
||||
/obj/structure/fireaxecabinet/attack_hand(mob/user as mob)
|
||||
//var/hasaxe = 0 //Fuck this. Fuck everything about this. Who wrote this. Why.
|
||||
//if(fireaxe)
|
||||
// hasaxe = 1
|
||||
|
||||
if(locked)
|
||||
to_chat(user, "<span class='warning'>The cabinet won't budge!</span>")
|
||||
return
|
||||
|
||||
if(open)
|
||||
if(fireaxe)
|
||||
user.put_in_hands(fireaxe)
|
||||
fireaxe = null
|
||||
to_chat (user, "<span class='notice'>You take the fire axe from the [name].</span>")
|
||||
add_fingerprint(user)
|
||||
update_icon()
|
||||
else
|
||||
if(smashed)
|
||||
return
|
||||
else
|
||||
toggle_close_open()
|
||||
|
||||
else
|
||||
toggle_close_open()
|
||||
|
||||
/obj/structure/fireaxecabinet/attack_tk(mob/user as mob)
|
||||
if(open && fireaxe)
|
||||
fireaxe.forceMove(loc)
|
||||
to_chat(user, "<span class='notice'>You telekinetically remove the fire axe.</span>")
|
||||
fireaxe = null
|
||||
update_icon()
|
||||
return
|
||||
attack_hand(user)
|
||||
|
||||
/obj/structure/fireaxecabinet/proc/toggle_close_open()
|
||||
open = !open
|
||||
if(open)
|
||||
update_icon()
|
||||
flick("[icon_state]opening", src)
|
||||
else
|
||||
update_icon()
|
||||
flick("[icon_state]closing", src)
|
||||
|
||||
/obj/structure/fireaxecabinet/verb/toggle_openness() //nice name, huh? HUH?! -Erro //YEAH -Agouri
|
||||
set name = "Open/Close"
|
||||
set category = "Object"
|
||||
|
||||
if (isrobot(usr) || locked || smashed)
|
||||
if(locked)
|
||||
to_chat(usr, "<span class='warning'>The cabinet won't budge!</span>")
|
||||
else if(smashed)
|
||||
to_chat(usr, "<span class='notice'>The protective glass is broken!</span>")
|
||||
return
|
||||
|
||||
toggle_close_open()
|
||||
update_icon()
|
||||
|
||||
/obj/structure/fireaxecabinet/verb/remove_fire_axe()
|
||||
set name = "Remove Fire Axe"
|
||||
set category = "Object"
|
||||
|
||||
if (isrobot(usr))
|
||||
return
|
||||
|
||||
if (open)
|
||||
if(fireaxe)
|
||||
usr.put_in_hands(fireaxe)
|
||||
fireaxe = null
|
||||
to_chat(usr, "<span class='notice'>You take the Fire axe from the [name].</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>The [name] is empty.</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>The [name] is closed.</span>")
|
||||
update_icon()
|
||||
|
||||
/obj/structure/fireaxecabinet/attack_ai(mob/user as mob)
|
||||
if(smashed)
|
||||
to_chat(user, "<span class='warning'>The security of the cabinet is compromised.</span>")
|
||||
return
|
||||
else
|
||||
locked = !locked
|
||||
if(locked)
|
||||
to_chat(user, "<span class='warning'>Cabinet locked.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>Cabinet unlocked.</span>")
|
||||
return
|
||||
|
||||
/obj/structure/fireaxecabinet/update_icon() //Template: fireaxe[has fireaxe][is opened][hits taken][is smashed]. If you want the opening or closing animations, add "opening" or "closing" right after the numbers
|
||||
var/hasaxe = 0
|
||||
if(fireaxe)
|
||||
hasaxe = 1
|
||||
icon_state = text("fireaxe[][][][]",hasaxe,open,hitstaken,smashed)
|
||||
Reference in New Issue
Block a user