Add technology to tech disk names (#38157)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Lathe;
|
||||
using Content.Shared.NameModifier.EntitySystems;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Content.Shared.Research.Components;
|
||||
@@ -20,6 +21,7 @@ public sealed class TechnologyDiskSystem : EntitySystem
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly SharedResearchSystem _research = default!;
|
||||
[Dependency] private readonly SharedLatheSystem _lathe = default!;
|
||||
[Dependency] private readonly NameModifierSystem _nameModifier = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -28,6 +30,7 @@ public sealed class TechnologyDiskSystem : EntitySystem
|
||||
SubscribeLocalEvent<TechnologyDiskComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<TechnologyDiskComponent, AfterInteractEvent>(OnAfterInteract);
|
||||
SubscribeLocalEvent<TechnologyDiskComponent, ExaminedEvent>(OnExamine);
|
||||
SubscribeLocalEvent<TechnologyDiskComponent, RefreshNameModifiersEvent>(OnRefreshNameModifiers);
|
||||
}
|
||||
|
||||
private void OnMapInit(Entity<TechnologyDiskComponent> ent, ref MapInitEvent args)
|
||||
@@ -55,6 +58,7 @@ public sealed class TechnologyDiskSystem : EntitySystem
|
||||
ent.Comp.Recipes = [];
|
||||
ent.Comp.Recipes.Add(_random.Pick(techs));
|
||||
Dirty(ent);
|
||||
_nameModifier.RefreshNameModifiers(ent.Owner);
|
||||
}
|
||||
|
||||
private void OnAfterInteract(Entity<TechnologyDiskComponent> ent, ref AfterInteractEvent args)
|
||||
@@ -90,4 +94,16 @@ public sealed class TechnologyDiskSystem : EntitySystem
|
||||
}
|
||||
args.PushMarkup(message);
|
||||
}
|
||||
|
||||
private void OnRefreshNameModifiers(Entity<TechnologyDiskComponent> entity, ref RefreshNameModifiersEvent args)
|
||||
{
|
||||
if (entity.Comp.Recipes != null)
|
||||
{
|
||||
foreach (var recipe in entity.Comp.Recipes)
|
||||
{
|
||||
var proto = _protoMan.Index(recipe);
|
||||
args.AddModifier("tech-disk-name-format", extraArgs: ("technology", _lathe.GetRecipeName(proto)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@ tech-disk-inserted = You insert the disk, adding a new recipe to the server.
|
||||
tech-disk-examine-none = The label is blank.
|
||||
tech-disk-examine = The label has a small dot matrix printed image depicting a {$result}.
|
||||
tech-disk-examine-more = There are more images printed, but they're too small to discern.
|
||||
tech-disk-name-format = {$baseName} ({$technology})
|
||||
|
||||
tech-disk-ui-name = technology disk terminal
|
||||
tech-disk-ui-total-label = There are {$amount} points on the selected server
|
||||
tech-disk-ui-cost-label = Each disk costs {$amount} points to print
|
||||
tech-disk-ui-print-button = Print Disk
|
||||
tech-disk-ui-print-button = Print Disk
|
||||
|
||||
Reference in New Issue
Block a user