From 3ce60cf7c48af07cf2a8d9d0ea443dbeae5e6535 Mon Sep 17 00:00:00 2001 From: Firewolf34 Date: Mon, 25 Feb 2019 03:17:07 +0000 Subject: [PATCH 1/4] Ports my Fireaxe Cabinet Improvements PR from the Legacy Yogstation Server! --- code/game/objects/structures/fireaxe.dm | 51 +++++++++---------- yogstation.dme | 1 + .../code/game/objects/structures/fireaxe.dm | 33 ++++++++++++ 3 files changed, 59 insertions(+), 26 deletions(-) create mode 100644 yogstation/code/game/objects/structures/fireaxe.dm diff --git a/code/game/objects/structures/fireaxe.dm b/code/game/objects/structures/fireaxe.dm index f29c0899cf67..585d9d9d4b32 100644 --- a/code/game/objects/structures/fireaxe.dm +++ b/code/game/objects/structures/fireaxe.dm @@ -6,7 +6,7 @@ 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 @@ -23,9 +23,12 @@ 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 @@ -38,10 +41,11 @@ else to_chat(user, "[src] is already in good condition!") 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, "You need two glass sheets to fix [src]!") + to_chat(user, "You need two reinforced glass sheets to fix [src]!")//yogs - change to reinforced glass return to_chat(user, "You start fixing [src]...") if(do_after(user, 20, target = src) && G.use(2)) @@ -49,6 +53,7 @@ obj_integrity = max_integrity update_icon() 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) @@ -61,7 +66,15 @@ update_icon() return else if(!broken) + //open the cabinet normally. toggle_open() + //yogs start - adds unlock if authorized + else if (I.GetID()) + if (allowed(user)) + toggle_lock() + else + to_chat(user, "Access denied.") + //yogs end else return ..() @@ -116,13 +129,8 @@ src.add_fingerprint(user) update_icon() return - if(locked) - to_chat(user, "The [name] won't budge!") - 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) @@ -132,13 +140,8 @@ return /obj/structure/fireaxecabinet/attack_tk(mob/user) - if(locked) - to_chat(user, "The [name] won't budge!") - return - else - open = !open - update_icon() - return + toggle_open()//yogs - consolidates opening code + return /obj/structure/fireaxecabinet/update_icon() cut_overlays() @@ -165,13 +168,8 @@ else add_overlay("glass_raised") -/obj/structure/fireaxecabinet/proc/toggle_lock(mob/user) - to_chat(user, " Resetting circuitry...") - playsound(src, 'sound/machines/locktoggle.ogg', 50, 1) - if(do_after(user, 20, target = src)) - to_chat(user, "You [locked ? "disable" : "re-enable"] the locking modules.") - locked = !locked - update_icon() +//yogs NOTICE - toggle_lock function MIRRORED to yogstation/code/game/objects/structure/fireaxe.dm +//obj/structure/fireaxecabinet/proc/toggle_lock(mob/user) /obj/structure/fireaxecabinet/verb/toggle_open() set name = "Open/Close" @@ -182,6 +180,7 @@ to_chat(usr, "The [name] won't budge!") return else + playsound(loc, 'sound/machines/click.ogg', 15, 1, -3)//yogs - adds open/close sound open = !open update_icon() return diff --git a/yogstation.dme b/yogstation.dme index 26eedf4896bc..e8d3eca81662 100644 --- a/yogstation.dme +++ b/yogstation.dme @@ -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" diff --git a/yogstation/code/game/objects/structures/fireaxe.dm b/yogstation/code/game/objects/structures/fireaxe.dm new file mode 100644 index 000000000000..d9755221d922 --- /dev/null +++ b/yogstation/code/game/objects/structures/fireaxe.dm @@ -0,0 +1,33 @@ +/obj/structure/fireaxecabinet + req_access = list(ACCESS_ATMOSPHERICS) + +/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)) + playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) + if(do_after(user, 40/I.toolspeed, target = src)) + to_chat(user, "You disassemble the [name].") + 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() + return + +/obj/structure/fireaxecabinet/proc/reset_lock(mob/user) + //this happens when you hack the lock with a multitool, synthetic/AI, or an emag. + if(!open) + to_chat(user, "Resetting circuitry...") + if(do_after(user, 60, target = src)) + to_chat(user, "You [locked ? "disable" : "re-enable"] the locking modules.") + src.add_fingerprint(user) + toggle_lock(user) + +/obj/structure/fireaxecabinet/proc/toggle_lock(mob/user)//<-- mirrored/overwritten proc + //this happens when you actuate the lock normally (e.g., you have access to the fireaxe cab) + 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() \ No newline at end of file From 78dd88e2cff24d62678ac6087f9191cc0efe8410 Mon Sep 17 00:00:00 2001 From: Firewolf34 Date: Mon, 25 Feb 2019 03:52:16 +0000 Subject: [PATCH 2/4] Adds alt-clicking support for opening Fireaxe Cab, similar to how lockers work --- code/game/objects/structures/fireaxe.dm | 6 +++++ .../code/game/objects/structures/fireaxe.dm | 22 +++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/code/game/objects/structures/fireaxe.dm b/code/game/objects/structures/fireaxe.dm index 585d9d9d4b32..bef26f67312b 100644 --- a/code/game/objects/structures/fireaxe.dm +++ b/code/game/objects/structures/fireaxe.dm @@ -52,6 +52,10 @@ broken = 0 obj_integrity = max_integrity update_icon() + //yogs start - warns you if you try to fix it with regular glass + else if(istype(I, /obj/item/stack/sheet/glass) && broken) + to_chat(user, "You need reinforced glass sheets to fix [src]!") + //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) @@ -102,6 +106,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)) diff --git a/yogstation/code/game/objects/structures/fireaxe.dm b/yogstation/code/game/objects/structures/fireaxe.dm index d9755221d922..8fc3679f216a 100644 --- a/yogstation/code/game/objects/structures/fireaxe.dm +++ b/yogstation/code/game/objects/structures/fireaxe.dm @@ -12,20 +12,34 @@ 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()//deconstruct then spawns an additional 2 metal, so you recover more mats using a wrench to decon than just destroying it. return /obj/structure/fireaxecabinet/proc/reset_lock(mob/user) - //this happens when you hack the lock with a multitool, synthetic/AI, or an emag. + //this happens when you hack the lock as a synthetic/AI, or with a multitool or an emag. if(!open) to_chat(user, "Resetting circuitry...") - if(do_after(user, 60, target = src)) + if(do_after(user, 100, target = src)) to_chat(user, "You [locked ? "disable" : "re-enable"] the locking modules.") 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, "Access denied.") + else + //open the cabinet normally. + toggle_open() + /obj/structure/fireaxecabinet/proc/toggle_lock(mob/user)//<-- mirrored/overwritten proc - //this happens when you actuate the lock normally (e.g., you have access to the fireaxe cab) + //this happens when you actuate the lock status. 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) From d2c568b697ac3546e883e41a2a6520f40d10718e Mon Sep 17 00:00:00 2001 From: Firewolf34 Date: Mon, 25 Feb 2019 05:25:20 +0000 Subject: [PATCH 3/4] Makes the Fireaxe Cabinet able to be Emagged --- code/game/objects/structures/fireaxe.dm | 24 +++++++-- .../code/game/objects/structures/fireaxe.dm | 49 +++++++++++++++++-- 2 files changed, 66 insertions(+), 7 deletions(-) diff --git a/code/game/objects/structures/fireaxe.dm b/code/game/objects/structures/fireaxe.dm index bef26f67312b..cb31265205b9 100644 --- a/code/game/objects/structures/fireaxe.dm +++ b/code/game/objects/structures/fireaxe.dm @@ -12,11 +12,15 @@ 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) @@ -74,8 +78,11 @@ toggle_open() //yogs start - adds unlock if authorized else if (I.GetID()) + if(obj_flags & EMAGGED) + to_chat(user, "The [name]'s locking modules are unresponsive.") + return if (allowed(user)) - toggle_lock() + toggle_lock(user) else to_chat(user, "Access denied.") //yogs end @@ -93,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 . = ..() @@ -174,8 +185,15 @@ else add_overlay("glass_raised") -//yogs NOTICE - toggle_lock function MIRRORED to yogstation/code/game/objects/structure/fireaxe.dm -//obj/structure/fireaxecabinet/proc/toggle_lock(mob/user) +//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, " Resetting circuitry...") + playsound(src, 'sound/machines/locktoggle.ogg', 50, 1) + if(do_after(user, 20, target = src)) + to_chat(user, "You [locked ? "disable" : "re-enable"] the locking modules.") + locked = !locked + update_icon() /obj/structure/fireaxecabinet/verb/toggle_open() set name = "Open/Close" diff --git a/yogstation/code/game/objects/structures/fireaxe.dm b/yogstation/code/game/objects/structures/fireaxe.dm index 8fc3679f216a..be4a35e54c6e 100644 --- a/yogstation/code/game/objects/structures/fireaxe.dm +++ b/yogstation/code/game/objects/structures/fireaxe.dm @@ -1,5 +1,21 @@ /obj/structure/fireaxecabinet - req_access = list(ACCESS_ATMOSPHERICS) + 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)) @@ -16,7 +32,10 @@ return /obj/structure/fireaxecabinet/proc/reset_lock(mob/user) - //this happens when you hack the lock as a synthetic/AI, or with a multitool or an emag. + //this happens when you hack the lock as a synthetic/AI, or with a multitool. + if(obj_flags & EMAGGED) + to_chat(user, "You try to reset the [name]'s circuits, but they're completely burnt out.") + return if(!open) to_chat(user, "Resetting circuitry...") if(do_after(user, 100, target = src)) @@ -38,10 +57,32 @@ //open the cabinet normally. toggle_open() -/obj/structure/fireaxecabinet/proc/toggle_lock(mob/user)//<-- mirrored/overwritten proc +/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, "The [name]'s locking modules are unresponsive.") + 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() \ No newline at end of file + 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) + to_chat(user, "You short out the [name]'s locking modules.") + visible_message("Sparks fly out of the [src]'s locking modules!") + spark_system.start() + + src.add_fingerprint(user) + obj_flags |= EMAGGED + desc += "
Its access panel is smoking slightly." + + 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. \ No newline at end of file From 06fc37b41e1e170f863e4e8ea3a53c393fef2a3a Mon Sep 17 00:00:00 2001 From: Firewolf34 Date: Mon, 25 Feb 2019 06:19:48 +0000 Subject: [PATCH 4/4] Improved some of the messages the Fireaxe Cabinet uses, to improve user understanding of mechanics --- code/game/objects/structures/fireaxe.dm | 4 ++-- .../code/game/objects/structures/fireaxe.dm | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/code/game/objects/structures/fireaxe.dm b/code/game/objects/structures/fireaxe.dm index cb31265205b9..19aa147f8bb7 100644 --- a/code/game/objects/structures/fireaxe.dm +++ b/code/game/objects/structures/fireaxe.dm @@ -1,6 +1,6 @@ /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.
There are bolts under it's glass cover for easy disassembly using a wrench." icon = 'icons/obj/wallmounts.dmi' icon_state = "fireaxe" anchored = TRUE @@ -56,7 +56,7 @@ broken = 0 obj_integrity = max_integrity update_icon() - //yogs start - warns you if you try to fix it with regular glass + //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, "You need reinforced glass sheets to fix [src]!") //yogs end diff --git a/yogstation/code/game/objects/structures/fireaxe.dm b/yogstation/code/game/objects/structures/fireaxe.dm index be4a35e54c6e..6e89898b516b 100644 --- a/yogstation/code/game/objects/structures/fireaxe.dm +++ b/yogstation/code/game/objects/structures/fireaxe.dm @@ -19,6 +19,10 @@ /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("[user] disassembles the [name].", \ + "You start to disassemble the [name]...", \ + "You hear wrenching.") playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) if(do_after(user, 40/I.toolspeed, target = src)) to_chat(user, "You disassemble the [name].") @@ -29,7 +33,17 @@ 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, "You need to open the door first to access the [src]'s bolts!") + //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, "You need to remove the fireaxe first to deconstruct the [src]!") + return /obj/structure/fireaxecabinet/proc/reset_lock(mob/user) //this happens when you hack the lock as a synthetic/AI, or with a multitool. @@ -73,8 +87,9 @@ if(obj_flags & EMAGGED) return if(!open && locked) - to_chat(user, "You short out the [name]'s locking modules.") - visible_message("Sparks fly out of the [src]'s locking modules!") + user.visible_message("Sparks fly out of the [src]'s locking modules!", \ + "You short out the [name]'s locking modules.", \ + "You hear electricity arcing.") spark_system.start() src.add_fingerprint(user)