Fix unlabeled jugs in ChemVend (#29178)

* Spawn dummy entities on client for vending machine UI

* Asked sloth, and we kinda need this pr

---------

Co-authored-by: Vasilis <vasilis@pikachu.systems>
This commit is contained in:
Tayrtahn
2024-06-23 13:31:34 -04:00
committed by GitHub
parent ba164f9e48
commit ac1bdd2c84
3 changed files with 43 additions and 18 deletions

View File

@@ -7,14 +7,27 @@ namespace Content.Shared.Labels.EntitySystems;
public abstract partial class SharedLabelSystem : EntitySystem
{
[Dependency] protected readonly NameModifierSystem NameMod = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<LabelComponent, MapInitEvent>(OnLabelCompMapInit);
SubscribeLocalEvent<LabelComponent, ExaminedEvent>(OnExamine);
SubscribeLocalEvent<LabelComponent, RefreshNameModifiersEvent>(OnRefreshNameModifiers);
}
private void OnLabelCompMapInit(EntityUid uid, LabelComponent component, MapInitEvent args)
{
if (!string.IsNullOrEmpty(component.CurrentLabel))
{
component.CurrentLabel = Loc.GetString(component.CurrentLabel);
Dirty(uid, component);
}
NameMod.RefreshNameModifiers(uid);
}
public virtual void Label(EntityUid uid, string? text, MetaDataComponent? metadata = null, LabelComponent? label = null){}
private void OnExamine(EntityUid uid, LabelComponent? label, ExaminedEvent args)