From: Plykiya <58439124+Plykiya@users.noreply.github.com> Date: Sat, 15 Jun 2024 02:58:30 +0000 (-0700) Subject: Prevent borgs from getting duplicate modules (#28943) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=835d1dd15383b62802eb6d89f9b6f12fa8ce9a63;p=space-station-14.git Prevent borgs from getting duplicate modules (#28943) * Prevent borgs from getting duplicate modules * outta the loop --------- Co-authored-by: plykiya --- diff --git a/Content.Server/Silicons/Borgs/BorgSystem.Modules.cs b/Content.Server/Silicons/Borgs/BorgSystem.Modules.cs index 5c600be3f6..f372f7df1a 100644 --- a/Content.Server/Silicons/Borgs/BorgSystem.Modules.cs +++ b/Content.Server/Silicons/Borgs/BorgSystem.Modules.cs @@ -274,6 +274,25 @@ public sealed partial class BorgSystem return false; } + if (TryComp(module, out var itemModuleComp)) + { + foreach (var containedModuleUid in component.ModuleContainer.ContainedEntities) + { + if (!TryComp(containedModuleUid, out var containedItemModuleComp)) + continue; + + for (int i = 0; i < itemModuleComp.Items.Count; i++) + { + if (itemModuleComp.Items[i] != containedItemModuleComp.Items[i]) + continue; + } + + if (user != null) + Popup.PopupEntity(Loc.GetString("borg-module-duplicate"), uid, user.Value); + return false; + } + } + return true; } diff --git a/Resources/Locale/en-US/borg/borg.ftl b/Resources/Locale/en-US/borg/borg.ftl index c9005eb796..72667f318e 100644 --- a/Resources/Locale/en-US/borg/borg.ftl +++ b/Resources/Locale/en-US/borg/borg.ftl @@ -1,4 +1,4 @@ -borg-player-not-allowed = The brain doesn't fit! +borg-player-not-allowed = The brain doesn't fit! borg-player-not-allowed-eject = The brain was expelled from the chassis! borg-panel-not-open = The cyborg's panel isn't open... @@ -7,6 +7,7 @@ borg-mind-added = {CAPITALIZE($name)} powered on! borg-mind-removed = {CAPITALIZE($name)} shut off! borg-module-too-many = There's not enough room for another module... +borg-module-duplicate = This module is already installed in this cyborg. borg-module-whitelist-deny = This module doesn't fit in this type of cyborg... borg-construction-guide-string = The cyborg limbs and torso must be attached to the endoskeleton.