Skip to content
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

Closed
wants to merge 16 commits into from
Closed

css_peace / first warden mute #69

wants to merge 16 commits into from

Conversation

P250
Copy link
Contributor

@P250 P250 commented Mar 4, 2024

  • Added IEventService, see the class for more detail
  • Added css_peace that can only be run by warden
  • When first warden is assigned the mute is also invoked
  • removed unused imports

Currently there are no config stuff as I haven't look into that. There is an admin bypass for css_peace

Copy link
Contributor

@MSWS MSWS Mar 4, 2024

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)
Copy link
Contributor

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.

Copy link
Contributor Author

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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);
Copy link
Contributor

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.

Copy link
Contributor Author

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;
Copy link
Contributor

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

Copy link
Contributor Author

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)
Copy link
Contributor

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>();
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point 😆

BuildTools added 2 commits March 4, 2024 22:51
…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
using Jailbreak.Public.Mod.Rebel;

namespace Jailbreak.Rebel;

public class RebelManager : IPluginBehavior, IRebelService
{
private IRebelNotifications notifs;
//private IRebelNotifications notifs;
Copy link
Contributor Author

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 =
Copy link
Contributor Author

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}]")
Copy link
Contributor Author

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

@MSWS MSWS changed the base branch from main to dev March 5, 2024 23:53
@P250
Copy link
Contributor Author

P250 commented Mar 6, 2024

An important comment is I need to add support for warmup...

BuildTools added 4 commits March 6, 2024 13:50
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.
Copy link
Contributor Author

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

BuildTools and others added 4 commits March 6, 2024 15:18
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)
Copy link
Contributor Author

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.

@Mooshua Mooshua added this to the 1.1 milestone Mar 8, 2024
@MSWS MSWS deleted the branch edgegamers:dev March 29, 2024 08:58
@MSWS MSWS closed this Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants