Apc covers can now be repaired and replaced (#75129)

You can now weld an unbroken but damaged Apc cover in order to repair
its integrity.

If an Apc cover is broken you can crowbar it off and replace it with a
new one using an Apc frame (but you'll need to weld its integrity back
up to reinforce the haphazard connections you've made)

I also went ahead and added comments to some of the code because Apc
code is a little daunting.
This commit is contained in:
moocowswag
2023-05-25 18:09:37 +00:00
committed by GitHub
parent dbb337ec90
commit aa6d82f37e
4 changed files with 53 additions and 1 deletions
+13
View File
@@ -25,3 +25,16 @@
to_chat(user, span_notice("You cut the cables and disassemble the unused power terminal."))
qdel(E)
return TRUE
/obj/item/wallframe/apc/screwdriver_act(mob/living/user, obj/item/tool)
//overriding the wallframe parent screwdriver act with this one which allows applying to existing apc frames.
var/turf/T = get_step(get_turf(user), user.dir)
if(iswallturf(T))
if(locate(/obj/machinery/power/apc) in get_turf(user))
var/obj/machinery/power/apc/mounted_apc = locate(/obj/machinery/power/apc) in get_turf(user)
mounted_apc.attackby(src, user)
return TOOL_ACT_TOOLTYPE_SUCCESS
T.attackby(src, user)
return TOOL_ACT_TOOLTYPE_SUCCESS
+3 -1
View File
@@ -139,12 +139,14 @@
if(!(machine_stat & BROKEN || opened == APC_COVER_REMOVED || atom_integrity < max_integrity)) // There is nothing to repair
balloon_alert(user, "no reason for repairs!")
return
if(!(machine_stat & BROKEN) && opened == APC_COVER_REMOVED) // Cover is the only thing broken, we do not need to remove elctronicks to replace cover
if((machine_stat & BROKEN) && opened == APC_COVER_REMOVED && has_electronics && terminal) // Cover is the only thing broken, we do not need to remove elctronicks to replace cover
user.visible_message(span_notice("[user.name] replaces missing APC's cover."))
balloon_alert(user, "replacing APC's cover...")
if(do_after(user, 20, target = src)) // replacing cover is quicker than replacing whole frame
balloon_alert(user, "cover replaced")
qdel(attacking_object)
update_integrity(30) //needs to be welded to fully repair but can work without
set_machine_stat(machine_stat & ~(BROKEN|MAINT))
opened = APC_COVER_OPENED
update_appearance()
return
+5
View File
@@ -264,6 +264,11 @@
/obj/machinery/power/apc/examine(mob/user)
. = ..()
if(machine_stat & BROKEN)
if(opened != APC_COVER_REMOVED)
. += "The cover is broken and can probably be <i>pried</i> off with enough force."
return
if(terminal && has_electronics)
. += "The cover is missing but can be replaced using a new frame."
return
if(opened)
if(has_electronics && terminal)
+32
View File
@@ -1,6 +1,19 @@
//attack with an item - open/close cover, insert cell, or (un)lock interface
/obj/machinery/power/apc/crowbar_act(mob/user, obj/item/crowbar)
. = TRUE
//Prying off broken cover
if((opened == APC_COVER_CLOSED || opened == APC_COVER_OPENED) && (machine_stat & BROKEN))
crowbar.play_tool_sound(src)
balloon_alert(user, "prying...")
if(!crowbar.use_tool(src, user, 5 SECONDS))
return
opened = APC_COVER_REMOVED
balloon_alert(user, "cover removed")
update_appearance()
return
//Opening and closing cover
if((!opened && opened != APC_COVER_REMOVED) && !(machine_stat & BROKEN))
if(coverlocked && !(machine_stat & MAINT)) // locked...
balloon_alert(user, "cover is locked!")
@@ -20,6 +33,7 @@
update_appearance()
return
//Taking out the electronics
if(!opened || has_electronics != APC_ELECTRONICS_INSTALLED)
return
if(terminal)
@@ -101,6 +115,24 @@
/obj/machinery/power/apc/welder_act(mob/living/user, obj/item/welder)
. = ..()
//repairing the cover
if((atom_integrity < max_integrity) && has_electronics)
if(opened == APC_COVER_REMOVED)
balloon_alert(user, "no cover to repair!")
return
if (machine_stat & BROKEN)
balloon_alert(user, "too damaged to repair!")
return
if(!welder.tool_start_check(user, amount=0))
return
balloon_alert(user, "repairing...")
if(welder.use_tool(src, user, 4 SECONDS, volume = 50))
update_integrity(min(atom_integrity += 50,max_integrity))
balloon_alert(user, "repaired")
return TOOL_ACT_TOOLTYPE_SUCCESS
//disassembling the frame
if(!opened || has_electronics || terminal)
return
if(!welder.tool_start_check(user, amount=3))