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>
This commit is contained in:
Samuka
2025-11-17 14:55:55 -03:00
committed by GitHub
parent b59ecdba6a
commit 9ef56974fb
4 changed files with 89 additions and 0 deletions

View 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>

View 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)

View File

@@ -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]

View 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
@@ -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