From 11fa22bf10e49c76071598097f90ff857a48855e Mon Sep 17 00:00:00 2001 From: CRUNCH <143041327+Fordoxia@users.noreply.github.com> Date: Fri, 18 Apr 2025 23:07:56 +0100 Subject: [PATCH] Buffs APC Construction/Deconstruction (#28795) * initial commit * Update apc_construction.dm * Apply suggestions from code review Co-authored-by: 1080pCat <96908085+1080pCat@users.noreply.github.com> Signed-off-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com> * speed --------- Signed-off-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com> Co-authored-by: 1080pCat <96908085+1080pCat@users.noreply.github.com> --- code/modules/power/apc/apc.dm | 22 +++------------------- code/modules/power/apc/apc_construction.dm | 16 +++++++++++++++- code/tests/test_apc_construction.dm | 4 ---- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/code/modules/power/apc/apc.dm b/code/modules/power/apc/apc.dm index a72b7d2b8a0..83762150494 100644 --- a/code/modules/power/apc/apc.dm +++ b/code/modules/power/apc/apc.dm @@ -20,12 +20,8 @@ move_resist = INFINITY /*** APC construction vars***/ - // These exist here and not as defines in `apc_defines.dm` so they can be modified for `test_apc_construction.dm`. I hate that these timers exist at all. - var/apc_cover_replacement_time = 2 SECONDS - var/apc_frame_replacement_time = 5 SECONDS - var/apc_frame_welding_time = 5 SECONDS - var/apc_electronics_installation_time = 1 SECONDS - var/apc_electronics_crowbar_time = 5 SECONDS + // These exist here and not as defines in `apc_defines.dm` so they can be modified for `test_apc_construction.dm`. + var/apc_frame_welding_time = 2 SECONDS var/apc_terminal_wiring_time = 2 SECONDS // set so that APCs aren't found as powernet nodes //Hackish, Horrible, was like this before I changed it :( @@ -343,10 +339,6 @@ return ITEM_INTERACT_COMPLETE if(!has_electronics()) - to_chat(user, "You start to add [used] to [src].") - if(!do_after(user, apc_electronics_installation_time, target = src)) - return ITEM_INTERACT_COMPLETE - user.visible_message( "[user] installs [used] into [src].", "You install [used] into [src]." @@ -359,7 +351,7 @@ qdel(used) return ITEM_INTERACT_COMPLETE - // APC frame repair. + // APC frame repair. Instant, but you consume 2 metal instead of doing it for free. if(istype(used, /obj/item/mounted/frame/apc_frame) && opened) if(!(stat & BROKEN || opened == APC_COVER_OFF || obj_integrity < max_integrity)) to_chat(user, "[src] has no damage to fix!") @@ -367,10 +359,6 @@ // Only cover is broken, no need to remove any components. if(!(stat & BROKEN) && opened == APC_COVER_OFF) - to_chat(user, "You begin to replace the missing cover of [src].") - if(!do_after(user, apc_cover_replacement_time, target = src)) - return ITEM_INTERACT_COMPLETE - user.visible_message( "[user] replaces the missing cover of [src].", "You replace the missing cover of [src]." @@ -384,10 +372,6 @@ to_chat(user, "You cannot repair [src] until you remove the electronics!") return ITEM_INTERACT_COMPLETE - to_chat(user, "You begin to replace the damaged APC frame...") - if(!do_after(user, apc_frame_replacement_time, target = src)) - return ITEM_INTERACT_COMPLETE - user.visible_message( "[user] replaces the damaged frame of [src].", "You replace the damaged frame of [src]." diff --git a/code/modules/power/apc/apc_construction.dm b/code/modules/power/apc/apc_construction.dm index f091e9d7661..34732572f9e 100644 --- a/code/modules/power/apc/apc_construction.dm +++ b/code/modules/power/apc/apc_construction.dm @@ -45,7 +45,7 @@ to_chat(user, "Disconnect the wires first!") return - if(I.use_tool(src, user, apc_electronics_crowbar_time, volume = I.tool_volume)) + if(I.use_tool(src, user, FALSE, volume = I.tool_volume)) if(has_electronics()) electronics_state = APC_ELECTRONICS_NONE if(stat & BROKEN) @@ -104,6 +104,20 @@ opened = APC_OPENED update_icon() + // 3. Broken, closed APC + if((stat & BROKEN) && opened == APC_CLOSED) + if(!I.use_tool(src, user, 1 SECONDS, volume = I.tool_volume)) + return + + user.visible_message( + "[user] rips the cover off [src].", + "You rip the cover off [src].", + "You hear metallic levering and a small flat object falling to the floor!" + ) + panel_open = FALSE // Avoid wacky behavour with wires. + opened = APC_COVER_OFF + update_icon() + /obj/machinery/power/apc/screwdriver_act(mob/living/user, obj/item/I) . = TRUE diff --git a/code/tests/test_apc_construction.dm b/code/tests/test_apc_construction.dm index 1fbb366a379..45eac34d046 100644 --- a/code/tests/test_apc_construction.dm +++ b/code/tests/test_apc_construction.dm @@ -13,11 +13,7 @@ player.click_on(wall) var/obj/machinery/power/apc/apc_frame = player.find_nearby(/obj/machinery/power/apc) // Make this not take 5 billion years. - apc_frame.apc_cover_replacement_time = 0 - apc_frame.apc_frame_replacement_time = 0 apc_frame.apc_frame_welding_time = 0 - apc_frame.apc_electronics_installation_time = 0 - apc_frame.apc_electronics_crowbar_time = 0 apc_frame.apc_terminal_wiring_time = 0 var/obj/the_electronics = player.spawn_obj_in_hand(/obj/item/apc_electronics/)