-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
css_peace / first warden mute #69
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a cooldown to the command?
Also, please add a message broadcasted to players that the warden issued peace.
@@ -66,7 +70,23 @@ public bool TrySetWarden(CCSPlayerController controller) | |||
.ToAllCenter(); | |||
|
|||
_logs.Append( _logs.Player(_warden), "is now the warden."); | |||
|
|||
// makes sure the second person (and people thereafter) who claim warden are not labelled as "first warden" | |||
if (_currentWardenIsFirst && _firstWarden) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confusing variable / if check here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed entirely :P idk why it's there!
private readonly ICoroutines _coroutines; | ||
private readonly IEventsService _eventsService; | ||
|
||
private readonly float _muteTime = 10.0f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible distinguish this variable from https://github.com/edgegamers/Jailbreak/pull/69/files#diff-e81c196d0b0e42fe347b9e3ee80c463e42c9aa74b8baec3127ed11383c01feaeR16
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
// todo document saying that by default all admins SHOULD bypass this mute | ||
// not implemented bypass yet | ||
public void PeaceMute(float time, bool exemptWarden = false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warden should always be exempt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
if (warden == null) return; | ||
|
||
// we only want the warden to be able to run this! | ||
if (!invoker.Equals(warden)) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a fan of wrapping around already written logic for checking if activator is warden. Please use https://github.com/edgegamers/Jailbreak/blob/main/public/Jailbreak.Public/Mod/Warden/IWardenService.cs#L15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also done
foreach (CCSPlayerController player in Utilities.GetPlayers()) | ||
{ | ||
|
||
if (player.Equals(_wardenService.Warden) && exemptWarden) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue here, use the interface instead of lower level logic.
public void PeaceMute(float time, bool exemptWarden = false) | ||
{ | ||
|
||
List<CCSPlayerController> alreadyMuted = new List<CCSPlayerController>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why keep track of already muted players?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point 😆
…heck (for muted players) which does nothing if not set by admin\nadded notification support for whole peace system\ncleanup some random code\nhandled most edge cases I can think of\n TODO handle unmuting players after warmup ends
mod/Jailbreak.Rebel/RebelManager.cs
Outdated
using Jailbreak.Public.Mod.Rebel; | ||
|
||
namespace Jailbreak.Rebel; | ||
|
||
public class RebelManager : IPluginBehavior, IRebelService | ||
{ | ||
private IRebelNotifications notifs; | ||
//private IRebelNotifications notifs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable? :)
@@ -10,7 +9,7 @@ namespace Jailbreak.English.Generic; | |||
|
|||
public class GenericCommandNotifications : IGenericCommandNotifications, ILanguage<Formatting.Languages.English> | |||
{ | |||
public static FormatObject PREFIX = | |||
public static FormatObject GENERIC_PREFIX = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed all prefix's so I can statically include them in my Notification implementation
@@ -11,7 +10,7 @@ namespace Jailbreak.English.Warden; | |||
|
|||
public class WardenNotifications : IWardenNotifications, ILanguage<Formatting.Languages.English> | |||
{ | |||
public static FormatObject PREFIX = new HiddenFormatObject($" {ChatColors.Lime}[{ChatColors.Green}WARDEN{ChatColors.Lime}]") | |||
public static readonly FormatObject WARDEN_PREFIX = new HiddenFormatObject($" {ChatColors.Lime}[{ChatColors.Green}WARDEN{ChatColors.Lime}]") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should make make it readonly for all of them :P
An important comment is I need to add support for warmup... |
Fixed lots of logic errors Added listeners for when players leave/join server to handle muting of those players Please read todo comments (note to self)
@@ -23,6 +23,8 @@ namespace Jailbreak.Warden.Global; | |||
/// Any unmute functions also try to respect this. | |||
/// There are a number of event listeners to handle edge cases, such as removing peace-mute when the round ends, or more general things such as | |||
/// enabling peace-mute for Terrorists when the round begins. | |||
/// If a player is alive they should either be able to speak unless peace-mute is active or an admin-mute is active. | |||
/// If a player is dead they should never be able to speak to alive players, and their admin-mute status should be respected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo clarify if this is true or not
separated logic for unmuting dead and alive players added ability for admins to run css_peace as well as warden
@@ -308,6 +297,19 @@ public void UnmutePrevMutedPlayers(MuteReason reason, params CsTeam[] targets) | |||
|
|||
} | |||
|
|||
public void UnmutePrevMutedDeadPlayers() | |||
{ | |||
if (_roundEnd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo I should remove this check from inside the function and have the method that calls this UnmutePrevMutedDeadPlayers() function check for round end instead.
Currently there are no config stuff as I haven't look into that. There is an admin bypass for css_peace