From 17d3d50113d9ff0755df03087949fdd3ceed7e61 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sat, 8 Jun 2024 11:50:18 +0200 Subject: [PATCH] [MIRROR] Fix admin borg panel unable to install/remove upgrades (#28055) * Fix admin borg panel unable to install/remove upgrades (#83733) ## About The Pull Request Fixes the admin borg panel's upgrade functionality. Caused by not registering the signals for deletion and also by the upgrade code checking the robot's contents instead of upgrades list (since the borg panel spawns the item in the borg, it appears in the borg's contents, making the check think the borg already has it installed.) ## Why It's Good For The Game Easier testing new borg modules ## Changelog :cl: fix: Fixes admin borg panel upgrade functions /:cl: * Fix admin borg panel unable to install/remove upgrades --------- Co-authored-by: thegrb93 --- code/game/objects/items/robot/robot_upgrades.dm | 2 +- code/modules/admin/verbs/borgpanel.dm | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index 86e27687965..eca0d9d2e9d 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -32,7 +32,7 @@ to_chat(borg, span_alert("Upgrade mounting error! No suitable hardpoint detected.")) to_chat(user, span_warning("There's no mounting point for the module!")) return FALSE - if(!allow_duplicates && (locate(type) in borg.contents)) + if(!allow_duplicates && (locate(type) in borg.upgrades)) to_chat(borg, span_alert("Upgrade mounting error! Hardpoint already occupied!")) to_chat(user, span_warning("The mounting point for the module is already occupied!")) return FALSE diff --git a/code/modules/admin/verbs/borgpanel.dm b/code/modules/admin/verbs/borgpanel.dm index 6a8e1efdb56..f0f2fc4a8f0 100644 --- a/code/modules/admin/verbs/borgpanel.dm +++ b/code/modules/admin/verbs/borgpanel.dm @@ -134,17 +134,19 @@ ADMIN_VERB(borg_panel, R_ADMIN, "Show Borg Panel", ADMIN_VERB_NO_DESCRIPTION, AD borg.fully_replace_character_name(borg.real_name,new_name) if ("toggle_upgrade") var/upgradepath = text2path(params["upgrade"]) - var/obj/item/borg/upgrade/installedupgrade = locate(upgradepath) in borg + var/obj/item/borg/upgrade/installedupgrade = locate(upgradepath) in borg.upgrades if (installedupgrade) message_admins("[key_name_admin(user)] removed the [installedupgrade] upgrade from [ADMIN_LOOKUPFLW(borg)].") log_silicon("[key_name(user)] removed the [installedupgrade] upgrade from [key_name(borg)].") qdel(installedupgrade) // see [mob/living/silicon/robot/on_upgrade_deleted()]. else var/obj/item/borg/upgrade/upgrade = new upgradepath(borg) - upgrade.action(borg, user) - borg.upgrades += upgrade message_admins("[key_name_admin(user)] added the [upgrade] borg upgrade to [ADMIN_LOOKUPFLW(borg)].") log_silicon("[key_name(user)] added the [upgrade] borg upgrade to [key_name(borg)].") + if(upgrade.action(borg, user)) + borg.add_to_upgrades(upgrade) + else + qdel(upgrade) if ("toggle_radio") var/channel = params["channel"] if (channel in borg.radio.channels) // We're removing a channel