* Initial work on having the Rev icons not be visible to ghosts depending on a Cvar and a component. This commit just makes it so that the revcomponent and headrev component are not shared with clients that shouldn't know about them. This is due to the concern that clients having access to those components, even if no image was displayed could allow modified clients to have meta knowledge of revs. Currently this has the issue that if a player later for example becomes a rev, none of the existing rev components get networked to them. I am not sure there is currently an effecient solution to this. This is probably in an issue for a lot more stuff. I might just make it so all the logic just moves to the client on whether to put the icon again. Also this commit adds the ShowRevIconsComponent to allow anyone with it to just view rev icons. * Rev components now get communicated to clients that didn't have them previously and the AntagIconSystem is now properly checking whether to give the icons. We now dirty all the rev/headrev components when someone gets converted or gets the ViewRevIcons component. The AntagIconSystem now checks whether it should draw the icons mostly based on an event, this is still done client side. This is not a full proof solution to make it so clients can't know someone is an antag when they shouldn't because: 1. There are other components that need similar treatment, to my knowledge not to for revs but for other antags. Maybe even the mind component. This could be addressed in future PRs. 2. We cannot ensure that clients forget about these components if the client gets deconverted for example. We can of course have code that does this, but it will necessarily need to be done on the client and if the client is modified then there is no way to ensure this. Of course at that point they should already know who their fellow revs are so this might not be an issue. I now need to do the same thing for zombies in a future commit. A similar system for nukies also needs to be looked at but I will not be doing that in the PR this commit ends up in. * Misc name changes and cleaning up the ZombieSystem Changed some names around and decoupled the ZombieSystem from the AntagStatusIconsystem. Now there is a cvar for ghost visibility for them as well. The Zombie Component was not made SessionSpecific because: 1. Zombies are pretty visible anyways 2. The Component is needed to change the appearance of zombie players. * Misc name changes and cleaning up the ZombieSystem Changed some names around and decoupled the ZombieSystem from the AntagStatusIconsystem. Now there is a cvar for ghost visibility for them as well. The Zombie Component was not made SessionSpecific because: 1. Zombies are pretty visible anyways 2. The Component is needed to change the appearance of zombie players. * Merged 2 if statements into 1 on the Zombiesystem. * Cut down on code duplication in AntagStatusIconSystem Now instead of having a seperate function for each component, there is 1 generic function. Functions for special cases like the Rev/Headrev comp can have a separate function that does the special check and then calls the generic one. This is done through the IAntagStatusIconComponent interface which provides a common interface to get the Icon. * Removed some duplication from the SharedRevolutionarySystem with generics. I have no idea why I didn't think of this sooner. * Addressed Reviews I think I think events get unsubbed automatically but I am probably missing something that I have not understood. Either way this is a requested change. * Replace war crimes with actual fixes for reviews It was not clear to me what the reviews meant * Addressed reviews by removing need for cvars. Whether icons are visible to ghosts is now determined by a bool in IAntagStatusIcon which all antag components with status icons should implement. * Update Content.Shared/Revolutionary/SharedRevolutionarySystem.cs --------- Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
31 lines
1.0 KiB
C#
31 lines
1.0 KiB
C#
using Content.Shared.Antag;
|
|
using Robust.Shared.GameStates;
|
|
using Content.Shared.StatusIcon;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Shared.Revolutionary.Components;
|
|
|
|
/// <summary>
|
|
/// Component used for marking a Head Rev for conversion and winning/losing.
|
|
/// </summary>
|
|
[RegisterComponent, NetworkedComponent, Access(typeof(SharedRevolutionarySystem))]
|
|
public sealed partial class HeadRevolutionaryComponent : Component, IAntagStatusIconComponent
|
|
{
|
|
/// <summary>
|
|
/// The status icon corresponding to the head revolutionary.
|
|
/// </summary>
|
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
|
public ProtoId<StatusIconPrototype> StatusIcon { get; set; } = "HeadRevolutionaryFaction";
|
|
|
|
/// <summary>
|
|
/// How long the stun will last after the user is converted.
|
|
/// </summary>
|
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
|
public TimeSpan StunTime = TimeSpan.FromSeconds(3);
|
|
|
|
public override bool SessionSpecific => true;
|
|
|
|
[DataField]
|
|
public bool IconVisibleToGhost { get; set; } = true;
|
|
}
|