mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-29 23:57:29 +00:00
* Remove Alive Icon (#1252) <!-- Guidelines: https://docs.spacestation14.io/en/getting-started/pr-guideline --> <!-- NOTE: All code submitted to this repository is ALWAYS licensed under the AGPL-3.0-or-later license. The REUSE Specification headers or separate .license files indicate a secondary license (e.g., MPL or MIT) solely to facilitate integration for projects that do not use the AGPL license. This secondary license does not replace the fact that AGPL-3.0-or-later remains the primary and binding license. Uncomment and modify the following line if you wish to change the license from the default of AGPL.--> <!--- LICENSE: AGPL --> <!-- What did you change? --> I removed the alive Icon from the Medical HUD. <!-- Discuss how this would affect game balance or explain why it was changed. Link any relevant discussions or issues. --> It blocked vision on speech bubbles and is entirely unnecessary. Is the entity moving? Probably alive. Does it not have a dead or critical icon? Probably alive. We don't need an Icon that blocks the speech bubble to tell us this. <!-- Summary of code changes for easier review. --> Added a boolean to not give the icon if an entity is alvie. Removed the Mob.Alive state from the icon finder table thing. <!-- Attach media if the PR makes ingame changes (clothing, items, features, etc). Small fixes/refactors are exempt. Media may be used in SS14 progress reports with credit. --> <img width="89" height="95" alt="grafik" src="https://github.com/user-attachments/assets/ef9308be-276b-440b-95d4-fddcaece32b9" /> <!-- Confirm the following by placing an X in the brackets [X]: --> - [X] I have read and am following the [Pull Request and Changelog Guidelines](https://docs.spacestation14.com/en/general-development/codebase-info/pull-request-guidelines.html). - [X] I have added media to this PR or it does not require an ingame showcase. - [X] I can confirm this PR contains no AI-generated content, and did not use any AI-generated content. <!-- You should understand that not following the above may get your PR closed at maintainer’s discretion --> <!-- List any breaking changes, including namespaces, public class/method/field changes, prototype renames; and provide instructions for fixing them. This will be posted in #codebase-changes. --> **Changelog** <!-- Add a Changelog entry to make players aware of new features or changes that could affect gameplay. Make sure to read the guidelines and take this Changelog template out of the comment block in order for it to show up. Changelog must have a 🆑 symbol, so the bot recognizes the changes and adds them to the game's changelog. --> 🆑 - remove: Removed the alive Icon - You can finally see if someone is typing an answer. --------- Co-authored-by: TheDen-Bot <186991657+TheDen-Bot@users.noreply.github.com> * Fixes * Actually correct Comment --------- Co-authored-by: TheDen-Bot <186991657+TheDen-Bot@users.noreply.github.com>
95 lines
3.2 KiB
C#
95 lines
3.2 KiB
C#
using Content.Shared.Atmos.Rotting;
|
|
using Content.Shared.Damage;
|
|
using Content.Shared.Inventory.Events;
|
|
using Content.Shared.Mobs.Components;
|
|
using Content.Shared.Overlays;
|
|
using Content.Shared.StatusIcon;
|
|
using Content.Shared.StatusIcon.Components;
|
|
using Robust.Shared.Prototypes;
|
|
using System.Linq;
|
|
using Content.Shared.Mobs; // The Den - Nuke Health icons.
|
|
|
|
|
|
namespace Content.Client.Overlays;
|
|
|
|
/// <summary>
|
|
/// Shows a healthy icon on mobs.
|
|
/// </summary>
|
|
public sealed class ShowHealthIconsSystem : EquipmentHudSystem<ShowHealthIconsComponent>
|
|
{
|
|
[Dependency] private readonly IPrototypeManager _prototypeMan = default!;
|
|
|
|
[ViewVariables]
|
|
public HashSet<string> DamageContainers = new();
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<DamageableComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
|
|
SubscribeLocalEvent<ShowHealthIconsComponent, AfterAutoHandleStateEvent>(OnHandleState);
|
|
}
|
|
|
|
protected override void UpdateInternal(RefreshEquipmentHudEvent<ShowHealthIconsComponent> component)
|
|
{
|
|
base.UpdateInternal(component);
|
|
|
|
foreach (var damageContainerId in component.Components.SelectMany(x => x.DamageContainers))
|
|
{
|
|
DamageContainers.Add(damageContainerId);
|
|
}
|
|
}
|
|
|
|
protected override void DeactivateInternal()
|
|
{
|
|
base.DeactivateInternal();
|
|
|
|
DamageContainers.Clear();
|
|
}
|
|
|
|
private void OnHandleState(Entity<ShowHealthIconsComponent> ent, ref AfterAutoHandleStateEvent args)
|
|
{
|
|
RefreshOverlay();
|
|
}
|
|
|
|
private void OnGetStatusIconsEvent(Entity<DamageableComponent> entity, ref GetStatusIconsEvent args)
|
|
{
|
|
if (!IsActive)
|
|
return;
|
|
|
|
var healthIcons = DecideHealthIcons(entity);
|
|
|
|
args.StatusIcons.AddRange(healthIcons);
|
|
}
|
|
|
|
private IReadOnlyList<HealthIconPrototype> DecideHealthIcons(Entity<DamageableComponent> entity)
|
|
{
|
|
var damageableComponent = entity.Comp;
|
|
|
|
if (damageableComponent.DamageContainerID == null ||
|
|
!DamageContainers.Contains(damageableComponent.DamageContainerID))
|
|
{
|
|
return Array.Empty<HealthIconPrototype>();
|
|
}
|
|
|
|
var result = new List<HealthIconPrototype>();
|
|
|
|
// Here you could check health status, diseases, mind status, etc. and pick a good icon, or multiple depending on whatever.
|
|
if (damageableComponent?.DamageContainerID == "Biological")
|
|
{
|
|
if (TryComp<MobStateComponent>(entity, out var state))
|
|
{
|
|
if (state.CurrentState != MobState.Alive) // Den: Nuke Alive Icon so they don't hide speech bubbles
|
|
return result;
|
|
// Since there is no MobState for a rotting mob, we have to deal with this case first.
|
|
if (HasComp<RottingComponent>(entity) && _prototypeMan.TryIndex(damageableComponent.RottingIcon, out var rottingIcon))
|
|
result.Add(rottingIcon);
|
|
else if (damageableComponent.HealthIcons.TryGetValue(state.CurrentState, out var value) && _prototypeMan.TryIndex(value, out var icon))
|
|
result.Add(icon);
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|