Skip to content

Conversation

@Faramour
Copy link
Collaborator

@Faramour Faramour commented Mar 14, 2024

PR adds Leader feature, a system widely used in Zombie Escape servers from a variety of Source Engine branches.

Players can vote for another player (or themselves) to become leaders with !vl. A leader gets access to certain leader commands as well as having their visuals (color and optionally model) changed. There can be multiple leaders.
This implementation of leaders assigns an index to each leader, which decides about default color of some of leader features. This index is incremeneted which each naturally selected leader, so each leader should have a unique color assigned as long as there is a reasonable amount of leaders.

Leaders get access to !beacon, !defend, !tracer and !glow commands. They also have immunity from being hidden by Hide system. Additionally, game default player pings are limited to only leaders when a leader is present. When there are no leaders, players can use pings but their sound is controlled by a cvar cs2f_leader_mute_ping_no_leader. Leader commands can by default only be executed from CT team, this behaviour is controlled by cvar cs2f_leader_actions_ct_only.

Leader-only commands include:

  • !beacon <target> [color] - Place a beacon on a player. Beacon is tinted by leader's color or provided [color] argument.
  • !defend [target|duration] [duration] - Place a stationary defend marker tinted by leader's color on self or another player. Default duration is 30 seconds, maximum is 60 seconds. No arguments means leader places mark on himself.
  • !tracer <target> [color] - Toggle shooting tracers for a player. Leader has tracers automatically enabled for him when he becomes a leader. He can toggle them off.

All players commands:

  • !vl <target> - Vote for another player to become a leader. Command has cooldown of 30 seconds. One player can simultaneously vote multiple players for leaders.
  • !leaderhelp - List leader-only commands in chat
  • !leadercolors - List leader colors in chat. Provides both index value and string associated with the color.

Admin commands:

  • !forceld <target> [color] - Force a player to be a leader. [color] argument allows admin to force leader to be of certain color.
  • !stripld <target> - Strips leader from a player. This also reverts leader visuals (color/model) and removes beacons placed by that leader.

New Leader & Admin command:

  • !glow <target> [duration] - highlight a player with a glow around their player model. This glow renders above everything else. Leaders can only target a specific player. Admins can target teams with @CT and @T. If no duration is provided, it's infinite. Glow is disabled when highlighted player changes team or his model is changed.

[color] argument can be provided as either an index value (a number) or a string associated with a color. All colors and their indexes/strings are listed by !leadercolors command. For example, if 6 - "red" is for red color, then creating a beacon with either 6 or "red" as color argument will tint the beacon red. If color argument is provided, it overrides color of leader who executes the command.

It is noteworthy that !beacon has been altered in it's behaviour with this PR. Now it is a command that either Admin or Leader can use. When used by admin, it allows for @CT and @T targetting and beacons will be tinted by the team of beaconed player (CT = blue, T = orange). If admin is also a leader, his leader color will be used instead.

CVars changed/added in this PR:

  • cs2f_admin_beacon_particle has been renamed to cs2f_beacon_particle, as it's now not strictly an admin feature.
  • cs2f_leader_enable 0 - Enable Leader feature
  • cs2f_leader_vote_ratio 0.15 - Ratio of votes to all online players needed for someone to become a leader
  • cs2f_leader_actions_ct_only 1 - Wheter to allow leader actions (leader-only commands) to be executed only from CT team
  • cs2f_leader_mute_ping_no_leader 1 - Whether to mute player pings when there's no leader
  • cs2f_leader_model_path "" - Path to player model to be used for leaders. Leave blank to not apply any model

PR also adds assets which are required for leader features to work. Servers can ensure that players have downloaded and loaded these assets with the use of the MultiAddonManager.

Thanks to CS2Fixes contributors at Source2ZE Discord for helping with implementing this feature.

@xen-000 xen-000 enabled auto-merge (squash) April 23, 2024 14:01
@xen-000 xen-000 merged commit c95192e into Source2ZE:main Apr 23, 2024
@Faramour Faramour deleted the feat/leader branch April 23, 2024 18:50
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