Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 43 additions & 20 deletions code/game/objects/structures/fireaxe.dm
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
/obj/structure/fireaxecabinet
name = "fire axe cabinet"
desc = "There is a small label that reads \"For Emergency use only\" along with details for safe use of the axe. As if."
desc = "There is a small label that reads \"For Emergency use only\" along with details for safe use of the axe. As if.<BR>There are bolts under it's glass cover for easy disassembly using a wrench."
icon = 'icons/obj/wallmounts.dmi'
icon_state = "fireaxe"
anchored = TRUE
density = FALSE
armor = list("melee" = 50, "bullet" = 20, "laser" = 0, "energy" = 100, "bomb" = 10, "bio" = 100, "rad" = 100, "fire" = 90, "acid" = 50)
max_integrity = 150
max_integrity = 200//yogs - increase durability to 200
integrity_failure = 50
var/locked = TRUE
var/open = FALSE
var/obj/item/twohanded/fireaxe/fireaxe

//yogs NOTICE - Initialize() function MIRRORED to yogstation/code/game/objects/structure/fireaxe.dm
//changes made to the below function will have no effect
/obj/structure/fireaxecabinet/Initialize()
. = ..()
fireaxe = new
update_icon()

//yogs NOTICE - Destroy() function MIRRORED to yogstation/code/game/objects/structure/fireaxe.dm
//changes made to the below function will have no effect
/obj/structure/fireaxecabinet/Destroy()
if(fireaxe)
QDEL_NULL(fireaxe)
return ..()

/obj/structure/fireaxecabinet/attackby(obj/item/I, mob/user, params)
check_deconstruct(I, user)//yogs - deconstructible cabinet

if(iscyborg(user) || I.tool_behaviour == TOOL_MULTITOOL)
toggle_lock(user)
reset_lock(user) //yogs - adds reset option
else if(I.tool_behaviour == TOOL_WELDER && user.a_intent == INTENT_HELP && !broken)
//Repairing light damage with a welder
if(obj_integrity < max_integrity)
if(!I.tool_start_check(user, amount=2))
return
Expand All @@ -38,17 +45,23 @@
else
to_chat(user, "<span class='warning'>[src] is already in good condition!</span>")
return
else if(istype(I, /obj/item/stack/sheet/glass) && broken)
var/obj/item/stack/sheet/glass/G = I
else if(istype(I, /obj/item/stack/sheet/rglass) && broken)//yogs - change to reinforced glass
//Repairing a heavily damaged fireaxe cabinet with glass
var/obj/item/stack/sheet/rglass/G = I//yogs - change to reinforced glass
if(G.get_amount() < 2)
to_chat(user, "<span class='warning'>You need two glass sheets to fix [src]!</span>")
to_chat(user, "<span class='warning'>You need two reinforced glass sheets to fix [src]!</span>")//yogs - change to reinforced glass
return
to_chat(user, "<span class='notice'>You start fixing [src]...</span>")
if(do_after(user, 20, target = src) && G.use(2))
broken = 0
obj_integrity = max_integrity
update_icon()
//yogs start - warn user if they use the wrong type of glass to repair
else if(istype(I, /obj/item/stack/sheet/glass) && broken)
to_chat(user, "<span class='warning'>You need reinforced glass sheets to fix [src]!</span>")
//yogs end
else if(open || broken)
//Fireaxe cabinet is open or broken, so we can access it's axe slot
if(istype(I, /obj/item/twohanded/fireaxe) && !fireaxe)
var/obj/item/twohanded/fireaxe/F = I
if(F.wielded)
Expand All @@ -61,7 +74,18 @@
update_icon()
return
else if(!broken)
//open the cabinet normally.
toggle_open()
//yogs start - adds unlock if authorized
else if (I.GetID())
if(obj_flags & EMAGGED)
to_chat(user, "<span class='notice'>The [name]'s locking modules are unresponsive.</span>")
return
if (allowed(user))
toggle_lock(user)
else
to_chat(user, "<span class='danger'>Access denied.</span>")
//yogs end
else
return ..()

Expand All @@ -76,6 +100,10 @@
playsound(src.loc, 'sound/items/welder.ogg', 100, 1)

/obj/structure/fireaxecabinet/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir)
//yogs start - adds sparks on damage
if(prob(30))
spark_system.start()
//yogs end
if(open)
return
. = ..()
Expand All @@ -89,6 +117,8 @@
playsound(src, 'sound/effects/glassbr3.ogg', 100, 1)
new /obj/item/shard(loc)
new /obj/item/shard(loc)
new /obj/item/stack/rods(loc)//yogs - adds metal rods for reinforced glass
new /obj/item/stack/rods(loc)//yogs - adds metal rods for reinforced glass

/obj/structure/fireaxecabinet/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1))
Expand Down Expand Up @@ -116,13 +146,8 @@
src.add_fingerprint(user)
update_icon()
return
if(locked)
to_chat(user, "<span class='warning'>The [name] won't budge!</span>")
return
else
open = !open
update_icon()
return
toggle_open()//yogs - consolidates opening code
return

/obj/structure/fireaxecabinet/attack_paw(mob/living/user)
return attack_hand(user)
Expand All @@ -132,13 +157,8 @@
return

/obj/structure/fireaxecabinet/attack_tk(mob/user)
if(locked)
to_chat(user, "<span class='warning'>The [name] won't budge!</span>")
return
else
open = !open
update_icon()
return
toggle_open()//yogs - consolidates opening code
return

/obj/structure/fireaxecabinet/update_icon()
cut_overlays()
Expand All @@ -165,6 +185,8 @@
else
add_overlay("glass_raised")

//yogs NOTICE - toggle_lock() function MIRRORED to yogstation/code/game/objects/structure/fireaxe.dm
//changes made to the below function will have no effect
/obj/structure/fireaxecabinet/proc/toggle_lock(mob/user)
to_chat(user, "<span class = 'caution'> Resetting circuitry...</span>")
playsound(src, 'sound/machines/locktoggle.ogg', 50, 1)
Expand All @@ -182,6 +204,7 @@
to_chat(usr, "<span class='warning'>The [name] won't budge!</span>")
return
else
playsound(loc, 'sound/machines/click.ogg', 15, 1, -3)//yogs - adds open/close sound
open = !open
update_icon()
return
1 change: 1 addition & 0 deletions yogstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2905,6 +2905,7 @@
#include "yogstation\code\game\objects\items\storage\toolbox.dm"
#include "yogstation\code\game\objects\items\storage\uplink_kits.dm"
#include "yogstation\code\game\objects\structures\bedsheet_bin.dm"
#include "yogstation\code\game\objects\structures\fireaxe.dm"
#include "yogstation\code\game\objects\structures\ghost_role_spawners.dm"
#include "yogstation\code\game\objects\structures\table_frames.dm"
#include "yogstation\code\game\objects\structures\tables_racks.dm"
Expand Down
103 changes: 103 additions & 0 deletions yogstation/code/game/objects/structures/fireaxe.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/obj/structure/fireaxecabinet
req_access = list(ACCESS_ATMOSPHERICS) //adds ATMOSPHERICS access requirement for the lock on the cabinet.
var/datum/effect_system/spark_spread/spark_system //the spark system, used for generating... sparks?

/obj/structure/fireaxecabinet/Initialize()//<-- mirrored/overwritten proc
. = ..()
fireaxe = new
update_icon()
//Sets up a spark system
spark_system = new /datum/effect_system/spark_spread
spark_system.set_up(2, 1, src)
spark_system.attach(src)

/obj/structure/fireaxecabinet/Destroy()//<-- mirrored/overwritten proc
if(fireaxe)
QDEL_NULL(fireaxe)
QDEL_NULL(spark_system)
return ..()

/obj/structure/fireaxecabinet/proc/check_deconstruct(obj/item/I, mob/user)
if(istype(I, /obj/item/wrench) && !(flags_1 & NODECONSTRUCT_1) && !fireaxe && (open || broken || obj_integrity >= max_integrity))
//User is attempting to wrench an open/broken fireaxe cabinet with NO fireaxe in it
user.visible_message("<span class='warning'>[user] disassembles the [name].</span>", \
"You start to disassemble the [name]...", \
"<span class='italics'>You hear wrenching.</span>")
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
if(do_after(user, 40/I.toolspeed, target = src))
to_chat(user, "<span class='notice'>You disassemble the [name].</span>")
var/obj/item/stack/sheet/metal/M = new (loc, 3)//spawn three metal for deconstruction
if (prob(50))
M.add_fingerprint(user)
var/obj/item/stack/sheet/rglass/G = new (loc, 2)//spawn two reinforced glass for it's window
if (prob(50))
G.add_fingerprint(user)
deconstruct()//deconstruct then spawns an additional 2 metal, so you recover more mats using a wrench to decon than just destroying it.
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
return
else if(istype(I, /obj/item/wrench) && !(flags_1 & NODECONSTRUCT_1) && !broken && !open)
//User is attempting to wrench a closed & non-broken fireaxe cab
to_chat(user, "<span class='warning'>You need to open the door first to access the [src]'s bolts!</span>")
//Still allow damage to pass through, in case they are trying to destroy the cab's window with the wrench.
return ..()
else if(istype(I, /obj/item/wrench) && !(flags_1 & NODECONSTRUCT_1) && (open || broken) && fireaxe)
//User is attempting to wrench an open and ready fireaxe cabinet, but the axe is still in it's slot.
to_chat(user, "<span class='warning'>You need to remove the fireaxe first to deconstruct the [src]!</span>")
return

/obj/structure/fireaxecabinet/proc/reset_lock(mob/user)
//this happens when you hack the lock as a synthetic/AI, or with a multitool.
if(obj_flags & EMAGGED)
to_chat(user, "<span class='notice'>You try to reset the [name]'s circuits, but they're completely burnt out.</span>")
return
if(!open)
to_chat(user, "<span class = 'caution'>Resetting circuitry...</span>")
if(do_after(user, 100, target = src))
to_chat(user, "<span class='caution'>You [locked ? "disable" : "re-enable"] the locking modules.</span>")
src.add_fingerprint(user)
toggle_lock(user)


/obj/structure/fireaxecabinet/AltClick(mob/user)
//Alt-Click can be used to unlock without swiping your ID (assuming you have access), or open/close an unlocked cabinet
//This has the side-effect of allowing borgs to open it, once they unlock it. They still can't remove the axe from it though.
if(!broken)
if (locked)
if (allowed(user))
toggle_lock()
else
to_chat(user, "<span class='danger'>Access denied.</span>")
else
//open the cabinet normally.
toggle_open()

/obj/structure/fireaxecabinet/toggle_lock(mob/user)//<-- mirrored/overwritten proc
//this happens when you actuate the lock status.
if(obj_flags & EMAGGED)
to_chat(user, "<span class='notice'>The [name]'s locking modules are unresponsive.</span>")
return
if(!open)
audible_message("You hear an audible clunk as the [name]'s bolt [locked ? "retracts" : "locks into place"].")
playsound(loc, "sound/machines/locktoggle.ogg", 30, 1, -3)
locked = !locked
update_icon()

/obj/structure/fireaxecabinet/emag_act(mob/user)
//this allows you to emag the fireaxe cabinet, unlocking it immediately.
if(obj_flags & EMAGGED)
return
if(!open && locked)
user.visible_message("<span class='warning'>Sparks fly out of the [src]'s locking modules!</span>", \
"<span class='caution'>You short out the [name]'s locking modules.</span>", \
"<span class='italics'>You hear electricity arcing.</span>")
spark_system.start()

src.add_fingerprint(user)
obj_flags |= EMAGGED
desc += "<BR><span class='warning'>Its access panel is smoking slightly.</span>"

playsound(loc, "sound/machines/locktoggle.ogg", 30, 1, -3)
locked = 0
audible_message("You hear an audible clunk as the [name]'s bolt retracts.")
update_icon()
//Fireaxe Cabinet is now permanently unlocked.