Skip to content

Commit

Permalink
initial infected icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Killerqu00 committed Mar 8, 2024
1 parent 3c82e00 commit f8765a0
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 1 deletion.
1 change: 1 addition & 0 deletions Content.Client/Antag/AntagStatusIconSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public override void Initialize()
SubscribeLocalEvent<RevolutionaryComponent, GetStatusIconsEvent>(GetRevIcon);
SubscribeLocalEvent<ZombieComponent, GetStatusIconsEvent>(GetIcon);
SubscribeLocalEvent<HeadRevolutionaryComponent, GetStatusIconsEvent>(GetIcon);
SubscribeLocalEvent<InitialInfectedComponent, GetStatusIconsEvent>(GetIcon);
}

/// <summary>
Expand Down
14 changes: 13 additions & 1 deletion Content.Client/Zombies/ZombieSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public override void Initialize()

SubscribeLocalEvent<ZombieComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<ZombieComponent, CanDisplayStatusIconsEvent>(OnCanDisplayStatusIcons);
SubscribeLocalEvent<InitialInfectedComponent, CanDisplayStatusIconsEvent>(OnCanDisplayStatusIcons);
}

private void OnStartup(EntityUid uid, ZombieComponent component, ComponentStartup args)
Expand All @@ -36,7 +37,18 @@ private void OnStartup(EntityUid uid, ZombieComponent component, ComponentStartu
/// </summary>
private void OnCanDisplayStatusIcons(EntityUid uid, ZombieComponent component, ref CanDisplayStatusIconsEvent args)
{
if (HasComp<ZombieComponent>(args.User) || HasComp<ShowZombieIconsComponent>(args.User))
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))
Expand Down
16 changes: 16 additions & 0 deletions Content.Shared/Zombies/InitialInfectedComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Content.Shared.Antag;
using Content.Shared.StatusIcon;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;

namespace Content.Shared.Zombies;

[RegisterComponent, NetworkedComponent]
public sealed partial class InitialInfectedComponent : Component, IAntagStatusIconComponent
{
[DataField("initialInfectedStatusIcon")]
public ProtoId<StatusIconPrototype> StatusIcon { get; set; } = "InitialInfectedFaction";

[DataField]
public bool IconVisibleToGhost { get; set; } = true;
}
7 changes: 7 additions & 0 deletions Resources/Prototypes/StatusIcon/antag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
sprite: /Textures/Interface/Misc/job_icons.rsi
state: Zombie

- type: statusIcon
id: InitialInfectedFaction
priority: 11
icon:
sprite: /Textures/Interface/Misc/job_icons.rsi
state: InitialInfected

- type: statusIcon
id: RevolutionaryFaction
priority: 11
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Resources/Textures/Interface/Misc/job_icons.rsi/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@
},
{
"name": "Visitor"
},
{
"name": "InitialInfected"
}
]
}

0 comments on commit f8765a0

Please sign in to comment.