mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
fixes self repair runtime (#45065)
This commit is contained in:
@@ -296,7 +296,6 @@
|
||||
var/msg_cooldown = 0
|
||||
var/on = FALSE
|
||||
var/powercost = 10
|
||||
var/mob/living/silicon/robot/cyborg
|
||||
var/datum/action/toggle_action
|
||||
|
||||
/obj/item/borg/upgrade/selfrepair/action(mob/living/silicon/robot/R, user = usr)
|
||||
@@ -307,7 +306,6 @@
|
||||
to_chat(user, "<span class='warning'>This unit is already equipped with a self-repair module.</span>")
|
||||
return FALSE
|
||||
|
||||
cyborg = R
|
||||
icon_state = "selfrepair_off"
|
||||
toggle_action = new /datum/action/item_action/toggle(src)
|
||||
toggle_action.Grant(R)
|
||||
@@ -315,34 +313,21 @@
|
||||
/obj/item/borg/upgrade/selfrepair/deactivate(mob/living/silicon/robot/R, user = usr)
|
||||
. = ..()
|
||||
if (.)
|
||||
toggle_action.Remove(cyborg)
|
||||
toggle_action.Remove(R)
|
||||
QDEL_NULL(toggle_action)
|
||||
cyborg = null
|
||||
deactivate_sr()
|
||||
|
||||
/obj/item/borg/upgrade/selfrepair/dropped()
|
||||
. = ..()
|
||||
addtimer(CALLBACK(src, .proc/check_dropped), 1)
|
||||
|
||||
/obj/item/borg/upgrade/selfrepair/proc/check_dropped()
|
||||
if(loc != cyborg)
|
||||
toggle_action.Remove(cyborg)
|
||||
QDEL_NULL(toggle_action)
|
||||
cyborg = null
|
||||
deactivate_sr()
|
||||
|
||||
/obj/item/borg/upgrade/selfrepair/ui_action_click()
|
||||
on = !on
|
||||
if(on)
|
||||
to_chat(cyborg, "<span class='notice'>You activate the self-repair module.</span>")
|
||||
START_PROCESSING(SSobj, src)
|
||||
to_chat(toggle_action.owner, "<span class='notice'>You deactivate the self-repair module.</span>")
|
||||
deactivate_sr()
|
||||
else
|
||||
to_chat(cyborg, "<span class='notice'>You deactivate the self-repair module.</span>")
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
update_icon()
|
||||
to_chat(toggle_action.owner, "<span class='notice'>You activate the self-repair module.</span>")
|
||||
activate_sr()
|
||||
|
||||
|
||||
/obj/item/borg/upgrade/selfrepair/update_icon()
|
||||
if(cyborg)
|
||||
if(toggle_action)
|
||||
icon_state = "selfrepair_[on ? "on" : "off"]"
|
||||
for(var/X in actions)
|
||||
var/datum/action/A = X
|
||||
@@ -350,6 +335,11 @@
|
||||
else
|
||||
icon_state = "cyborg_upgrade5"
|
||||
|
||||
/obj/item/borg/upgrade/selfrepair/proc/activate_sr()
|
||||
START_PROCESSING(SSobj, src)
|
||||
on = TRUE
|
||||
update_icon()
|
||||
|
||||
/obj/item/borg/upgrade/selfrepair/proc/deactivate_sr()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
on = FALSE
|
||||
@@ -360,7 +350,9 @@
|
||||
repair_tick = 1
|
||||
return
|
||||
|
||||
if(cyborg && (cyborg.stat != DEAD) && on)
|
||||
var/mob/living/silicon/robot/cyborg = toggle_action.owner
|
||||
|
||||
if(istype(cyborg) && (cyborg.stat != DEAD) && on)
|
||||
if(!cyborg.cell)
|
||||
to_chat(cyborg, "<span class='warning'>Self-repair module deactivated. Please, insert the power cell.</span>")
|
||||
deactivate_sr()
|
||||
|
||||
Reference in New Issue
Block a user