Files
wwdpublic/Content.Client/Zombies/ZombieSystem.cs
SimpleStation14 47127bdb23 Mirror: Initial Infected can see each other (#265)
## Mirror of PR #25934: [Initial Infected can see each
other](https://github.com/space-wizards/space-station-14/pull/25934)
from <img src="https://avatars.githubusercontent.com/u/10567778?v=4"
alt="space-wizards" width="22"/>
[space-wizards](https://github.com/space-wizards)/[space-station-14](https://github.com/space-wizards/space-station-14)

###### `45d6c03407e41d92caa368e1db826efd6d828b66`

PR opened by <img
src="https://avatars.githubusercontent.com/u/47712032?v=4"
width="16"/><a href="https://github.com/Killerqu00"> Killerqu00</a> at
2024-03-08 19:28:04 UTC

---

PR changed 6 files with 40 additions and 1 deletions.

The PR had the following labels:
- Changes: Sprites
- Status: Needs Review


---

<details open="true"><summary><h1>Original Body</h1></summary>

> <!-- Please read these guidelines before opening your PR:
https://docs.spacestation14.io/en/getting-started/pr-guideline -->
> <!-- The text between the arrows are comments - they will not be
visible on your PR. -->
> 
> ## About the PR
> Initial Infected now have an icon that is visible to other initial
infected. This allows for better communication.
> Also, Initial Infected can now see other zombies(just a slight QoL).
> 
> ## Why / Balance
> This is a slight zombie buff and also encourages teamwork between II.
Most of the zombie outbreaks are ruined because II turned alone/in a bad
situation. With this PR, they will be able to recognise themselves and
communicate.
> 
> ## Technical details
> <!-- If this is a code change, summarize at high level how your new
code works. This makes it easier to review. -->
> 
> ## Media
> <!-- 
> PRs which make ingame changes (adding clothing, items, new features,
etc) are required to have media attached that showcase the changes.
> Small fixes/refactors are exempt.
> Any media may be used in SS14 progress reports, with clear credit
given.
> 
> If you're unsure whether your PR will require media, ask a maintainer.
> 
> Check the box below to confirm that you have in fact seen this (put an
X in the brackets, like [X]):
> -->
>
![image](https://github.com/space-wizards/space-station-14/assets/47712032/d74926d6-97c9-4749-bcd5-7d42fe886c37)
> 
> - [X] I have added screenshots/videos to this PR showcasing its
changes ingame, **or** this PR does not require an ingame showcase
> 
> ## Breaking changes
> <!--
> List any breaking changes, including namespace, public
class/method/field changes, prototype renames; and provide instructions
for fixing them. This will be pasted in #codebase-changes.
> -->
> 
> **Changelog**
> <!--
> Make players aware of new features and changes that could affect how
they play the game by adding a Changelog entry. Please read the
Changelog guidelines located at:
https://docs.spacestation14.io/en/getting-started/pr-guideline#changelog
> -->
> 🆑
> - add: Initial Infected now can see each other.
> - add: Initial Infected can now see zombified entities.
> 


</details>

Co-authored-by: SimpleStation14 <Unknown>
2024-05-09 00:00:48 -04:00

60 lines
1.9 KiB
C#

using System.Linq;
using Content.Shared.Ghost;
using Content.Shared.Humanoid;
using Content.Shared.StatusIcon.Components;
using Content.Shared.Zombies;
using Robust.Client.GameObjects;
namespace Content.Client.Zombies;
public sealed class ZombieSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ZombieComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<ZombieComponent, CanDisplayStatusIconsEvent>(OnCanDisplayStatusIcons);
SubscribeLocalEvent<InitialInfectedComponent, CanDisplayStatusIconsEvent>(OnCanDisplayStatusIcons);
}
private void OnStartup(EntityUid uid, ZombieComponent component, ComponentStartup args)
{
if (HasComp<HumanoidAppearanceComponent>(uid))
return;
if (!TryComp<SpriteComponent>(uid, out var sprite))
return;
for (var i = 0; i < sprite.AllLayers.Count(); i++)
{
sprite.LayerSetColor(i, component.SkinColor);
}
}
/// <summary>
/// Determines whether a player should be able to see the StatusIcon for zombies.
/// </summary>
private void OnCanDisplayStatusIcons(EntityUid uid, ZombieComponent component, ref CanDisplayStatusIconsEvent args)
{
if (HasComp<ZombieComponent>(args.User) || HasComp<InitialInfectedComponent>(args.User) || HasComp<ShowZombieIconsComponent>(args.User))
return;
if (component.IconVisibleToGhost && HasComp<GhostComponent>(args.User))
return;
args.Cancelled = true;
}
private void OnCanDisplayStatusIcons(EntityUid uid, InitialInfectedComponent component, CanDisplayStatusIconsEvent args)
{
if (HasComp<InitialInfectedComponent>(args.User) && !HasComp<ZombieComponent>(args.User))
return;
if (component.IconVisibleToGhost && HasComp<GhostComponent>(args.User))
return;
args.Cancelled = true;
}
}