/// </summary>
public sealed class EntityHealthBarOverlay : Overlay
{
- [Dependency] private readonly IPrototypeManager _prototype = default!;
private readonly IEntityManager _entManager;
private readonly SharedTransformSystem _transform;
private readonly MobStateSystem _mobStateSystem;
private readonly ProgressColorSystem _progressColor;
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
public HashSet<string> DamageContainers = new();
- private readonly ShaderInstance _shader;
public EntityHealthBarOverlay(IEntityManager entManager)
{
- IoCManager.InjectDependencies(this);
_entManager = entManager;
_transform = _entManager.System<SharedTransformSystem>();
_mobStateSystem = _entManager.System<MobStateSystem>();
_mobThresholdSystem = _entManager.System<MobThresholdSystem>();
_progressColor = _entManager.System<ProgressColorSystem>();
- _shader = _prototype.Index<ShaderPrototype>("unshaded").Instance();
}
protected override void Draw(in OverlayDrawArgs args)
var scaleMatrix = Matrix3.CreateScale(new Vector2(scale, scale));
var rotationMatrix = Matrix3.CreateRotation(-rotation);
- handle.UseShader(_shader);
-
var query = _entManager.AllEntityQueryEnumerator<MobThresholdsComponent, MobStateComponent, DamageableComponent, SpriteComponent>();
while (query.MoveNext(out var uid,
out var mobThresholdsComponent,
handle.DrawRect(pixelDarken, Black.WithAlpha(128));
}
- handle.UseShader(null);
handle.SetTransform(Matrix3.Identity);
}
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Shared.Enums;
-using System.Numerics;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
+using System.Numerics;
namespace Content.Client.StatusIcon;
private readonly SpriteSystem _sprite;
private readonly TransformSystem _transform;
private readonly StatusIconSystem _statusIcon;
- private readonly ShaderInstance _shader;
+ private readonly ShaderInstance _unshadedShader;
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
_sprite = _entity.System<SpriteSystem>();
_transform = _entity.System<TransformSystem>();
_statusIcon = _entity.System<StatusIconSystem>();
- _shader = _prototype.Index<ShaderPrototype>("unshaded").Instance();
+ _unshadedShader = _prototype.Index<ShaderPrototype>("unshaded").Instance();
}
protected override void Draw(in OverlayDrawArgs args)
var scaleMatrix = Matrix3.CreateScale(new Vector2(1, 1));
var rotationMatrix = Matrix3.CreateRotation(-eyeRot);
- handle.UseShader(_shader);
-
var query = _entity.AllEntityQueryEnumerator<StatusIconComponent, SpriteComponent, TransformComponent, MetaDataComponent>();
while (query.MoveNext(out var uid, out var comp, out var sprite, out var xform, out var meta))
{
}
+ if (proto.IsShaded)
+ handle.UseShader(null);
+ else
+ handle.UseShader(_unshadedShader);
+
var position = new Vector2(xOffset, yOffset);
handle.DrawTexture(texture, position);
}
- }
- handle.UseShader(null);
+ handle.UseShader(null);
+ }
}
}
/// </summary>
[DataField]
public int Offset = 0;
+
+ /// <summary>
+ /// Sets if the icon should be rendered with or without the effect of lighting.
+ /// </summary>
+ [DataField]
+ public bool IsShaded = false;
}
/// <summary>
- type: statusIcon
- id: HealthIconFine
+ id: HealthIcon
+ abstract: true
priority: 1
+ locationPreference: Right
+ isShaded: true
+
+- type: statusIcon
+ parent: HealthIcon
+ id: HealthIconFine
icon:
sprite: /Textures/Interface/Misc/health_icons.rsi
state: Fine
- locationPreference: Right
- type: statusIcon
id: HealthIconCritical
- priority: 1
+ parent: HealthIcon
icon:
sprite: /Textures/Interface/Misc/health_icons.rsi
state: Critical
- locationPreference: Right
- type: statusIcon
id: HealthIconDead
- priority: 1
+ parent: HealthIcon
icon:
sprite: /Textures/Interface/Misc/health_icons.rsi
state: Dead
- locationPreference: Right
- type: statusIcon
id: HealthIconRotting
- priority: 1
+ parent: HealthIcon
icon:
sprite: /Textures/Interface/Misc/health_icons.rsi
state: Rotting
- locationPreference: Right
#Hunger
- type: statusIcon
- id: HungerIconOverfed
+ id: HungerIcon
+ abstract: true
priority: 5
+ locationPreference: Right
+ isShaded: true
+
+- type: statusIcon
+ id: HungerIconOverfed
+ parent: HungerIcon
icon:
sprite: /Textures/Interface/Misc/food_icons.rsi
state: overfed
- locationPreference: Right
- type: statusIcon
id: HungerIconPeckish
- priority: 5
+ parent: HungerIcon
icon:
sprite: /Textures/Interface/Misc/food_icons.rsi
state: peckish
- locationPreference: Right
- type: statusIcon
id: HungerIconStarving
- priority: 5
+ parent: HungerIcon
icon:
sprite: /Textures/Interface/Misc/food_icons.rsi
state: starving
- locationPreference: Right
#Thirst
- type: statusIcon
- id: ThirstIconOverhydrated
+ id: ThirstIcon
+ abstract: true
priority: 5
+ locationPreference: Left
+ isShaded: true
+
+- type: statusIcon
+ id: ThirstIconOverhydrated
+ parent: ThirstIcon
icon:
sprite: /Textures/Interface/Misc/food_icons.rsi
state: overhydrated
- locationPreference: Left
- type: statusIcon
id: ThirstIconThirsty
- priority: 5
+ parent: ThirstIcon
icon:
sprite: /Textures/Interface/Misc/food_icons.rsi
state: thirsty
- locationPreference: Left
- type: statusIcon
id: ThirstIconParched
- priority: 5
+ parent: ThirstIcon
icon:
sprite: /Textures/Interface/Misc/food_icons.rsi
state: parched
- locationPreference: Left
abstract: true
priority: 1
locationPreference: Right
+ isShaded: true
- type: statusIcon
parent: JobIcon
priority: 2
offset: 1
locationPreference: Right
+ isShaded: true
- type: statusIcon
parent: SecurityIcon