From 4226c61d3ddbee622cd9ca6eae1a5283b819594c Mon Sep 17 00:00:00 2001 From: CRUNCH <143041327+Fordoxia@users.noreply.github.com> Date: Tue, 25 Mar 2025 10:17:40 +0000 Subject: [PATCH] Makes APCs Less Annoying to Construct/Deconstruct (#28602) * UNLIMITED POOOWWWWEEERRR! * Update apc_construction.dm * Update apc_construction.dm * Update apc_construction.dm --- code/__DEFINES/apc_defines.dm | 1 - code/modules/power/apc/apc.dm | 4 +- code/modules/power/apc/apc_construction.dm | 119 ++++++++++++--------- 3 files changed, 72 insertions(+), 52 deletions(-) diff --git a/code/__DEFINES/apc_defines.dm b/code/__DEFINES/apc_defines.dm index 174d104c956..3a24cd6690f 100644 --- a/code/__DEFINES/apc_defines.dm +++ b/code/__DEFINES/apc_defines.dm @@ -16,7 +16,6 @@ //electronics_state #define APC_ELECTRONICS_NONE 0 #define APC_ELECTRONICS_INSTALLED 1 -#define APC_ELECTRONICS_SECURED 2 /// Power channel is off, anything connected to it is not powered, cannot be set manually by players #define APC_CHANNEL_SETTING_OFF 0 diff --git a/code/modules/power/apc/apc.dm b/code/modules/power/apc/apc.dm index cc85ddc061c..de1cd920af3 100644 --- a/code/modules/power/apc/apc.dm +++ b/code/modules/power/apc/apc.dm @@ -181,7 +181,7 @@ GLOB.apcs = sortAtom(GLOB.apcs) return - electronics_state = APC_ELECTRONICS_SECURED + electronics_state = APC_ELECTRONICS_INSTALLED // is starting with a power cell installed, create it and set its charge level if(cell_type) cell = new /obj/item/stock_parts/cell/upgraded(src) @@ -328,6 +328,8 @@ electronics_state = APC_ELECTRONICS_INSTALLED locked = FALSE to_chat(user, "You place [used] inside the frame.") + stat &= ~MAINT + update_icon() qdel(used) return ITEM_INTERACT_COMPLETE diff --git a/code/modules/power/apc/apc_construction.dm b/code/modules/power/apc/apc_construction.dm index 03e4e93d062..6d44abca0fd 100644 --- a/code/modules/power/apc/apc_construction.dm +++ b/code/modules/power/apc/apc_construction.dm @@ -10,98 +10,110 @@ if(opened != APC_COVER_OFF) opened = APC_COVER_OFF coverlocked = FALSE - visible_message("The APC cover is knocked down!") + visible_message( + "The APC cover falls off!", + "You hear a small flat object falling to the floor!" + ) update_icon() - /obj/machinery/power/apc/crowbar_act(mob/living/user, obj/item/I) . = TRUE if(!I.tool_start_check(src, user, 0)) return + if(opened) // a) on open apc if(electronics_state == APC_ELECTRONICS_INSTALLED) if(terminal) to_chat(user, "Disconnect the wires first!") return + to_chat(user, "You start trying to remove the APC electronics..." ) if(I.use_tool(src, user, 50, volume = I.tool_volume)) if(has_electronics()) electronics_state = APC_ELECTRONICS_NONE if(stat & BROKEN) - user.visible_message(\ - "[user.name] has broken the APC electronics inside [name]!", + user.visible_message( + "[user.name] rips out the broken the APC electronics inside [name]!", "You break the charred APC electronics and remove the remains.", - "You hear a crack.") + "You hear metallic levering and a crack.") + stat |= MAINT + update_icon() return + //SSticker.mode:apcs-- //XSI said no and I agreed. -rastaf0 - else if(emagged) // We emag board, not APC's frame + if(emagged) // We emag board, not APC's frame emagged = FALSE user.visible_message( - "[user.name] has discarded the shorted APC electronics from [name]!", - "You discarded the shorted board.") + "[user.name] has discarded the shorted APC electronics from [name]!", + "You discarded the shorted board.", + "You hear metallic levering." + ) + stat |= MAINT + update_icon() return - else if(malfhack) // AI hacks board, not APC's frame + + if(malfhack) // AI hacks board, not APC's frame user.visible_message(\ - "[user.name] has discarded the strangely programmed APC electronics from [name]!", - "You discarded the strangely programmed board.") + "[user.name] has discarded the strangely programmed APC electronics from [name]!", + "You discarded the strangely programmed board.", + "You hear metallic levering." + ) malfai = null malfhack = FALSE + stat |= MAINT + update_icon() return - else - user.visible_message(\ - "[user.name] has removed the APC electronics from [name]!", - "You remove the APC electronics.") - new /obj/item/apc_electronics(loc) - return - else if(opened != APC_COVER_OFF) //cover isn't removed + + user.visible_message(\ + "[user.name] has removed the APC electronics from [name]!", + "You remove the APC electronics.", + "You hear metallic levering." + ) + new /obj/item/apc_electronics(loc) + stat |= MAINT + update_icon() + return + + if(opened != APC_COVER_OFF) //cover isn't removed opened = APC_CLOSED coverlocked = TRUE //closing cover relocks it update_icon() return - else if(!(stat & BROKEN)) // b) on closed and not broken APC + + if(!(stat & BROKEN)) // b) on closed and not broken APC if(coverlocked && !(stat & MAINT)) // locked... to_chat(user, "The cover is locked and cannot be opened!") return - else if(panel_open) // wires are exposed + + if(panel_open) // wires are exposed to_chat(user, "Exposed wires prevents you from opening it!") return - else - opened = APC_OPENED - update_icon() + + opened = APC_OPENED + update_icon() /obj/machinery/power/apc/screwdriver_act(mob/living/user, obj/item/I) . = TRUE if(!I.use_tool(src, user, 0, volume = I.tool_volume)) return - else if(opened) - if(cell && !(stat & MAINT)) - to_chat(user, "Close the APC first!") //Less hints more mystery! - return - else - if(electronics_state == APC_ELECTRONICS_INSTALLED) - electronics_state = APC_ELECTRONICS_SECURED - stat &= ~MAINT - to_chat(user, "You screw the circuit electronics into place.") - else if(electronics_state == APC_ELECTRONICS_SECURED) - electronics_state = APC_ELECTRONICS_INSTALLED - stat |= MAINT - to_chat(user, "You unfasten the electronics.") - else - to_chat(user, "There is nothing to secure!") - return - update_icon() - else if(emagged) - to_chat(user, "The interface is broken!") - else - panel_open = !panel_open - to_chat(user, "The wires have been [panel_open ? "exposed" : "unexposed"]") - update_icon() + if(opened) + to_chat(user, "Close the APC first!") //Less hints more mystery! + return + + if(emagged) + to_chat(user, "The interface is broken!") + return + + panel_open = !panel_open + to_chat(user, "The wires have been [panel_open ? "exposed" : "unexposed"]") + update_icon() /obj/machinery/power/apc/wirecutter_act(mob/living/user, obj/item/I) . = TRUE if(!I.use_tool(src, user, 0, volume = I.tool_volume)) return + if(panel_open && !opened) wires.Interact(user) else if(terminal && opened) @@ -111,25 +123,32 @@ . = TRUE if(!I.use_tool(src, user, 0, volume = I.tool_volume)) return + if(panel_open && !opened) wires.Interact(user) /obj/machinery/power/apc/welder_act(mob/user, obj/item/I) if(!opened || has_electronics() || terminal) return + . = TRUE if(!I.tool_use_check(user, 3)) return + WELDER_ATTEMPT_SLICING_MESSAGE if(I.use_tool(src, user, 50, amount = 3, volume = I.tool_volume)) if((stat & BROKEN) || opened == APC_COVER_OFF) new /obj/item/stack/sheet/metal(loc) user.visible_message(\ - "[user.name] has cut [src] apart with [I].",\ - "You disassembled the broken APC frame.") + "[user.name] has cut [src] apart with [I].", + "You disassembled the broken APC frame.", + "You hear welding." + ) else new /obj/item/mounted/frame/apc_frame(loc) user.visible_message(\ - "[user.name] has cut [src] from the wall with [I].",\ - "You cut the APC frame from the wall.") + "[user.name] has cut [src] from the wall with [I].", + "You cut the APC frame from the wall.", + "You hear welding." + ) qdel(src)