Refactor SpeciesUI into overlay and status effects (#381)
* 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.
This commit is contained in:
committed by
Pieter-Jan Briers
parent
6497cdf8ff
commit
12cf5559c2
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Mobs
|
||||
{
|
||||
/// <summary>
|
||||
/// Full screen overlays; Blindness, death, flash, alcohol etc.
|
||||
/// </summary>
|
||||
public abstract class SharedOverlayEffectsComponent : Component
|
||||
{
|
||||
public override string Name => "OverlayEffectsUI";
|
||||
public sealed override uint? NetID => ContentNetIDs.OVERLAYEFFECTS;
|
||||
public sealed override Type StateType => typeof(OverlayEffectComponentState);
|
||||
}
|
||||
|
||||
public enum ScreenEffects
|
||||
{
|
||||
None,
|
||||
CircleMask,
|
||||
GradientCircleMask,
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class OverlayEffectComponentState : ComponentState
|
||||
{
|
||||
public ScreenEffects ScreenEffect;
|
||||
|
||||
public OverlayEffectComponentState(ScreenEffects screenEffect) : base(ContentNetIDs.OVERLAYEFFECTS)
|
||||
{
|
||||
ScreenEffect = screenEffect;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,6 @@ namespace Content.Shared.GameObjects.Components.Mobs
|
||||
{
|
||||
public sealed override string Name => "Species";
|
||||
|
||||
public sealed override uint? NetID => ContentNetIDs.SPECIES;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum MobVisuals
|
||||
{
|
||||
@@ -29,6 +27,6 @@ namespace Content.Shared.GameObjects.Components.Mobs
|
||||
/// </summary>
|
||||
Down,
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Mobs
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles the icons on the right side of the screen.
|
||||
/// Should only be used for player-controlled entities
|
||||
/// </summary>
|
||||
public abstract class SharedStatusEffectsComponent : Component
|
||||
{
|
||||
public override string Name => "StatusEffectsUI";
|
||||
public override uint? NetID => ContentNetIDs.STATUSEFFECTS;
|
||||
public sealed override Type StateType => typeof(StatusEffectComponentState);
|
||||
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class StatusEffectComponentState : ComponentState
|
||||
{
|
||||
public Dictionary<StatusEffect, string> StatusEffects;
|
||||
|
||||
public StatusEffectComponentState(Dictionary<StatusEffect, string> statusEffects) : base(ContentNetIDs.STATUSEFFECTS)
|
||||
{
|
||||
StatusEffects = statusEffects;
|
||||
}
|
||||
}
|
||||
|
||||
// Each status effect is assumed to be unique
|
||||
public enum StatusEffect
|
||||
{
|
||||
Health,
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@
|
||||
public const uint INVENTORY = 1006;
|
||||
public const uint POWER_DEBUG_TOOL = 1007;
|
||||
public const uint CONSTRUCTOR = 1008;
|
||||
public const uint SPECIES = 1009;
|
||||
public const uint RANGED_WEAPON = 1010;
|
||||
public const uint CAMERA_RECOIL = 1011;
|
||||
public const uint SOUND = 1012;
|
||||
@@ -29,5 +28,7 @@
|
||||
public const uint RESEARCH_CONSOLE = 1023;
|
||||
public const uint WIRES = 1024;
|
||||
public const uint COMBATMODE = 1025;
|
||||
public const uint STATUSEFFECTS = 1026;
|
||||
public const uint OVERLAYEFFECTS = 1027;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using System;
|
||||
|
||||
namespace Content.Shared.GameObjects
|
||||
{
|
||||
/// <summary>
|
||||
/// Sends updates to the standard species health hud with the sprite to change the hud to
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public class HudStateChange : ComponentMessage
|
||||
{
|
||||
public string StateSprite;
|
||||
public ScreenEffects effect;
|
||||
|
||||
public HudStateChange()
|
||||
{
|
||||
Directed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ScreenEffects
|
||||
{
|
||||
None,
|
||||
CircleMask,
|
||||
GradientCircleMask,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user