From 83e65bcd1d4402d102b3b637dad1baa48966dff9 Mon Sep 17 00:00:00 2001 From: LT3 <83487515+lessthnthree@users.noreply.github.com> Date: Wed, 17 Dec 2025 13:44:46 -0800 Subject: [PATCH] Fixes oversight with borg expand/shrink modules (#5029) ## About The Pull Request Fixes https://github.com/Bubberstation/Bubberstation/issues/4959 related to bypassing borg expand/shrink restrictions. Ensures the borg has a model selected before attempting to validate if it can be expanded/shrunk. Also cleans up the code, making the shrink module consistent with expand and other TG upgrades. ## Why It's Good For The Game Fix bug ## Changelog :cl: LT3 fix: Fixed being able to expand/shrink borg models that are meant to have those upgrades unavailable /:cl: --- .../objects/items/robot/robot_upgrades.dm | 9 +-- .../modules/borgs/code/robot_upgrade.dm | 72 ++++++++++++------- 2 files changed, 49 insertions(+), 32 deletions(-) diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index ad42105fd4f..bbe99d53c0e 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -598,13 +598,6 @@ to_chat(usr, span_warning("This unit already has an expand module installed!")) return FALSE - // SKYRAT EDIT ADDITION BEGIN - if(TRAIT_R_EXPANDER_BLOCKED in borg.model.model_features) - to_chat(usr, span_warning("This unit is unable to equip an expand module!")) - return FALSE - - var/resize_amount = 1.6 - // SKYRAT EDIT ADDITION END ADD_TRAIT(borg, TRAIT_NO_TRANSFORM, REF(src)) var/prev_lockcharge = borg.lockcharge borg.SetLockdown(TRUE) @@ -627,7 +620,7 @@ borg.set_anchored(FALSE) REMOVE_TRAIT(borg, TRAIT_NO_TRANSFORM, REF(src)) borg.hasExpanded = TRUE - borg.update_transform(resize_amount) // SKYRAT EDIT CHANGE - ORIGINAL: borg.update_transform(2) + borg.update_transform(1.6) // SKYRAT EDIT CHANGE - ORIGINAL: borg.update_transform(2) /obj/item/borg/upgrade/expand/deactivate(mob/living/silicon/robot/borg, mob/living/user = usr) . = ..() diff --git a/modular_skyrat/modules/borgs/code/robot_upgrade.dm b/modular_skyrat/modules/borgs/code/robot_upgrade.dm index 7c442bd9727..77af4f0db1d 100644 --- a/modular_skyrat/modules/borgs/code/robot_upgrade.dm +++ b/modular_skyrat/modules/borgs/code/robot_upgrade.dm @@ -242,6 +242,18 @@ /mob/living/silicon/robot var/hasShrunk = FALSE +// Added checks for borg models who come from the Zoolander Center for Borgs Who Can't Upgrade Good +/obj/item/borg/upgrade/expand/action(mob/living/silicon/robot/borg, mob/living/user = usr) + if(TRAIT_R_EXPANDER_BLOCKED in borg.model.model_features) + to_chat(usr, span_warning("This unit is unable to equip an expand module!")) + return FALSE + + if(borg.model.type == /obj/item/robot_model) + to_chat(usr, span_warning("This unit is still in factory default configuration!")) + return FALSE + + return ..() + /obj/item/borg/upgrade/shrink name = "borg shrinker" desc = "A cyborg resizer, it makes a cyborg small." @@ -249,32 +261,44 @@ /obj/item/borg/upgrade/shrink/action(mob/living/silicon/robot/borg, user = usr) . = ..() - if(.) + if(!. || HAS_TRAIT(borg, TRAIT_NO_TRANSFORM)) + return FALSE - if(borg.hasShrunk) - to_chat(usr, span_warning("This unit already has a shrink module installed!")) - return FALSE - if(TRAIT_R_SMALL in borg.model.model_features) - to_chat(usr, span_warning("This unit's chassis cannot be shrunk any further.")) - return FALSE + if(borg.model.type == /obj/item/robot_model) + to_chat(usr, span_warning("This unit is still in factory default configuration!")) + return FALSE - borg.hasShrunk = TRUE - ADD_TRAIT(borg, TRAIT_NO_TRANSFORM, REF(src)) - var/prev_lockcharge = borg.lockcharge - borg.SetLockdown(TRUE) - borg.set_anchored(TRUE) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(1, location = get_turf(borg)) - smoke.start() - sleep(0.2 SECONDS) - for(var/i in 1 to 4) - playsound(borg, pick('sound/items/tools/drill_use.ogg', 'sound/items/tools/jaws_cut.ogg', 'sound/items/tools/jaws_pry.ogg', 'sound/items/tools/welder.ogg', 'sound/items/tools/ratchet.ogg'), 80, TRUE, -1) - sleep(1.2 SECONDS) - if(!prev_lockcharge) - borg.SetLockdown(FALSE) - borg.set_anchored(FALSE) - REMOVE_TRAIT(borg, TRAIT_NO_TRANSFORM, REF(src)) - borg.update_transform(0.75) + if(borg.hasShrunk) + to_chat(usr, span_warning("This unit already has a shrink module installed!")) + return FALSE + + if(TRAIT_R_SMALL in borg.model.model_features) + to_chat(usr, span_warning("This unit's chassis cannot be shrunk any further.")) + return FALSE + + ADD_TRAIT(borg, TRAIT_NO_TRANSFORM, REF(src)) + var/prev_lockcharge = borg.lockcharge + borg.SetLockdown(TRUE) + borg.set_anchored(TRUE) + var/datum/effect_system/fluid_spread/smoke/smoke = new + smoke.set_up(1, holder = borg, location = borg.loc) + smoke.start() + sleep(0.2 SECONDS) + for(var/i in 1 to 4) + playsound(borg, pick( + 'sound/items/tools/drill_use.ogg', + 'sound/items/tools/jaws_cut.ogg', + 'sound/items/tools/jaws_pry.ogg', + 'sound/items/tools/welder.ogg', + 'sound/items/tools/ratchet.ogg', + ), 80, TRUE, -1) + sleep(1.2 SECONDS) + if(!prev_lockcharge) + borg.SetLockdown(FALSE) + borg.set_anchored(FALSE) + REMOVE_TRAIT(borg, TRAIT_NO_TRANSFORM, REF(src)) + borg.hasShrunk = TRUE + borg.update_transform(0.75) /obj/item/borg/upgrade/shrink/deactivate(mob/living/silicon/robot/borg, user = usr) . = ..()