// Master config for core game modes
// ===================================
- // global gametype setting (0 = deathmatch)
- set gamecfg 0
+ // global gametype setting (uses gametype shortname, default gametype is deathmatch)
+ set gamecfg "dm"
// =================
set g_ca 0 "Clan Arena: Played in rounds, once you're dead you're out! The team with survivors wins the round"
set g_ca_point_limit -1 "Clan Arena point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
set g_ca_point_leadlimit -1 "Clan Arena point lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
- set g_ca_spectate_enemies 0 "Allow spectating enemy player by dead player during clan arena games"
- set g_ca_warmup 10 "how long the players will have time to run around the map before the round starts"
+ set g_ca_spectate_enemies 0 "allow eliminated players to spectate enemy players during Clan Arena games"
+ set g_ca_warmup 10 "time players get to run around before the round starts"
set g_ca_damage2score_multiplier 0.01
set g_ca_round_timelimit 180 "round time limit in seconds"
set g_ca_teams_override 0
set g_domination_point_glow 0 "domination point glow (warning, slow)"
set g_domination_roundbased 0 "enable round-based domination (capture all control points to win the round)"
set g_domination_roundbased_point_limit 5 "capture limit in round-based domination mode"
- set g_domination_round_timelimit 120
- set g_domination_warmup 5
+ set g_domination_round_timelimit 120 "round time limit in seconds"
+ set g_domination_warmup 5 "time players have to wait before the round starts"
//set g_domination_balance_team_points 1 "# of points received is based on team sizes"
// freezetag
// ===========
set g_freezetag 0 "Freeze Tag: Freeze the opposing team(s) to win, unfreeze teammates by standing next to them"
- set g_freezetag_warmup 5 "Time players get to run around before the round starts"
+ set g_freezetag_warmup 10 "time players get to run around before the round starts"
set g_freezetag_point_limit -1 "Freeze Tag point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
set g_freezetag_point_leadlimit -1 "Freeze Tag point lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
set g_freezetag_revive_speed 0.4 "Speed for reviving a frozen teammate"
- set g_freezetag_revive_clearspeed 1.6 "Speed at which reviving progress gets lost when out of range"
+ set g_freezetag_revive_speed_t2s 0.25 "Speed for reviving a frozen teammate if g_freezetag_revive_time_to_score is active"
+ set g_freezetag_revive_clearspeed 1.6 "Speed at which reviving progress gets lost when out of range (if g_freezetag_revive_time_to_score is active reviving progress is not cleared)"
set g_freezetag_revive_extra_size 100 "Distance in qu that you can stand from a frozen teammate to keep reviving him"
set g_freezetag_revive_nade 1 "Enable reviving from own nade explosion"
set g_freezetag_revive_nade_health 40 "Amount of health player has if they revived from their own nade explosion"
+ set g_freezetag_revive_time_to_score 1.5 "every this amount of seconds give players reviving a frozen teammate 1 point"
set g_freezetag_round_timelimit 360 "round time limit in seconds"
+ set g_freezetag_revive_auto 1 "automatically revive frozen players after some time (g_freezetag_frozen_maxtime)"
+ set g_freezetag_revive_auto_progress 1 "start the automatic reviving progress as soon as the player gets frozen"
+ set g_freezetag_revive_auto_reducible 1 "reduce auto-revival time when frozen players are hit by enemies; set to -1 to reduce it even when they are hit by teammates"
+ set g_freezetag_revive_auto_reducible_forcefactor 0.01 "hit force to time reduction conversion factor"
+ set g_freezetag_revive_auto_reducible_maxforce 400 "max force considered at once"
+ set g_freezetag_revive_spawnshield 1 "apply spawnshield for this time in seconds after the player has been revived"
set g_freezetag_frozen_maxtime 60 "frozen players will be automatically unfrozen after this time in seconds"
set g_freezetag_teams_override 0
set g_freezetag_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any"
set g_lms_last_join 3 "if g_lms_join_anytime is false, new players can only join if the worst active player has more than (fraglimit - g_lms_last_join) lives"
set g_lms_join_anytime 1 "if true, new players can join, but get same amount of lives as the worst player"
set g_lms_weaponarena "most_available" "starting weapons - takes the same options as g_weaponarena"
+set g_lms_leader_wp_lives 2 "show waypoints for players leading by this number of lives"
+set g_lms_leader_wp_max_relative 0.5 "show waypoints for leaders only if they are max this fraction of total players"
+set g_lms_leader_wp_time 5 "show waypoints for leaders only for this amount of time"
+set g_lms_leader_wp_time_repeat 30 "periodically show again waypoints for leaders after this amount of time"
+set g_lms_dynamic_respawn_delay 1 "increase player respawn delay based on the number of lives less than the leader (NOTE: delay doesn't increase when only 2 players are left alive)"
+set g_lms_dynamic_respawn_delay_base 2 "base player respawn delay"
+set g_lms_dynamic_respawn_delay_increase 3 "increase base player respawn delay by this amount of time for each life less than the leader"
+set g_lms_dynamic_vampire 1 "attackers receive a fraction of health removed from enemies based on the number of lives less than the enemy"
+set g_lms_dynamic_vampire_factor_base 0.1 "base vampire factor"
+set g_lms_dynamic_vampire_factor_increase 0.1 "increase vampire factor by this fraction for each life less than the enemy"
+set g_lms_dynamic_vampire_factor_max 0.5 "max vampire factor"
+set g_lms_dynamic_vampire_min_lives_diff 2 "number of lives the attacker must have less than the enemy to receive the base fraction of health"
// =========
// ===========
set g_onslaught 0 "Onslaught: take control points towards the enemy generator and then destroy it"
set g_onslaught_point_limit 1 "Onslaught point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
- set g_onslaught_warmup 5
- set g_onslaught_round_timelimit 500
+ set g_onslaught_warmup 5 "time players have to wait before the round starts"
+ set g_onslaught_round_timelimit 500 "round time limit in seconds"
set g_onslaught_teleport_radius 200 "Allows teleporting from a control point to another"
set g_onslaught_teleport_wait 5 "Time before player can teleport again"
set g_onslaught_spawn_choose 1 "Allow players to choose the control point to be spawned at"
#include <common/mutators/mutator/instagib/items.qh>
#include <server/campaign.qh>
#include <server/command/_mod.qh>
+ #include <server/world.qh>
+ #include <server/items/items.qh>
int autocvar_g_lms_extra_lives;
bool autocvar_g_lms_join_anytime;
int autocvar_g_lms_last_join;
bool autocvar_g_lms_regenerate;
+int autocvar_g_lms_leader_wp_lives;
+float autocvar_g_lms_leader_wp_max_relative;
+float autocvar_g_lms_leader_wp_time;
+float autocvar_g_lms_leader_wp_time_repeat;
+float autocvar_g_lms_dynamic_respawn_delay;
+float autocvar_g_lms_dynamic_respawn_delay_base;
+float autocvar_g_lms_dynamic_respawn_delay_increase;
+bool autocvar_g_lms_dynamic_vampire;
+float autocvar_g_lms_dynamic_vampire_factor_base;
+float autocvar_g_lms_dynamic_vampire_factor_increase;
+float autocvar_g_lms_dynamic_vampire_factor_max;
+int autocvar_g_lms_dynamic_vampire_min_lives_diff;
+
+.float lms_wp_time;
// main functions
int LMS_NewPlayerLives()
it.frags = FRAGS_PLAYER;
GameRules_scoring_add(it, LMS_LIVES, LMS_NewPlayerLives());
PutClientInServer(it);
+ if (it.waypointsprite_attachedforcarrier)
+ WaypointSprite_Kill(it.waypointsprite_attachedforcarrier);
});
}
}
}
+MUTATOR_HOOKFUNCTION(lms, CalculateRespawnTime)
+{
+ entity player = M_ARGV(0, entity);
+ player.respawn_flags |= RESPAWN_FORCE;
+
+ if (autocvar_g_lms_dynamic_respawn_delay <= 0)
+ return false;
+
+ int pl_lives = GameRules_scoring_add(player, LMS_LIVES, 0);
+ int max_lives = 0;
+ int pl_cnt = 0;
+ FOREACH_CLIENT(it != player && IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
+ int lives = GameRules_scoring_add(it, LMS_LIVES, 0);
+ if (lives > max_lives)
+ max_lives = lives;
+ pl_cnt++;
+ });
+
+ // min delay with only 2 players
+ if (pl_cnt == 1) // player wasn't counted
+ max_lives = 0;
+
+ player.respawn_time = time + autocvar_g_lms_dynamic_respawn_delay_base +
+ autocvar_g_lms_dynamic_respawn_delay_increase * max(0, max_lives - pl_lives);
+ return true;
+}
+
MUTATOR_HOOKFUNCTION(lms, ForbidSpawn)
{
entity player = M_ARGV(0, entity);
if(warmup_stage)
return false;
- if(player.frags == FRAGS_SPECTATOR)
- return true;
- if(GameRules_scoring_add(player, LMS_LIVES, 0) <= 0)
+ if(player.frags == FRAGS_SPECTATOR || GameRules_scoring_add(player, LMS_LIVES, 0) <= 0)
{
Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_LMS_NOLIVES);
return true;
return false;
}
-MUTATOR_HOOKFUNCTION(lms, PlayerDies)
-{
- entity frag_target = M_ARGV(2, entity);
-
- float tl = GameRules_scoring_add(frag_target, LMS_LIVES, 0);
- if (tl <= 0)
- {
- frag_target.respawn_flags = RESPAWN_SILENT;
- // prevent unwanted sudden rejoin as spectator and movement of spectator camera
- frag_target.respawn_time = time + 2;
- }
- frag_target.respawn_flags |= RESPAWN_FORCE;
-}
-
void lms_RemovePlayer(entity player)
{
static int quitters = 0;
{
if (player.lms_spectate_warning < 2)
{
- if(IS_BOT_CLIENT(player))
- bot_clear(player);
player.frags = FRAGS_PLAYER_OUT_OF_GAME;
int pl_cnt = 0;
FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
return true;
}
+MUTATOR_HOOKFUNCTION(lms, Damage_Calculate)
+{
+ if (!autocvar_g_lms_dynamic_vampire)
+ return;
+
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+ float frag_damage = M_ARGV(4, float);
+
+ if (IS_PLAYER(frag_attacker) && !IS_DEAD(frag_target) && frag_attacker != frag_target)
+ {
+ float vampire_factor = 0;
+
+ int frag_attacker_lives = GameRules_scoring_add(frag_attacker, LMS_LIVES, 0);
+ int frag_target_lives = GameRules_scoring_add(frag_target, LMS_LIVES, 0);
+ int diff = frag_target_lives - frag_attacker_lives - autocvar_g_lms_dynamic_vampire_min_lives_diff;
+
+ if (diff >= 0)
+ vampire_factor = autocvar_g_lms_dynamic_vampire_factor_base + diff * autocvar_g_lms_dynamic_vampire_factor_increase;
+ if (vampire_factor > 0)
+ {
+ vampire_factor = min(vampire_factor, autocvar_g_lms_dynamic_vampire_factor_max);
+ SetResourceExplicit(frag_attacker, RES_HEALTH,
+ min(GetResource(frag_attacker, RES_HEALTH) + frag_damage * vampire_factor, start_health));
+ }
+ }
+}
+
+bool lms_waypointsprite_visible_for_player(entity this, entity player, entity view) // runs on waypoints which are attached to ballcarriers, updates once per frame
+{
+ if(view.lms_wp_time)
+ if(IS_SPEC(player))
+ return false; // we don't want spectators of leaders to see the attached waypoint on the top of their screen
+
+ float leader_time = autocvar_g_lms_leader_wp_time;
+ float leader_repeat_time = leader_time + autocvar_g_lms_leader_wp_time_repeat;
+ float wp_time = this.owner.lms_wp_time;
+ if (wp_time && (time - wp_time) % leader_repeat_time > leader_time)
+ return false;
+
+ return true;
+}
+
+void lms_UpdateWaypoints()
+{
+ int max_lives = 0;
+ int pl_cnt = 0;
+ FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
+ int lives = GameRules_scoring_add(it, LMS_LIVES, 0);
+ if (lives > max_lives)
+ max_lives = lives;
+ pl_cnt++;
+ });
+
+ int second_max_lives = 0;
+ int pl_cnt_with_max_lives = 0;
+ FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
+ int lives = GameRules_scoring_add(it, LMS_LIVES, 0);
+ if (lives == max_lives)
+ pl_cnt_with_max_lives++;
+ else if (lives > second_max_lives)
+ second_max_lives = lives;
+ });
+
+ int lives_diff = autocvar_g_lms_leader_wp_lives;
+ if (max_lives - second_max_lives >= lives_diff && pl_cnt_with_max_lives <= pl_cnt * autocvar_g_lms_leader_wp_max_relative)
+ FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
+ int lives = GameRules_scoring_add(it, LMS_LIVES, 0);
+ if (lives == max_lives)
+ {
+ if (!it.waypointsprite_attachedforcarrier)
+ {
+ WaypointSprite_AttachCarrier(WP_LmsLeader, it, RADARICON_FLAGCARRIER);
+ it.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = lms_waypointsprite_visible_for_player;
+ WaypointSprite_UpdateRule(it.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
+ vector pl_color = colormapPaletteColor(it.clientcolors & 0x0F, false);
+ WaypointSprite_UpdateTeamRadar(it.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, pl_color);
+ WaypointSprite_Ping(it.waypointsprite_attachedforcarrier);
+ }
+ if (!it.lms_wp_time)
+ it.lms_wp_time = time;
+ }
+ else
+ {
+ if (it.waypointsprite_attachedforcarrier)
+ WaypointSprite_Kill(it.waypointsprite_attachedforcarrier);
+ it.lms_wp_time = 0;
+ }
+ });
+ else
+ FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
+ if (it.waypointsprite_attachedforcarrier)
+ WaypointSprite_Kill(it.waypointsprite_attachedforcarrier);
+ it.lms_wp_time = 0;
+ });
+}
+
+MUTATOR_HOOKFUNCTION(lms, PlayerDied)
+{
+ if (!warmup_stage && autocvar_g_lms_leader_wp_lives > 0)
+ lms_UpdateWaypoints();
+}
+
MUTATOR_HOOKFUNCTION(lms, GiveFragsForKill)
{
entity frag_target = M_ARGV(1, entity);
FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
pl_cnt++;
});
- if(IS_BOT_CLIENT(frag_target))
- bot_clear(frag_target);
frag_target.frags = FRAGS_PLAYER_OUT_OF_GAME;
GameRules_scoring_add(frag_target, LMS_RANK, pl_cnt);
}
MUTATOR_HOOKFUNCTION(lms, OnEntityPreSpawn)
{
+ if (MUTATOR_RETURNVALUE) return false;
if (!autocvar_g_powerups) return false;
if (!autocvar_g_lms_extra_lives) return false;
MUTATOR_HOOKFUNCTION(lms, ItemTouch)
{
+ if(MUTATOR_RETURNVALUE) return false;
+
entity item = M_ARGV(0, entity);
entity toucher = M_ARGV(1, entity);