diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index b9eb3f5dd70..a0f9aa18a2c 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -126,6 +126,8 @@ Class Procs: var/frequency = NONE /// A reference to a `datum/radio_frequency`. Gives the machine the ability to interact with things using radio signals. var/datum/radio_frequency/radio_connection + /// This is if the machinery is being repaired + var/being_repaired = FALSE /* * reimp, attempts to flicker this machinery if the behavior is supported. @@ -476,6 +478,34 @@ Class Procs: if(.) power_change() +/obj/machinery/attackby(obj/item/O, mob/user, params) + if(istype(O, /obj/item/stack/nanopaste)) + var/obj/item/stack/nanopaste/N = O + if(stat & BROKEN) + to_chat(user, "[src] is too damaged to be fixed with nanopaste!") + return + if(obj_integrity == max_integrity) + to_chat(user, "[src] is fully intact.") + return + if(being_repaired) + return + if(N.get_amount() < 1) + to_chat(user, "You don't have enough to complete this task!") + return + to_chat(user, "You start applying [O] to [src].") + being_repaired = TRUE + var/result = do_after(user, 3 SECONDS, target = src) + being_repaired = FALSE + if(!result) + return + if(!N.use(1)) + to_chat(user, "You don't have enough to complete this task!") // this is here, as we don't want to use nanopaste until you finish applying + return + obj_integrity = min(obj_integrity + 50, max_integrity) + user.visible_message("[user] applied some [O] at [src]'s damaged areas.",\ + "You apply some [O] at [src]'s damaged areas.") + else + return ..() /obj/machinery/proc/exchange_parts(mob/user, obj/item/storage/part_replacer/W) var/shouldplaysound = 0 if((flags & NODECONSTRUCT))