Implement Leader feature #202
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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,!tracerand!glowcommands. 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 cvarcs2f_leader_mute_ping_no_leader. Leader commands can by default only be executed from CT team, this behaviour is controlled by cvarcs2f_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@CTand@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!leadercolorscommand. For example, if6 - "red"is for red color, then creating a beacon with either6or"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
!beaconhas 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@CTand@Ttargetting 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_particlehas been renamed tocs2f_beacon_particle, as it's now not strictly an admin feature.cs2f_leader_enable 0- Enable Leader featurecs2f_leader_vote_ratio 0.15- Ratio of votes to all online players needed for someone to become a leadercs2f_leader_actions_ct_only 1- Wheter to allow leader actions (leader-only commands) to be executed only from CT teamcs2f_leader_mute_ping_no_leader 1- Whether to mute player pings when there's no leadercs2f_leader_model_path ""- Path to player model to be used for leaders. Leave blank to not apply any modelPR 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.