diff --git a/code/game/objects/structures/crates_lockers/closets/fireaxe.dm b/code/game/objects/structures/crates_lockers/closets/fireaxe.dm
index 7d71a456abf..f7985d9636c 100644
--- a/code/game/objects/structures/crates_lockers/closets/fireaxe.dm
+++ b/code/game/objects/structures/crates_lockers/closets/fireaxe.dm
@@ -3,10 +3,9 @@
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/twohanded/fireaxe/fireaxe
- icon_state = "fireaxe1000"
- icon_closed = "fireaxe1000"
- icon_opened = "fireaxe1100"
- open_door_sprite = null
+ icon_state = "fireaxe_full_0hits"
+ icon_closed = "fireaxe_full_0hits"
+ icon_opened = "fireaxe_full_open"
anchored = TRUE
density = FALSE
armor = list(MELEE = 50, BULLET = 20, LASER = 0, ENERGY = 100, BOMB = 10, BIO = 100, RAD = 100, FIRE = 90, ACID = 50)
@@ -15,14 +14,20 @@
var/hitstaken = FALSE
locked = TRUE
var/smashed = FALSE
+ var/operating = FALSE
+ var/has_axe = null // Use a string over a boolean value to make the sprite names more readable
/obj/structure/closet/fireaxecabinet/populate_contents()
fireaxe = new/obj/item/twohanded/fireaxe(src)
+ has_axe = "full"
update_icon() // So its initial icon doesn't show it without the fireaxe
/obj/structure/closet/fireaxecabinet/examine(mob/user)
. = ..()
- . += "Use a multitool to lock/unlock it."
+ if(!smashed)
+ . += "Use a multitool to lock/unlock it."
+ else
+ . += "It is damaged beyond repair."
/obj/structure/closet/fireaxecabinet/attackby(obj/item/O as obj, mob/living/user as mob) //Marker -Agouri
if(isrobot(user) || locked)
@@ -39,8 +44,7 @@
var/obj/item/W = O
if(smashed || localopened)
if(localopened)
- localopened = FALSE
- update_icon_closing()
+ operate_panel()
return
else
user.do_attack_animation(src)
@@ -66,6 +70,7 @@
to_chat(user, "\The [F] stays stuck to your hands!")
return
fireaxe = F
+ has_axe = "full"
contents += F
to_chat(user, "You place \the [F] back in the [name].")
update_icon()
@@ -73,18 +78,13 @@
if(smashed)
return
else
- localopened = !localopened
- if(localopened)
- update_icon_opening()
- else
- update_icon_closing()
+ operate_panel()
else
if(smashed)
return
if(istype(O, /obj/item/multitool))
if(localopened)
- localopened = FALSE
- update_icon_closing()
+ operate_panel()
return
else
to_chat(user, "Resetting circuitry...")
@@ -94,45 +94,30 @@
to_chat(user, " You re-enable the locking modules.")
return
else
- localopened = !localopened
- if(localopened)
- update_icon_opening()
- else
- update_icon_closing()
+ operate_panel()
/obj/structure/closet/fireaxecabinet/attack_hand(mob/user as mob)
if(locked)
to_chat(user, "The cabinet won't budge!")
return
- if(localopened)
- if(fireaxe)
- user.put_in_hands(fireaxe)
- to_chat(user, "You take \the [fireaxe] from [src].")
- fireaxe = null
+ if(localopened && fireaxe)
+ user.put_in_hands(fireaxe)
+ to_chat(user, "You take \the [fireaxe] from [src].")
+ has_axe = "empty"
+ fireaxe = null
- add_fingerprint(user)
- update_icon()
- else
- if(smashed)
- return
- else
- localopened = !localopened
- if(localopened)
- update_icon_opening()
- else
- update_icon_closing()
-
- else
- localopened = !localopened //I'm pretty sure we don't need an if(smashed) in here. In case I'm wrong and it fucks up teh cabinet, **MARKER**. -Agouri
- if(localopened)
- update_icon_opening()
- else
- update_icon_closing()
+ add_fingerprint(user)
+ update_icon()
+ return
+ if(smashed)
+ return
+ operate_panel()
/obj/structure/closet/fireaxecabinet/attack_tk(mob/user as mob)
if(localopened && fireaxe)
fireaxe.forceMove(loc)
to_chat(user, "You telekinetically remove \the [fireaxe].")
+ has_axe = "empty"
fireaxe = null
update_icon()
return
@@ -149,8 +134,7 @@
to_chat(usr, "The protective glass is broken!")
return
- localopened = !localopened
- update_icon()
+ operate_panel()
/obj/structure/closet/fireaxecabinet/verb/remove_fire_axe()
set name = "Remove Fire Axe"
@@ -163,6 +147,7 @@
if(fireaxe)
usr.put_in_hands(fireaxe)
to_chat(usr, "You take \the [fireaxe] from [src].")
+ has_axe = "empty"
fireaxe = null
else
to_chat(usr, "[src] is empty.")
@@ -181,21 +166,28 @@
else
to_chat(user, "Cabinet unlocked.")
-/obj/structure/closet/fireaxecabinet/proc/update_icon_opening()
- var/hasaxe = fireaxe != null
- icon_state = "fireaxe[hasaxe][localopened][hitstaken][smashed]opening"
- spawn(10)
- update_icon()
+/obj/structure/closet/fireaxecabinet/proc/operate_panel()
+ if(operating)
+ return
+ operating = TRUE
+ localopened = !localopened
+ do_animate()
+ operating = FALSE
-/obj/structure/closet/fireaxecabinet/proc/update_icon_closing()
- var/hasaxe = fireaxe != null
- icon_state = "fireaxe[hasaxe][localopened][hitstaken][smashed]closing"
- spawn(10)
- update_icon()
+/obj/structure/closet/fireaxecabinet/proc/do_animate()
+ if(!localopened)
+ flick("fireaxe_[has_axe]_closing", src)
+ else
+ flick("fireaxe_[has_axe]_opening", src)
+ sleep(10)
+ update_icon()
-/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 = fireaxe != null
- icon_state = "fireaxe[hasaxe][localopened][hitstaken][smashed]"
+
+/obj/structure/closet/fireaxecabinet/update_icon()
+ if(localopened && !smashed)
+ icon_state = "fireaxe_[has_axe]_open"
+ return
+ icon_state = "fireaxe_[has_axe]_[hitstaken]hits"
/obj/structure/closet/fireaxecabinet/open()
return
diff --git a/icons/obj/closet.dmi b/icons/obj/closet.dmi
index c4d79217b0f..c7e8951ba8c 100644
Binary files a/icons/obj/closet.dmi and b/icons/obj/closet.dmi differ