]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Examine which borg that module fits into (#41461)
authorSamuka <47865393+Samuka-C@users.noreply.github.com>
Mon, 17 Nov 2025 17:55:55 +0000 (14:55 -0300)
committerGitHub <noreply@github.com>
Mon, 17 Nov 2025 17:55:55 +0000 (17:55 +0000)
* 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>
Content.Shared/Silicons/Borgs/Components/BorgModuleComponent.cs
Content.Shared/Silicons/Borgs/SharedBorgSystem.cs
Resources/Locale/en-US/silicons/borg-module.ftl [new file with mode: 0644]
Resources/Prototypes/Entities/Objects/Specific/Robotics/borg_modules.yml

index e542a1e3e3e8e41edf2995dc610f365cecf6f0cc..f50b08893266d677bb225c01efc08d4b3569244d 100644 (file)
@@ -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;
+
+    /// <summary>
+    /// 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 <see cref="BorgChassisComponent"/>.
+    /// </summary>
+    [DataField]
+    public HashSet<LocId>? BorgFitTypes;
 }
 
 /// <summary>
index baf604de0c10a86ef6508f866601f3ceaa97776c..f9b4ec7cb81d40ab9d42d02baa85e4405e50eff9 100644 (file)
@@ -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<BorgChassisComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovementSpeedModifiers);
         SubscribeLocalEvent<BorgChassisComponent, ActivatableUIOpenAttemptEvent>(OnUIOpenAttempt);
         SubscribeLocalEvent<TryGetIdentityShortInfoEvent>(OnTryGetIdentityShortInfo);
+        SubscribeLocalEvent<BorgModuleComponent, ExaminedEvent>(OnModuleExamine);
 
         InitializeRelay();
     }
 
+    private void OnModuleExamine(Entity<BorgModuleComponent> ent, ref ExaminedEvent args)
+    {
+        if (ent.Comp.BorgFitTypes == null)
+            return;
+
+        if (ent.Comp.BorgFitTypes.Count == 0)
+            return;
+
+        var typeList = new List<string>();
+
+        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 (file)
index 0000000..07c55c0
--- /dev/null
@@ -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]
index 862bc86339dc219d4704834dd077396b0bde69ff..5c011375434e9f0305d2da938cd805d239456d5a 100644 (file)
@@ -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
   parent: BaseBorgModule
   abstract: true
   components:
+  - type: BorgModule
+    borgFitTypes:
+    - borg-type-janitor
   - type: Tag
     tags:
     - BorgModuleJanitor
   parent: BaseBorgModule
   abstract: true
   components:
+  - type: BorgModule
+    borgFitTypes:
+    - borg-type-medical
   - type: Tag
     tags:
     - BorgModuleMedical
   parent: BaseBorgModule
   abstract: true
   components:
+  - type: BorgModule
+    borgFitTypes:
+    - borg-type-generic
   - type: Tag
     tags:
     - BorgModuleScience
   parent: BaseBorgModule
   abstract: true
   components:
+  - type: BorgModule
+    borgFitTypes:
+    - borg-type-service
   - type: Tag
     tags:
     - BorgModuleService
   parent: BaseBorgModule
   abstract: true
   components:
+  - type: BorgModule
+    borgFitTypes:
+    - borg-type-syndicate
   - type: Tag
     tags:
     - BorgModuleSyndicate
   parent: BaseBorgModule
   abstract: true
   components:
+  - type: BorgModule
+    borgFitTypes:
+    - borg-type-syndicate-assault
   - type: Tag
     tags:
     - BorgModuleSyndicateAssault
   parent: BaseBorgModule
   id: BaseXenoborgModuleGeneric
   components:
+  - type: BorgModule
+    borgFitTypes:
+    - xenoborg-type-all
   - type: Tag
     tags:
     - XenoborgModuleGeneric
   parent: BaseBorgModule
   id: BaseXenoborgModuleEngi
   components:
+  - type: BorgModule
+    borgFitTypes:
+    - xenoborg-type-engi
   - type: Tag
     tags:
     - XenoborgModuleEngi
   id: BaseXenoborgModuleHeavy
   abstract: true
   components:
+  - type: BorgModule
+    borgFitTypes:
+    - xenoborg-type-heavy
   - type: Tag
     tags:
     - XenoborgModuleHeavy
   id: BaseXenoborgModuleScout
   abstract: true
   components:
+  - type: BorgModule
+    borgFitTypes:
+    - xenoborg-type-scout
   - type: Tag
     tags:
     - XenoborgModuleScout
   id: BaseXenoborgModuleStealth
   abstract: true
   components:
+  - type: BorgModule
+    borgFitTypes:
+    - xenoborg-type-stealth
   - type: Tag
     tags:
     - XenoborgModuleStealth