* some work * equip: done unequip: todo * unequipping done & refactored events * workin * movin * reee namespaces * stun * mobstate * fixes * some work on events * removes serverside itemcomp & misc fixes * work * smol merge fix * ports template to prototype & finishes ui * moves relay & adds containerenumerator * actions & cuffs * my god what is actioncode * more fixes * im loosing my grasp on reality * more fixes * more work * explosions * yes * more work * more fixes * merge master & misc fixed because i forgot to commit before merging master * more fixes * fixes * moar * more work * moar fixes * suffixmap * more work on client * motivation low * no. no containers * mirroring client to server * fixes * move serverinvcomp * serverinventorycomponent is dead * gaming * only strippable & ai left... * only ai and richtext left * fixes ai * fixes * fixes sprite layers * more fixes * resolves optional * yes * stable™️ * fixes * moar fixes * moar * fix some tests * lmao * no comment * good to merge™️ * fixes build but for real * adresses some reviews * adresses some more reviews * nullables, yo * fixes lobbyscreen * timid refactor to differentiate actor & target * adresses more reviews * more * my god what a mess * removed the rest of duplicates * removed duplicate slotflags and renamed shoes to feet * removes another unused one * yes * fixes lobby & makes tryunequip return unequipped item * fixes * some funny renames * fixes * misc improvements to attemptevents * fixes * merge fixes Co-authored-by: Paul Ritter <ritter.paul1@gmail.com>
67 lines
2.3 KiB
C#
67 lines
2.3 KiB
C#
using Content.Client.Clothing;
|
|
using Content.Shared.Smoking;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
|
|
namespace Content.Client.Smoking
|
|
{
|
|
[UsedImplicitly]
|
|
public class BurnStateVisualizer : AppearanceVisualizer
|
|
{
|
|
[DataField("burntIcon")]
|
|
private string _burntIcon = "burnt-icon";
|
|
[DataField("litIcon")]
|
|
private string _litIcon = "lit-icon";
|
|
[DataField("unlitIcon")]
|
|
private string _unlitIcon = "icon";
|
|
|
|
[DataField("burntPrefix")]
|
|
private string _burntPrefix = "unlit";
|
|
[DataField("litPrefix")]
|
|
private string _litPrefix = "lit";
|
|
[DataField("unlitPrefix")]
|
|
private string _unlitPrefix = "unlit";
|
|
|
|
public override void OnChangeData(AppearanceComponent component)
|
|
{
|
|
base.OnChangeData(component);
|
|
|
|
if (component.TryGetData<SmokableState>(SmokingVisuals.Smoking, out var smoking))
|
|
{
|
|
SetState(component, smoking);
|
|
}
|
|
}
|
|
|
|
private void SetState(AppearanceComponent component, SmokableState burnState)
|
|
{
|
|
var entities = IoCManager.Resolve<IEntityManager>();
|
|
var clothing = entities.GetComponentOrNull<ClothingComponent>(component.Owner);
|
|
|
|
if (entities.TryGetComponent(component.Owner, out ISpriteComponent sprite))
|
|
{
|
|
switch (burnState)
|
|
{
|
|
case SmokableState.Lit:
|
|
if (clothing != null)
|
|
clothing.EquippedPrefix = _litPrefix;
|
|
sprite.LayerSetState(0, _litIcon);
|
|
break;
|
|
case SmokableState.Burnt:
|
|
if (clothing != null)
|
|
clothing.EquippedPrefix = _burntPrefix;
|
|
sprite.LayerSetState(0, _burntIcon);
|
|
break;
|
|
case SmokableState.Unlit:
|
|
if (clothing != null)
|
|
clothing.EquippedPrefix = _unlitPrefix;
|
|
sprite.LayerSetState(0, _unlitIcon);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|