Oh fireaxe closet why you so bloated

This commit is contained in:
Vi3trice
2021-11-08 19:37:53 -05:00
parent e2c10ec83d
commit 1a99534125
2 changed files with 49 additions and 57 deletions

View File

@@ -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)
. = ..()
. += "<span class='notice'>Use a multitool to lock/unlock it.</span>"
if(!smashed)
. += "<span class='notice'>Use a multitool to lock/unlock it.</span>"
else
. += "<span class='notice'>It is damaged beyond repair.</span>"
/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, "<span class='warning'>\The [F] stays stuck to your hands!</span>")
return
fireaxe = F
has_axe = "full"
contents += F
to_chat(user, "<span class='notice'>You place \the [F] back in the [name].</span>")
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, "<span class='warning'>Resetting circuitry...</span>")
@@ -94,45 +94,30 @@
to_chat(user, "<span class = 'caution'> You re-enable the locking modules.</span>")
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, "<span class='warning'>The cabinet won't budge!</span>")
return
if(localopened)
if(fireaxe)
user.put_in_hands(fireaxe)
to_chat(user, "<span class='notice'>You take \the [fireaxe] from [src].</span>")
fireaxe = null
if(localopened && fireaxe)
user.put_in_hands(fireaxe)
to_chat(user, "<span class='notice'>You take \the [fireaxe] from [src].</span>")
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, "<span class='notice'>You telekinetically remove \the [fireaxe].</span>")
has_axe = "empty"
fireaxe = null
update_icon()
return
@@ -149,8 +134,7 @@
to_chat(usr, "<span class='notice'>The protective glass is broken!</span>")
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, "<span class='notice'>You take \the [fireaxe] from [src].</span>")
has_axe = "empty"
fireaxe = null
else
to_chat(usr, "<span class='notice'>[src] is empty.</span>")
@@ -181,21 +166,28 @@
else
to_chat(user, "<span class='notice'>Cabinet unlocked.</span>")
/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