[feat] new med and jobs huds (#17)
This commit is contained in:
@@ -29,14 +29,14 @@ namespace Content.Client.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_entityManager.TryGetComponent<ShowHealthBarsComponent>(playerEntity, out var glassComp))
|
||||
if (!_entityManager.TryGetComponent<ShowWhiteHealthBarsComponent>(playerEntity, out var glassComp))
|
||||
{
|
||||
_entityManager.AddComponent<ShowHealthBarsComponent>((EntityUid) playerEntity);
|
||||
_entityManager.AddComponent<ShowWhiteHealthBarsComponent>((EntityUid) playerEntity);
|
||||
shell.WriteLine("Enabled health overlay.");
|
||||
return;
|
||||
}
|
||||
|
||||
_entityManager.RemoveComponent<ShowHealthBarsComponent>((EntityUid) playerEntity);
|
||||
_entityManager.RemoveComponent<ShowWhiteHealthBarsComponent>((EntityUid) playerEntity);
|
||||
shell.WriteLine("Disabled health overlay.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public sealed class ShowHealthIconsSystem : EquipmentHudSystem<ShowHealthIconsCo
|
||||
public HashSet<string> DamageContainers = new();
|
||||
|
||||
[ValidatePrototypeId<StatusIconPrototype>]
|
||||
private const string HealthIconFine = "HealthIconFine";
|
||||
private const string HealthIconFine = "HealthIconLife"; // WD EDIT
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ using Robust.Client.Graphics;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Client.EntityHealthBar;
|
||||
|
||||
@@ -23,21 +24,29 @@ public sealed class EntityHealthBarOverlay : Overlay
|
||||
private readonly MobStateSystem _mobStateSystem;
|
||||
private readonly MobThresholdSystem _mobThresholdSystem;
|
||||
private readonly Texture _barTexture;
|
||||
private readonly ShaderInstance _shader;
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
|
||||
public List<string> DamageContainers = new();
|
||||
// for icon frame change timer
|
||||
int iconFrame = 1;
|
||||
double delayTime = 0.25;
|
||||
|
||||
public EntityHealthBarOverlay(IEntityManager entManager, IPrototypeManager protoManager)
|
||||
public EntityHealthBarOverlay(IEntityManager entManager)
|
||||
{
|
||||
_entManager = entManager;
|
||||
_transform = _entManager.EntitySysManager.GetEntitySystem<SharedTransformSystem>();
|
||||
_mobStateSystem = _entManager.EntitySysManager.GetEntitySystem<MobStateSystem>();
|
||||
_mobThresholdSystem = _entManager.EntitySysManager.GetEntitySystem<MobThresholdSystem>();
|
||||
|
||||
var sprite = new SpriteSpecifier.Rsi(new ResPath("/Textures/Interface/Misc/health_bar.rsi"), "icon");
|
||||
var sprite = new SpriteSpecifier.Rsi(new ResPath("/Textures/Interface/Misc/health_status.rsi"), "background");
|
||||
_barTexture = _entManager.EntitySysManager.GetEntitySystem<SpriteSystem>().Frame0(sprite);
|
||||
|
||||
_shader = protoManager.Index<ShaderPrototype>("shaded").Instance();
|
||||
Timer.SpawnRepeating(TimeSpan.FromSeconds(delayTime), () =>
|
||||
{
|
||||
if (iconFrame < 8)
|
||||
iconFrame++;
|
||||
else
|
||||
iconFrame = 1;
|
||||
}, new System.Threading.CancellationToken());
|
||||
}
|
||||
|
||||
protected override void Draw(in OverlayDrawArgs args)
|
||||
@@ -47,10 +56,11 @@ public sealed class EntityHealthBarOverlay : Overlay
|
||||
var spriteQuery = _entManager.GetEntityQuery<SpriteComponent>();
|
||||
var xformQuery = _entManager.GetEntityQuery<TransformComponent>();
|
||||
|
||||
var _spriteSys = _entManager.EntitySysManager.GetEntitySystem<SpriteSystem>();
|
||||
|
||||
const float scale = 1f;
|
||||
var scaleMatrix = Matrix3.CreateScale(new Vector2(scale, scale));
|
||||
var rotationMatrix = Matrix3.CreateRotation(-rotation);
|
||||
handle.UseShader(_shader);
|
||||
|
||||
foreach (var (mob, dmg) in _entManager.EntityQuery<MobStateComponent, DamageableComponent>(true))
|
||||
{
|
||||
@@ -74,13 +84,19 @@ public sealed class EntityHealthBarOverlay : Overlay
|
||||
// Use the sprite itself if we know its bounds. This means short or tall sprites don't get overlapped
|
||||
// by the bar.
|
||||
float yOffset;
|
||||
float xIconOffset;
|
||||
float yIconOffset;
|
||||
if (spriteQuery.TryGetComponent(mob.Owner, out var sprite))
|
||||
{
|
||||
yOffset = sprite.Bounds.Height + 15f;
|
||||
yOffset = sprite.Bounds.Height + 12f;
|
||||
yIconOffset = sprite.Bounds.Height + 7f;
|
||||
xIconOffset = sprite.Bounds.Width + 7f;
|
||||
}
|
||||
else
|
||||
{
|
||||
yOffset = 1f;
|
||||
yIconOffset = 1f;
|
||||
xIconOffset = 1f;
|
||||
}
|
||||
|
||||
// Position above the entity (we've already applied the matrix transform to the entity itself)
|
||||
@@ -89,7 +105,39 @@ public sealed class EntityHealthBarOverlay : Overlay
|
||||
yOffset / EyeManager.PixelsPerMeter);
|
||||
|
||||
// Draw the underlying bar texture
|
||||
handle.DrawTexture(_barTexture, position);
|
||||
if (sprite != null && !sprite.ContainerOccluded)
|
||||
handle.DrawTexture(_barTexture, position);
|
||||
else
|
||||
continue;
|
||||
|
||||
// Draw state icon
|
||||
if (dmg.DamageContainerID == "Biological")
|
||||
{
|
||||
string current_state;
|
||||
if (_mobStateSystem.IsAlive(mob.Owner, mob))
|
||||
{
|
||||
current_state = "life_state";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_mobStateSystem.IsCritical(mob.Owner, mob) &&
|
||||
_mobThresholdSystem.TryGetThresholdForState(mob.Owner, MobState.Critical,
|
||||
out var critThreshold))
|
||||
current_state = "defib_state";
|
||||
else
|
||||
current_state = "dead_state";
|
||||
}
|
||||
|
||||
var icon_sprite = new SpriteSpecifier.Rsi(new ResPath("/Textures/Interface/Misc/health_state.rsi"),
|
||||
current_state);
|
||||
Texture _stateIcon = _spriteSys.RsiStateLike(icon_sprite)
|
||||
.GetFrame(0, GetIconFrame(_spriteSys.RsiStateLike(icon_sprite)));
|
||||
|
||||
var icon_position = new Vector2(xIconOffset / EyeManager.PixelsPerMeter,
|
||||
yIconOffset / EyeManager.PixelsPerMeter);
|
||||
|
||||
handle.DrawTexture(_stateIcon, icon_position);
|
||||
}
|
||||
|
||||
// we are all progressing towards death every day
|
||||
(float ratio, bool inCrit) deathProgress = CalcProgress(mob.Owner, mob, dmg);
|
||||
@@ -97,12 +145,12 @@ public sealed class EntityHealthBarOverlay : Overlay
|
||||
var color = GetProgressColor(deathProgress.ratio, deathProgress.inCrit);
|
||||
|
||||
// Hardcoded width of the progress bar because it doesn't match the texture.
|
||||
const float startX = 2f;
|
||||
const float endX = 22f;
|
||||
const float startX = 1f;
|
||||
const float endX = 15f;
|
||||
|
||||
var xProgress = (endX - startX) * deathProgress.ratio + startX;
|
||||
|
||||
var box = new Box2(new Vector2(startX, 3f) / EyeManager.PixelsPerMeter, new Vector2(xProgress, 4f) / EyeManager.PixelsPerMeter);
|
||||
var box = new Box2(new Vector2(startX, 0f) / EyeManager.PixelsPerMeter, new Vector2(xProgress, 2f) / EyeManager.PixelsPerMeter);
|
||||
box = box.Translated(position);
|
||||
handle.DrawRect(box, color);
|
||||
}
|
||||
@@ -111,6 +159,30 @@ public sealed class EntityHealthBarOverlay : Overlay
|
||||
handle.SetTransform(Matrix3.Identity);
|
||||
}
|
||||
|
||||
private int GetIconFrame(IRsiStateLike sprite)
|
||||
{
|
||||
var _spriteSys = _entManager.EntitySysManager.GetEntitySystem<SpriteSystem>();
|
||||
|
||||
if (sprite.AnimationFrameCount <= 1)
|
||||
return 0;
|
||||
|
||||
var currentFrame = iconFrame;
|
||||
var result = 0;
|
||||
while (true)
|
||||
{
|
||||
if (currentFrame > 0 && currentFrame > sprite.AnimationFrameCount)
|
||||
{
|
||||
currentFrame -= sprite.AnimationFrameCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = currentFrame - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a ratio between 0 and 1, and whether the entity is in crit.
|
||||
/// </summary>
|
||||
@@ -121,7 +193,7 @@ public sealed class EntityHealthBarOverlay : Overlay
|
||||
if (!_mobThresholdSystem.TryGetThresholdForState(uid, MobState.Critical, out var threshold))
|
||||
return (1, false);
|
||||
|
||||
var ratio = 1 - ((FixedPoint2)(dmg.TotalDamage / threshold)).Float();
|
||||
var ratio = 1 - ((FixedPoint2) (dmg.TotalDamage / threshold)).Float();
|
||||
return (ratio, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace Content.Client.EntityHealthBar
|
||||
public sealed class ShowHealthBarsSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IPlayerManager _player = default!;
|
||||
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
||||
[Dependency] private readonly IOverlayManager _overlayMan = default!;
|
||||
|
||||
private EntityHealthBarOverlay _overlay = default!;
|
||||
@@ -18,16 +17,16 @@ namespace Content.Client.EntityHealthBar
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<ShowHealthBarsComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<ShowHealthBarsComponent, ComponentRemove>(OnRemove);
|
||||
SubscribeLocalEvent<ShowHealthBarsComponent, PlayerAttachedEvent>(OnPlayerAttached);
|
||||
SubscribeLocalEvent<ShowHealthBarsComponent, PlayerDetachedEvent>(OnPlayerDetached);
|
||||
SubscribeLocalEvent<ShowWhiteHealthBarsComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<ShowWhiteHealthBarsComponent, ComponentRemove>(OnRemove);
|
||||
SubscribeLocalEvent<ShowWhiteHealthBarsComponent, PlayerAttachedEvent>(OnPlayerAttached);
|
||||
SubscribeLocalEvent<ShowWhiteHealthBarsComponent, PlayerDetachedEvent>(OnPlayerDetached);
|
||||
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart);
|
||||
|
||||
_overlay = new(EntityManager, _protoMan);
|
||||
_overlay = new(EntityManager);
|
||||
}
|
||||
|
||||
private void OnInit(EntityUid uid, ShowHealthBarsComponent component, ComponentInit args)
|
||||
private void OnInit(EntityUid uid, ShowWhiteHealthBarsComponent component, ComponentInit args)
|
||||
{
|
||||
if (_player.LocalPlayer?.ControlledEntity == uid)
|
||||
{
|
||||
@@ -37,7 +36,7 @@ namespace Content.Client.EntityHealthBar
|
||||
|
||||
|
||||
}
|
||||
private void OnRemove(EntityUid uid, ShowHealthBarsComponent component, ComponentRemove args)
|
||||
private void OnRemove(EntityUid uid, ShowWhiteHealthBarsComponent component, ComponentRemove args)
|
||||
{
|
||||
if (_player.LocalPlayer?.ControlledEntity == uid)
|
||||
{
|
||||
@@ -45,13 +44,13 @@ namespace Content.Client.EntityHealthBar
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPlayerAttached(EntityUid uid, ShowHealthBarsComponent component, PlayerAttachedEvent args)
|
||||
private void OnPlayerAttached(EntityUid uid, ShowWhiteHealthBarsComponent component, PlayerAttachedEvent args)
|
||||
{
|
||||
_overlayMan.AddOverlay(_overlay);
|
||||
_overlay.DamageContainers = component.DamageContainers;
|
||||
}
|
||||
|
||||
private void OnPlayerDetached(EntityUid uid, ShowHealthBarsComponent component, PlayerDetachedEvent args)
|
||||
private void OnPlayerDetached(EntityUid uid, ShowWhiteHealthBarsComponent component, PlayerDetachedEvent args)
|
||||
{
|
||||
_overlayMan.RemoveOverlay(_overlay);
|
||||
}
|
||||
|
||||
149
Content.Client/White/EntityJobInfo/EntityJobInfoOverlay.cs
Normal file
149
Content.Client/White/EntityJobInfo/EntityJobInfoOverlay.cs
Normal file
@@ -0,0 +1,149 @@
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.PDA;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Roles;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Content.Client.EntityJobInfo;
|
||||
|
||||
public sealed class EntityJobInfoOverlay : Overlay
|
||||
{
|
||||
private readonly IEntityManager _entManager;
|
||||
private readonly SharedTransformSystem _transform;
|
||||
private readonly IPrototypeManager _prototypeManager;
|
||||
private readonly InventorySystem _inventorySystem;
|
||||
private readonly ShaderInstance _shader;
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
|
||||
|
||||
public EntityJobInfoOverlay(IEntityManager entManager, IPrototypeManager protoManager, InventorySystem inventorySystem)
|
||||
{
|
||||
_entManager = entManager;
|
||||
_prototypeManager = protoManager;
|
||||
_inventorySystem = inventorySystem;
|
||||
_transform = _entManager.EntitySysManager.GetEntitySystem<SharedTransformSystem>();
|
||||
_shader = protoManager.Index<ShaderPrototype>("unshaded").Instance();
|
||||
}
|
||||
|
||||
protected override void Draw(in OverlayDrawArgs args)
|
||||
{
|
||||
var handle = args.WorldHandle;
|
||||
var rotation = args.Viewport.Eye?.Rotation ?? Angle.Zero;
|
||||
var spriteQuery = _entManager.GetEntityQuery<SpriteComponent>();
|
||||
var xformQuery = _entManager.GetEntityQuery<TransformComponent>();
|
||||
|
||||
const float scale = 1f;
|
||||
var scaleMatrix = Matrix3.CreateScale(new Vector2(scale, scale));
|
||||
var rotationMatrix = Matrix3.CreateRotation(-rotation);
|
||||
handle.UseShader(_shader);
|
||||
|
||||
foreach (var hum in _entManager.EntityQuery<HumanoidAppearanceComponent>(true))
|
||||
{
|
||||
if (!xformQuery.TryGetComponent(hum.Owner, out var xform) ||
|
||||
xform.MapID != args.MapId)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var worldPosition = _transform.GetWorldPosition(xform);
|
||||
var worldMatrix = Matrix3.CreateTranslation(worldPosition);
|
||||
|
||||
Matrix3.Multiply(scaleMatrix, worldMatrix, out var scaledWorld);
|
||||
Matrix3.Multiply(rotationMatrix, scaledWorld, out var matty);
|
||||
|
||||
handle.SetTransform(matty);
|
||||
|
||||
var icon = "NoId";
|
||||
var icon_job = GetIcon(hum.Owner);
|
||||
if (icon_job != null)
|
||||
icon = icon_job;
|
||||
|
||||
var sprite_icon = new SpriteSpecifier.Rsi(new ResPath("/Textures/Interface/Misc/job_icons.rsi"), icon);
|
||||
var _iconTexture = _entManager.EntitySysManager.GetEntitySystem<SpriteSystem>().Frame0(sprite_icon);
|
||||
|
||||
// Use the sprite itself if we know its bounds. This means short or tall sprites don't get overlapped
|
||||
// by the bar.
|
||||
float yOffset;
|
||||
float xOffset;
|
||||
if (spriteQuery.TryGetComponent(hum.Owner, out var sprite))
|
||||
{
|
||||
yOffset = sprite.Bounds.Height + 7f; //sprite.Bounds.Height + 7f;
|
||||
xOffset = sprite.Bounds.Width - 17f; //sprite.Bounds.Width + 7f;
|
||||
}
|
||||
else
|
||||
{
|
||||
yOffset = 1f;
|
||||
xOffset = 1f;
|
||||
}
|
||||
|
||||
// Position above the entity (we've already applied the matrix transform to the entity itself)
|
||||
// Offset by the texture size for every do_after we have.
|
||||
var position = new Vector2(xOffset / EyeManager.PixelsPerMeter,
|
||||
yOffset / EyeManager.PixelsPerMeter);
|
||||
|
||||
// Draw the underlying bar texture
|
||||
if (sprite != null && !sprite.ContainerOccluded)
|
||||
handle.DrawTexture(_iconTexture, position);
|
||||
}
|
||||
|
||||
handle.UseShader(null);
|
||||
handle.SetTransform(Matrix3.Identity);
|
||||
}
|
||||
|
||||
private string? GetIcon(EntityUid uid)
|
||||
{
|
||||
if (_inventorySystem.TryGetSlotEntity(uid, "id", out var idUid))
|
||||
{
|
||||
// PDA
|
||||
if (_entManager.TryGetComponent(idUid, out PdaComponent? pda) &&
|
||||
_entManager.TryGetComponent(pda.ContainedId, out IdCardComponent? idCard))
|
||||
{
|
||||
if (TryMatchJobTitleToIcon(idCard.JobTitle, out string? icon))
|
||||
return icon;
|
||||
}
|
||||
// ID Card
|
||||
if (_entManager.TryGetComponent(idUid, out IdCardComponent? id))
|
||||
{
|
||||
if (TryMatchJobTitleToIcon(id.JobTitle, out string? icon))
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetNameAndJob(IdCardComponent id)
|
||||
{
|
||||
var jobSuffix = string.IsNullOrWhiteSpace(id.JobTitle) ? string.Empty : $" ({id.JobTitle})";
|
||||
|
||||
var val = string.IsNullOrWhiteSpace(id.FullName)
|
||||
? Loc.GetString("access-id-card-component-owner-name-job-title-text",
|
||||
("jobSuffix", jobSuffix))
|
||||
: Loc.GetString("access-id-card-component-owner-full-name-job-title-text",
|
||||
("fullName", id.FullName),
|
||||
("jobSuffix", jobSuffix));
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
private bool TryMatchJobTitleToIcon(string? jobTitle, [NotNullWhen(true)] out string? jobIcon)
|
||||
{
|
||||
foreach (var job in _prototypeManager.EnumeratePrototypes<JobPrototype>())
|
||||
{
|
||||
if (job.LocalizedName == jobTitle)
|
||||
{
|
||||
jobIcon = job.Icon;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
jobIcon = "CustomId";
|
||||
return true; // For 'CustomId' icon we need send 'true' result;
|
||||
}
|
||||
}
|
||||
65
Content.Client/White/EntityJobInfo/ShowJobInfoSystem.cs
Normal file
65
Content.Client/White/EntityJobInfo/ShowJobInfoSystem.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using Content.Shared.EntityJobInfo;
|
||||
using Content.Shared.GameTicking;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Content.Shared.Inventory;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Client.EntityJobInfo
|
||||
{
|
||||
public sealed class ShowJobInfoSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IPlayerManager _player = default!;
|
||||
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
||||
[Dependency] private readonly IOverlayManager _overlayMan = default!;
|
||||
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
||||
|
||||
private EntityJobInfoOverlay _overlay = default!;
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<ShowJobInfoComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<ShowJobInfoComponent, ComponentRemove>(OnRemove);
|
||||
SubscribeLocalEvent<ShowJobInfoComponent, PlayerAttachedEvent>(OnPlayerAttached);
|
||||
SubscribeLocalEvent<ShowJobInfoComponent, PlayerDetachedEvent>(OnPlayerDetached);
|
||||
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart);
|
||||
|
||||
_overlay = new(EntityManager, _protoMan, _inventorySystem);
|
||||
}
|
||||
|
||||
private void OnInit(EntityUid uid, ShowJobInfoComponent component, ComponentInit args)
|
||||
{
|
||||
if (_player.LocalPlayer?.ControlledEntity == uid)
|
||||
{
|
||||
_overlayMan.AddOverlay(_overlay);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private void OnRemove(EntityUid uid, ShowJobInfoComponent component, ComponentRemove args)
|
||||
{
|
||||
if (_player.LocalPlayer?.ControlledEntity == uid)
|
||||
{
|
||||
_overlayMan.RemoveOverlay(_overlay);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPlayerAttached(EntityUid uid, ShowJobInfoComponent component, PlayerAttachedEvent args)
|
||||
{
|
||||
_overlayMan.AddOverlay(_overlay);
|
||||
}
|
||||
|
||||
private void OnPlayerDetached(EntityUid uid, ShowJobInfoComponent component, PlayerDetachedEvent args)
|
||||
{
|
||||
_overlayMan.RemoveOverlay(_overlay);
|
||||
}
|
||||
|
||||
private void OnRoundRestart(RoundRestartCleanupEvent args)
|
||||
{
|
||||
_overlayMan.RemoveOverlay(_overlay);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ namespace Content.Shared.Overlays;
|
||||
/// This component allows you to see health bars above damageable mobs.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class ShowWhiteHealthBarsComponent : Component
|
||||
public sealed partial class ShowHealthBarsComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Displays health bars of the damage containers.
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Shared.Clothing
|
||||
{
|
||||
[DataField("component", required: true)]
|
||||
[AlwaysPushInheritance]
|
||||
public ComponentRegistry Components { get; } = new();
|
||||
public ComponentRegistry Components { get; set; } = new();
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool IsActive = false;
|
||||
|
||||
@@ -26,9 +26,9 @@ public sealed class ClothingGrantingSystem : EntitySystem
|
||||
|
||||
if (!clothing.Slots.HasFlag(args.SlotFlags)) return;
|
||||
|
||||
if (component.Components.Count > 1)
|
||||
if (component.Components.Count > 8)
|
||||
{
|
||||
Logger.Error("Although a component registry supports multiple components, we cannot bookkeep more than 1 component for ClothingGrantComponent at this time.");
|
||||
Logger.Error("Although a component registry supports multiple components, we cannot bookkeep more than 8 component for ClothingGrantComponent at this time.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,10 @@ namespace Content.Shared.EntityHealthBar
|
||||
/// This component allows you to see health bars above damageable mobs.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class ShowHealthBarsComponent : Component
|
||||
public sealed partial class ShowWhiteHealthBarsComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// If null, displays all health bars.
|
||||
/// If not null, displays health bars of only that damage container.
|
||||
/// Displays health bars of the damage containers.
|
||||
/// </summary>
|
||||
|
||||
[DataField("damageContainers", customTypeSerializer: typeof(PrototypeIdListSerializer<DamageContainerPrototype>))]
|
||||
|
||||
10
Content.Shared/White/EntityJobInfo/ShowJobInfoComponent.cs
Normal file
10
Content.Shared/White/EntityJobInfo/ShowJobInfoComponent.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Content.Shared.EntityJobInfo;
|
||||
|
||||
/// <summary>
|
||||
/// This component allows you to see job icon from entity(char)
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class ShowJobInfoComponent : Component
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
ent-ClothingEyesHudAdvanced = расширенный визор
|
||||
.desc = Расширенный девайс, позволяющий видеть должность и состояние здоровья сущности.
|
||||
@@ -8,10 +8,6 @@
|
||||
sprite: Clothing/Eyes/Hud/diag.rsi
|
||||
- type: Clothing
|
||||
sprite: Clothing/Eyes/Hud/diag.rsi
|
||||
# - type: ShowHealthBars
|
||||
# damageContainers:
|
||||
# - Inorganic
|
||||
# - Silicon
|
||||
- type: ClothingGrantComponent
|
||||
component:
|
||||
- type: ShowWhiteHealthBars
|
||||
@@ -32,9 +28,9 @@
|
||||
# - type: ShowHealthBars
|
||||
# damageContainers:
|
||||
# - Biological
|
||||
# - type: ShowHealthIcons
|
||||
# damageContainers:
|
||||
# - Biological
|
||||
- type: ShowHealthIcons
|
||||
damageContainers:
|
||||
- Biological
|
||||
- type: ClothingGrantComponent
|
||||
component:
|
||||
- type: ShowWhiteHealthBars
|
||||
@@ -118,9 +114,9 @@
|
||||
# - type: ShowHealthBars
|
||||
# damageContainers:
|
||||
# - Biological
|
||||
# - type: ShowHealthIcons
|
||||
# damageContainers:
|
||||
# - Biological
|
||||
- type: ShowHealthIcons
|
||||
damageContainers:
|
||||
- Biological
|
||||
- type: ClothingGrantComponent
|
||||
component:
|
||||
- type: ShowWhiteHealthBars
|
||||
@@ -141,9 +137,9 @@
|
||||
# - type: ShowHealthBars
|
||||
# damageContainers:
|
||||
# - Biological
|
||||
# - type: ShowHealthIcons
|
||||
# damageContainers:
|
||||
# - Biological
|
||||
- type: ShowHealthIcons
|
||||
damageContainers:
|
||||
- Biological
|
||||
- type: ClothingGrantComponent
|
||||
component:
|
||||
- type: ShowWhiteHealthBars
|
||||
@@ -181,13 +177,14 @@
|
||||
damageContainers:
|
||||
- Biological
|
||||
- Inorganic
|
||||
- Silicon
|
||||
# - type: ShowHealthBars
|
||||
# damageContainers:
|
||||
# - Biological
|
||||
# - Inorganic
|
||||
# - type: ShowHealthIcons
|
||||
# damageContainers:
|
||||
# - Biological
|
||||
- type: ShowHealthIcons
|
||||
damageContainers:
|
||||
- Biological
|
||||
- type: ShowSyndicateIcons
|
||||
|
||||
- type: entity
|
||||
@@ -205,15 +202,16 @@
|
||||
# damageContainers:
|
||||
# - Biological
|
||||
# - Inorganic
|
||||
# - type: ShowHealthIcons
|
||||
# damageContainers:
|
||||
# - Biological
|
||||
- type: ShowHealthIcons
|
||||
damageContainers:
|
||||
- Biological
|
||||
- type: ClothingGrantComponent
|
||||
component:
|
||||
- type: ShowWhiteHealthBars
|
||||
damageContainers:
|
||||
- Biological
|
||||
- Inorganic
|
||||
- Silicon
|
||||
- type: ShowHungerIcons
|
||||
- type: ShowThirstIcons
|
||||
- type: ShowSyndicateIcons
|
||||
|
||||
@@ -220,6 +220,12 @@
|
||||
access: [["Medical"], ["Command"], ["Research"]]
|
||||
- type: Inventory
|
||||
templateId: borgDutch
|
||||
- type: ShowHealthIcons
|
||||
damageContainers:
|
||||
- Biological
|
||||
- type: ShowWhiteHealthBars
|
||||
damageContainers:
|
||||
- Biological
|
||||
|
||||
- type: entity
|
||||
id: BorgChassisService
|
||||
|
||||
@@ -352,9 +352,9 @@
|
||||
# - type: ShowHealthBars
|
||||
# damageContainers:
|
||||
# - Biological
|
||||
# - type: ShowHealthIcons
|
||||
# damageContainers:
|
||||
# - Biological
|
||||
- type: ShowHealthIcons
|
||||
damageContainers:
|
||||
- Biological
|
||||
- type: ShowWhiteHealthBars
|
||||
damageContainers:
|
||||
- Biological
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
- type: statusIcon
|
||||
id: HealthIconFine
|
||||
priority: 1
|
||||
priority: 0
|
||||
icon:
|
||||
sprite: Interface/Misc/health_icons.rsi
|
||||
state: Fine
|
||||
locationPreference: Right
|
||||
locationPreference: Right
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 184 B |
Binary file not shown.
|
After Width: | Height: | Size: 272 B |
Binary file not shown.
|
After Width: | Height: | Size: 182 B |
18
Resources/Textures/Interface/Misc/health_state.rsi/meta.json
Normal file
18
Resources/Textures/Interface/Misc/health_state.rsi/meta.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"license": "CC-BY-SA-3.0",
|
||||
"copyright": "https://github.com/tgstation/tgstation/blob/10f1193ed286281a868e5824428938addbc045af/icons/mob/huds/hud.dmi",
|
||||
"version": 1,
|
||||
"size": { "y": 8, "x": 8 },
|
||||
"states": [
|
||||
{
|
||||
"name": "dead_state"
|
||||
},
|
||||
{
|
||||
"name": "life_state"
|
||||
},
|
||||
{
|
||||
"name": "defib_state",
|
||||
"delays": [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1]]
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 108 B |
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"version": 1,
|
||||
"size": {
|
||||
"y": 3,
|
||||
"x": 16
|
||||
},
|
||||
"license": "CC-BY-SA-3.0",
|
||||
"copyright": "https://github.com/tgstation/tgstation/blob/886ca0f8dddf83ecaf10c92ff106172722352192/icons/effects/progessbar.dmi",
|
||||
"states": [
|
||||
{
|
||||
"name": "background"
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
Resources/Textures/Interface/Misc/job_icons.rsi/CustomId.png
Normal file
BIN
Resources/Textures/Interface/Misc/job_icons.rsi/CustomId.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 169 B |
@@ -8,6 +8,9 @@
|
||||
"y": 8
|
||||
},
|
||||
"states": [
|
||||
{
|
||||
"name": "CustomId"
|
||||
},
|
||||
{
|
||||
"name": "Detective"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user