* Refactor SpeciesUI into overlay and status effects All components that update the UI will need to use PlayerAttached for cases where the Mind transfers I think. * Change overlay / status effects to use states * Change TryRemoveStatus to RemoveStatus Doesn't return a bool so not trying. Addressing PJB's feedback.
41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using Content.Shared.GameObjects.Components.Mobs;
|
|
using Robust.Shared.GameObjects;
|
|
|
|
namespace Content.Server.GameObjects.Components.Mobs
|
|
{
|
|
[RegisterComponent]
|
|
[ComponentReference(typeof(SharedStatusEffectsComponent))]
|
|
public sealed class ServerStatusEffectsComponent : SharedStatusEffectsComponent
|
|
{
|
|
private readonly Dictionary<StatusEffect, string> _statusEffects = new Dictionary<StatusEffect, string>();
|
|
|
|
public override ComponentState GetComponentState()
|
|
{
|
|
return new StatusEffectComponentState(_statusEffects);
|
|
}
|
|
|
|
public void ChangeStatus(StatusEffect effect, string icon)
|
|
{
|
|
if (_statusEffects.TryGetValue(effect, out string value) && value == icon)
|
|
{
|
|
return;
|
|
}
|
|
|
|
_statusEffects[effect] = icon;
|
|
Dirty();
|
|
}
|
|
|
|
public void RemoveStatus(StatusEffect effect)
|
|
{
|
|
if (!_statusEffects.Remove(effect))
|
|
{
|
|
return;
|
|
}
|
|
|
|
Dirty();
|
|
}
|
|
}
|
|
|
|
}
|