From 01f56888cd78cdd933b640d244a87db3e89ed134 Mon Sep 17 00:00:00 2001 From: Killian <49700375+KillianKirilenko@users.noreply.github.com> Date: Sun, 14 May 2023 13:27:02 +0100 Subject: [PATCH] mecha nanopaste repairs fix --- code/game/mecha/components/_component.dm | 18 ++++++++++++-- code/game/mecha/mecha.dm | 24 ++++++++++++++----- .../game/objects/items/stacks/nanopaste_vr.dm | 4 +++- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/code/game/mecha/components/_component.dm b/code/game/mecha/components/_component.dm index 3d770e0dce0..4058500dd2a 100644 --- a/code/game/mecha/components/_component.dm +++ b/code/game/mecha/components/_component.dm @@ -138,12 +138,26 @@ var/obj/item/stack/nanopaste/NP = W if(integrity < max_integrity) + to_chat(user, "You start to repair damage to \the [src].") while(integrity < max_integrity && NP) - if(do_after(user, 1 SECOND, src) && NP.use(1)) - adjust_integrity(10) + if(do_after(user, 1 SECOND, src)) + NP.use(1) + adjust_integrity(NP.mech_repair) + + if(integrity >= max_integrity) + to_chat(user, "You finish repairing \the [src].") + break + + else if(NP.amount == 0) + to_chat(user, "Insufficient nanopaste to complete repairs!") + break + return + else + to_chat(user, "\The [src] doesn't require repairs.") + return ..() // Various procs to handle different calls by Exosuits. IE, movement actions, damage actions, etc. diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index f5821b18d19..1dd50dc0bfe 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -1567,15 +1567,27 @@ for(var/slot in internal_components) var/obj/item/mecha_parts/component/C = internal_components[slot] - if(C) + if(!C) + to_chat(user, "There are no components installed!") + return - if(C.integrity < C.max_integrity) - while(C.integrity < C.max_integrity && NP && do_after(user, 1 SECOND, src)) - if(NP.use(1)) - C.adjust_integrity(10) + if(C.integrity >= C.max_integrity) + to_chat(user, "\The [C] does not require repairs.") - to_chat(user, "You repair damage to \the [C].") + else if(C.integrity < C.max_integrity) + to_chat(user, "You start to repair damage to \the [C].") + while(C.integrity < C.max_integrity && NP) + if(do_after(user, 1 SECOND, src)) + NP.use(1) + C.adjust_integrity(NP.mech_repair) + if(C.integrity >= C.max_integrity) + to_chat(user, "You finish repairing \the [C].") + break + + else if(NP.amount == 0) + to_chat(user, "Insufficient nanopaste to complete repairs!") + break return else diff --git a/code/game/objects/items/stacks/nanopaste_vr.dm b/code/game/objects/items/stacks/nanopaste_vr.dm index cd39b61fef4..d0bd4e80034 100644 --- a/code/game/objects/items/stacks/nanopaste_vr.dm +++ b/code/game/objects/items/stacks/nanopaste_vr.dm @@ -2,6 +2,7 @@ var/restoration_external = 5 var/restoration_internal = 20 var/repair_external = FALSE + var/mech_repair = 10 /obj/item/stack/nanopaste/advanced name = "advanced nanopaste" @@ -10,4 +11,5 @@ icon = 'icons/obj/stacks_vr.dmi' icon_state = "adv_nanopaste" restoration_external = 10 - repair_external = TRUE \ No newline at end of file + repair_external = TRUE + mech_repair = 20 \ No newline at end of file