diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index e8e91caf7ac..66cbfef59cb 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -16,7 +16,6 @@ return 1 return 0 - /obj/item/borg/upgrade/reset name = "cyborg module reset board" desc = "Used to reset a cyborg's module. Destroys any other upgrades applied to the cyborg." @@ -197,7 +196,7 @@ R.module.rebuild() return 1 -/obj/item/borg/upgrade/syndicate/ +/obj/item/borg/upgrade/syndicate name = "illegal equipment module" desc = "Unlocks the hidden, deadlier functions of a cyborg" icon_state = "cyborg_upgrade3" @@ -211,3 +210,85 @@ R.SetEmagged(1) return 1 + +/obj/item/borg/upgrade/selfrepair + name = "self-repair module" + desc = "This module will repair the cyborg over time." + icon_state = "cyborg_upgrade5" + require_module = 1 + var/repair_amount = -1 + var/repair_tick = 1 + var/msg_cooldown = 0 + var/on = 0 + var/powercost = 10 + var/mob/living/silicon/robot/cyborg + +/obj/item/borg/upgrade/selfrepair/action(mob/living/silicon/robot/R) + if(..()) + return 0 + var/obj/item/borg/upgrade/selfrepair/U = locate() in R + if(U) + usr << "This unit is already equipped with a self-repair module." + return 0 + cyborg = R + icon_state = "selfrepair_off" + action_button_name = "Toggle Self-Repair" + return 1 + +/obj/item/borg/upgrade/selfrepair/ui_action_click() + on = !on + if(on) + cyborg << "You activate the self-repair module." + SSobj.processing |= src + else + cyborg << "You deactivate the self-repair module." + SSobj.processing -= src + update_icon() + +/obj/item/borg/upgrade/selfrepair/update_icon() + if(cyborg) + icon_state = "selfrepair_[on ? "on" : "off"]" + else + icon_state = "cyborg_upgrade5" + +/obj/item/borg/upgrade/selfrepair/proc/deactivate() + SSobj.processing -= src + on = 0 + update_icon() + +/obj/item/borg/upgrade/selfrepair/process() + if(!repair_tick) + repair_tick = 1 + return + + if( cyborg && (cyborg.stat != DEAD) && on) + if(cyborg.cell.charge < powercost*2) + cyborg << "Self-repair module deactivated. Please recharge." + deactivate() + return + + if(cyborg.health < cyborg.maxHealth) + if(cyborg.health < 0) + repair_amount = -2.5 + powercost = 30 + else + repair_amount = -1 + powercost = 10 + cyborg.adjustBruteLoss(repair_amount) + cyborg.adjustFireLoss(repair_amount) + cyborg.updatehealth() + cyborg.cell.use(powercost) + else + cyborg.cell.use(5) + repair_tick = 0 + + if( (world.time - 2000) > msg_cooldown ) + var/msgmode = "standby" + if(cyborg.health < 0) + msgmode = "critical" + else if(cyborg.health < cyborg.maxHealth) + msgmode = "normal" + cyborg << "Self-repair is active in [msgmode] mode." + msg_cooldown = world.time + else + deactivate() diff --git a/code/modules/research/designs/mechfabricator_designs.dm b/code/modules/research/designs/mechfabricator_designs.dm index 6f349b66ad1..b480ed8ab8c 100644 --- a/code/modules/research/designs/mechfabricator_designs.dm +++ b/code/modules/research/designs/mechfabricator_designs.dm @@ -695,6 +695,16 @@ construction_time = 120 category = list("Cyborg Upgrade Modules") +/datum/design/borg_upgrade_selfrepair + name = "Cyborg Upgrade (Self-repair)" + id = "borg_upgrade_selfrepair" + build_type = MECHFAB + build_path = /obj/item/borg/upgrade/selfrepair + req_tech = list("materials" = 4, "engineering" = 4) + materials = list(MAT_METAL=15000, MAT_GLASS=15000) + construction_time = 120 + category = list("Cyborg Upgrade Modules") + //Misc /datum/design/mecha_tracking name = "Exosuit Tracking Beacon" diff --git a/html/changelogs/xxalpha-nanites.yml b/html/changelogs/xxalpha-nanites.yml new file mode 100644 index 00000000000..478a2163140 --- /dev/null +++ b/html/changelogs/xxalpha-nanites.yml @@ -0,0 +1,6 @@ +author: xxalpha + +delete-after: True + +changes: + - rscadd: "Added a researchable cyborg self-repair module to the robotics fabricator." \ No newline at end of file diff --git a/icons/obj/module.dmi b/icons/obj/module.dmi index e7fc43e6109..fb68f0bcc65 100644 Binary files a/icons/obj/module.dmi and b/icons/obj/module.dmi differ