From 9ef56974fb0922d9db153f62d83ce90fe3153304 Mon Sep 17 00:00:00 2001
From: Samuka <47865393+Samuka-C@users.noreply.github.com>
Date: Mon, 17 Nov 2025 14:55:55 -0300
Subject: [PATCH] Examine which borg that module fits into (#41461)
* modules tip
* add color
* solved a edge case
* use ContentLocalizationManager instead of hardcoded grammar
* improve summary
* improve improved summary
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
* not my first language
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
* keep names consistent
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
* keep consistent part 2
* fixed the yml error
---------
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
---
.../Borgs/Components/BorgModuleComponent.cs | 8 ++++
.../Silicons/Borgs/SharedBorgSystem.cs | 22 ++++++++++
.../Locale/en-US/silicons/borg-module.ftl | 18 ++++++++
.../Specific/Robotics/borg_modules.yml | 41 +++++++++++++++++++
4 files changed, 89 insertions(+)
create mode 100644 Resources/Locale/en-US/silicons/borg-module.ftl
diff --git a/Content.Shared/Silicons/Borgs/Components/BorgModuleComponent.cs b/Content.Shared/Silicons/Borgs/Components/BorgModuleComponent.cs
index e542a1e3e3..f50b088932 100644
--- a/Content.Shared/Silicons/Borgs/Components/BorgModuleComponent.cs
+++ b/Content.Shared/Silicons/Borgs/Components/BorgModuleComponent.cs
@@ -1,4 +1,5 @@
using Robust.Shared.GameStates;
+using Robust.Shared.Prototypes;
namespace Content.Shared.Silicons.Borgs.Components;
@@ -24,6 +25,13 @@ public sealed partial class BorgModuleComponent : Component
[DataField]
[AutoNetworkedField]
public bool DefaultModule;
+
+ ///
+ /// List of types of borgs this module fits into.
+ /// This only affects examine text. The actual whitelist for modules that can be inserted into a borg is defined in its .
+ ///
+ [DataField]
+ public HashSet? BorgFitTypes;
}
///
diff --git a/Content.Shared/Silicons/Borgs/SharedBorgSystem.cs b/Content.Shared/Silicons/Borgs/SharedBorgSystem.cs
index baf604de0c..f9b4ec7cb8 100644
--- a/Content.Shared/Silicons/Borgs/SharedBorgSystem.cs
+++ b/Content.Shared/Silicons/Borgs/SharedBorgSystem.cs
@@ -1,6 +1,8 @@
using Content.Shared.Containers.ItemSlots;
+using Content.Shared.Examine;
using Content.Shared.IdentityManagement;
using Content.Shared.Item.ItemToggle;
+using Content.Shared.Localizations;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Systems;
using Content.Shared.Popups;
@@ -35,10 +37,30 @@ public abstract partial class SharedBorgSystem : EntitySystem
SubscribeLocalEvent(OnRefreshMovementSpeedModifiers);
SubscribeLocalEvent(OnUIOpenAttempt);
SubscribeLocalEvent(OnTryGetIdentityShortInfo);
+ SubscribeLocalEvent(OnModuleExamine);
InitializeRelay();
}
+ private void OnModuleExamine(Entity ent, ref ExaminedEvent args)
+ {
+ if (ent.Comp.BorgFitTypes == null)
+ return;
+
+ if (ent.Comp.BorgFitTypes.Count == 0)
+ return;
+
+ var typeList = new List();
+
+ foreach (var type in ent.Comp.BorgFitTypes)
+ {
+ typeList.Add(Loc.GetString(type));
+ }
+
+ var types = ContentLocalizationManager.FormatList(typeList);
+ args.PushMarkup(Loc.GetString("borg-module-fit", ("types", types)));
+ }
+
private void OnTryGetIdentityShortInfo(TryGetIdentityShortInfoEvent args)
{
if (args.Handled)
diff --git a/Resources/Locale/en-US/silicons/borg-module.ftl b/Resources/Locale/en-US/silicons/borg-module.ftl
new file mode 100644
index 0000000000..07c55c04a6
--- /dev/null
+++ b/Resources/Locale/en-US/silicons/borg-module.ftl
@@ -0,0 +1,18 @@
+borg-module-fit = This module fits into {$types}.
+
+borg-type-all = [color=white]any cyborg[/color]
+borg-type-salvage = [color= #d6b328]salvage cyborgs[/color]
+borg-type-engineer = [color= #ff9900]engineer cyborgs[/color]
+borg-type-generic = [color= #666680]generic cyborgs[/color]
+borg-type-janitor = [color= #a747c0]janitor cyborgs[/color]
+borg-type-medical = [color= #5995ba]medical cyborgs[/color]
+borg-type-service = [color= #508242]service cyborgs[/color]
+
+borg-type-syndicate = [color= #962023]syndicate cyborgs[/color]
+borg-type-syndicate-assault = [color= #680a0d]syndicate assault cyborgs[/color]
+
+xenoborg-type-all = [color= #3d94ff]any xenoborg[/color]
+xenoborg-type-engi = [color= #edd45b]engi xenoborgs[/color]
+xenoborg-type-heavy = [color= #d62020]heavy xenoborgs[/color]
+xenoborg-type-scout = [color= #6a6b6f]scout xenoborgs[/color]
+xenoborg-type-stealth = [color= #ff00cc]stealth xenoborgs[/color]
diff --git a/Resources/Prototypes/Entities/Objects/Specific/Robotics/borg_modules.yml b/Resources/Prototypes/Entities/Objects/Specific/Robotics/borg_modules.yml
index 862bc86339..5c01137543 100644
--- a/Resources/Prototypes/Entities/Objects/Specific/Robotics/borg_modules.yml
+++ b/Resources/Prototypes/Entities/Objects/Specific/Robotics/borg_modules.yml
@@ -27,6 +27,8 @@
- type: Sprite
sprite: Objects/Specific/Robotics/borgmodule.rsi
- type: BorgModule
+ borgFitTypes:
+ - borg-type-all
- type: BorgModuleIcon
icon: { sprite: Interface/Actions/actions_borg.rsi, state: no-action }
- type: StaticPrice
@@ -66,6 +68,9 @@
parent: BaseBorgModule
abstract: true
components:
+ - type: BorgModule
+ borgFitTypes:
+ - borg-type-salvage
- type: Tag
tags:
- BorgModuleCargo
@@ -91,6 +96,9 @@
parent: BaseBorgModule
abstract: true
components:
+ - type: BorgModule
+ borgFitTypes:
+ - borg-type-engineer
- type: Tag
tags:
- BorgModuleEngineering
@@ -118,6 +126,9 @@
parent: BaseBorgModule
abstract: true
components:
+ - type: BorgModule
+ borgFitTypes:
+ - borg-type-janitor
- type: Tag
tags:
- BorgModuleJanitor
@@ -145,6 +156,9 @@
parent: BaseBorgModule
abstract: true
components:
+ - type: BorgModule
+ borgFitTypes:
+ - borg-type-medical
- type: Tag
tags:
- BorgModuleMedical
@@ -172,6 +186,9 @@
parent: BaseBorgModule
abstract: true
components:
+ - type: BorgModule
+ borgFitTypes:
+ - borg-type-generic
- type: Tag
tags:
- BorgModuleScience
@@ -199,6 +216,9 @@
parent: BaseBorgModule
abstract: true
components:
+ - type: BorgModule
+ borgFitTypes:
+ - borg-type-service
- type: Tag
tags:
- BorgModuleService
@@ -226,6 +246,9 @@
parent: BaseBorgModule
abstract: true
components:
+ - type: BorgModule
+ borgFitTypes:
+ - borg-type-syndicate
- type: Tag
tags:
- BorgModuleSyndicate
@@ -254,6 +277,9 @@
parent: BaseBorgModule
abstract: true
components:
+ - type: BorgModule
+ borgFitTypes:
+ - borg-type-syndicate-assault
- type: Tag
tags:
- BorgModuleSyndicateAssault
@@ -281,6 +307,9 @@
parent: BaseBorgModule
id: BaseXenoborgModuleGeneric
components:
+ - type: BorgModule
+ borgFitTypes:
+ - xenoborg-type-all
- type: Tag
tags:
- XenoborgModuleGeneric
@@ -308,6 +337,9 @@
parent: BaseBorgModule
id: BaseXenoborgModuleEngi
components:
+ - type: BorgModule
+ borgFitTypes:
+ - xenoborg-type-engi
- type: Tag
tags:
- XenoborgModuleEngi
@@ -335,6 +367,9 @@
id: BaseXenoborgModuleHeavy
abstract: true
components:
+ - type: BorgModule
+ borgFitTypes:
+ - xenoborg-type-heavy
- type: Tag
tags:
- XenoborgModuleHeavy
@@ -362,6 +397,9 @@
id: BaseXenoborgModuleScout
abstract: true
components:
+ - type: BorgModule
+ borgFitTypes:
+ - xenoborg-type-scout
- type: Tag
tags:
- XenoborgModuleScout
@@ -389,6 +427,9 @@
id: BaseXenoborgModuleStealth
abstract: true
components:
+ - type: BorgModule
+ borgFitTypes:
+ - xenoborg-type-stealth
- type: Tag
tags:
- XenoborgModuleStealth