From 74a4e5c118426a16f5656cdefbb0f5efa2f71124 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 14 Oct 2015 22:36:56 +1000 Subject: [PATCH] Move all gamemode cvars into their files, also renamed a couple of freezetag frozen cvars --- defaultXonotic.cfg | 6 + gamemodes.cfg | 4 - .../gamemodes/gamemode/nexball/nexball.qc | 3 + qcsrc/server/autocvars.qh | 185 +----------------- qcsrc/server/cl_client.qc | 92 +++------ qcsrc/server/cl_client.qh | 2 - qcsrc/server/g_damage.qc | 10 +- qcsrc/server/mutators/events.qh | 47 +++++ qcsrc/server/mutators/gamemode_ca.qc | 70 +++++++ qcsrc/server/mutators/gamemode_ctf.qc | 69 +++++++ qcsrc/server/mutators/gamemode_cts.qc | 43 ++++ qcsrc/server/mutators/gamemode_domination.qc | 13 ++ qcsrc/server/mutators/gamemode_freezetag.qc | 14 ++ qcsrc/server/mutators/gamemode_invasion.qc | 10 + qcsrc/server/mutators/gamemode_keepaway.qc | 23 ++- qcsrc/server/mutators/gamemode_keyhunt.qc | 5 + qcsrc/server/mutators/gamemode_lms.qc | 6 + qcsrc/server/mutators/gamemode_onslaught.qc | 26 ++- qcsrc/server/mutators/gamemode_race.qc | 11 ++ qcsrc/server/mutators/gamemode_tdm.qc | 7 +- qcsrc/server/race.qc | 8 +- 21 files changed, 382 insertions(+), 272 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 3735e5534..c972168b0 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1340,6 +1340,12 @@ set g_weapon_charge_colormod_red_full 1 set g_weapon_charge_colormod_green_full -0.5 set g_weapon_charge_colormod_blue_full -1 +// frozen +set g_frozen_revive_falldamage 0 "Enable reviving from this amount of fall damage" +set g_frozen_revive_falldamage_health 40 "Amount of health player has if they revived from falling" +set g_frozen_damage_trigger 1 "if 1, frozen players falling into the void will die instead of teleporting to spawn" +set g_frozen_force 0.6 "How much to multiply the force on a frozen player with" + // player statistics server URI set g_playerstats_uri "" "Output player statistics information to either: URL (with ://), console (with a dash like this: -), or supply a filename to output to data directory." diff --git a/gamemodes.cfg b/gamemodes.cfg index 31a0f33d3..2d8d54067 100644 --- a/gamemodes.cfg +++ b/gamemodes.cfg @@ -380,11 +380,7 @@ set g_freezetag_revive_clearspeed 1.6 "Speed at which reviving progress gets los 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_falldamage 0 "Enable reviving from this amount of fall damage" -set g_freezetag_revive_falldamage_health 40 "Amount of health player has if they revived from falling" set g_freezetag_round_timelimit 180 "round time limit in seconds" -set g_freezetag_frozen_damage_trigger 1 "if 1, frozen players falling into the void will die instead of teleporting to spawn" -set g_freezetag_frozen_force 0.6 "How much to multiply the force on a frozen player with" set g_freezetag_frozen_maxtime 60 "frozen players will be automatically unfrozen after this time in seconds" seta g_freezetag_teams_override 0 set g_freezetag_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any" diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index f06e1ec8a..1e60ab8ea 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -2,6 +2,9 @@ #ifdef IMPLEMENTATION #ifdef SVQC +int autocvar_g_nexball_goalleadlimit; +#define autocvar_g_nexball_goallimit cvar("g_nexball_goallimit") + float autocvar_g_nexball_basketball_bouncefactor; float autocvar_g_nexball_basketball_bouncestop; float autocvar_g_nexball_basketball_carrier_highspeed; diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index affd9437e..2904d5c22 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -196,15 +196,6 @@ string autocvar_g_banned_list; bool autocvar_g_banned_list_idmode; bool autocvar_g_botclip_collisions; bool autocvar_g_bugrigs; -float autocvar_g_ca_damage2score_multiplier; -int autocvar_g_ca_point_leadlimit; -int autocvar_g_ca_point_limit; -float autocvar_g_ca_round_timelimit; -bool autocvar_g_ca_spectate_enemies; -int autocvar_g_ca_teams; -int autocvar_g_ca_teams_override; -bool autocvar_g_ca_team_spawns; -float autocvar_g_ca_warmup; bool autocvar_g_campaign; #define autocvar_g_campaign_forceteam cvar("g_campaign_forceteam") int autocvar_g_campaign_skill; @@ -223,112 +214,13 @@ float autocvar_g_chat_flood_spl_tell; int autocvar_g_chat_nospectators; bool autocvar_g_chat_teamcolors; bool autocvar_g_chat_tellprivacy; -bool autocvar_g_ctf_allow_vehicle_carry; -bool autocvar_g_ctf_allow_vehicle_touch; -bool autocvar_g_ctf_allow_monster_touch; -bool autocvar_g_ctf_throw; -float autocvar_g_ctf_throw_angle_max; -float autocvar_g_ctf_throw_angle_min; -int autocvar_g_ctf_throw_punish_count; -float autocvar_g_ctf_throw_punish_delay; -float autocvar_g_ctf_throw_punish_time; -float autocvar_g_ctf_throw_strengthmultiplier; -float autocvar_g_ctf_throw_velocity_forward; -float autocvar_g_ctf_throw_velocity_up; -float autocvar_g_ctf_drop_velocity_up; -float autocvar_g_ctf_drop_velocity_side; -bool autocvar_g_ctf_oneflag_reverse; -bool autocvar_g_ctf_portalteleport; -bool autocvar_g_ctf_pass; -float autocvar_g_ctf_pass_arc; -float autocvar_g_ctf_pass_arc_max; -float autocvar_g_ctf_pass_directional_max; -float autocvar_g_ctf_pass_directional_min; -float autocvar_g_ctf_pass_radius; -float autocvar_g_ctf_pass_wait; -bool autocvar_g_ctf_pass_request; -float autocvar_g_ctf_pass_turnrate; -float autocvar_g_ctf_pass_timelimit; -float autocvar_g_ctf_pass_velocity; -bool autocvar_g_ctf_dynamiclights; -float autocvar_g_ctf_flag_collect_delay; -float autocvar_g_ctf_flag_damageforcescale; -bool autocvar_g_ctf_flag_dropped_waypoint; -bool autocvar_g_ctf_flag_dropped_floatinwater; -bool autocvar_g_ctf_flag_glowtrails; -int autocvar_g_ctf_flag_health; -bool autocvar_g_ctf_flag_return; -float autocvar_g_ctf_flag_return_carried_radius; -float autocvar_g_ctf_flag_return_time; -bool autocvar_g_ctf_flag_return_when_unreachable; -float autocvar_g_ctf_flag_return_damage; -float autocvar_g_ctf_flag_return_damage_delay; -float autocvar_g_ctf_flag_return_dropped; -float autocvar_g_ctf_flagcarrier_auto_helpme_damage; -float autocvar_g_ctf_flagcarrier_auto_helpme_time; -float autocvar_g_ctf_flagcarrier_selfdamagefactor; -float autocvar_g_ctf_flagcarrier_selfforcefactor; -float autocvar_g_ctf_flagcarrier_damagefactor; -float autocvar_g_ctf_flagcarrier_forcefactor; -//float autocvar_g_ctf_flagcarrier_waypointforenemy_spotting; -bool autocvar_g_ctf_fullbrightflags; -bool autocvar_g_ctf_ignore_frags; -int autocvar_g_ctf_score_capture; -int autocvar_g_ctf_score_capture_assist; -int autocvar_g_ctf_score_kill; -int autocvar_g_ctf_score_penalty_drop; -int autocvar_g_ctf_score_penalty_returned; -int autocvar_g_ctf_score_pickup_base; -int autocvar_g_ctf_score_pickup_dropped_early; -int autocvar_g_ctf_score_pickup_dropped_late; -int autocvar_g_ctf_score_return; -float autocvar_g_ctf_shield_force; -float autocvar_g_ctf_shield_max_ratio; -int autocvar_g_ctf_shield_min_negscore; -bool autocvar_g_ctf_stalemate; -int autocvar_g_ctf_stalemate_endcondition; -float autocvar_g_ctf_stalemate_time; -bool autocvar_g_ctf_reverse; -float autocvar_g_ctf_dropped_capture_delay; -float autocvar_g_ctf_dropped_capture_radius; -float autocvar_g_cts_finish_kill_delay; -bool autocvar_g_cts_selfdamage; bool autocvar_g_debug_bot_commands; -int autocvar_g_domination_default_teams; -bool autocvar_g_domination_disable_frags; -int autocvar_g_domination_point_amt; -bool autocvar_g_domination_point_fullbright; -int autocvar_g_domination_point_leadlimit; -bool autocvar_g_domination_roundbased; -int autocvar_g_domination_roundbased_point_limit; -float autocvar_g_domination_round_timelimit; -float autocvar_g_domination_warmup; -#define autocvar_g_domination_point_limit cvar("g_domination_point_limit") -float autocvar_g_domination_point_rate; -int autocvar_g_domination_teams_override; bool autocvar_g_forced_respawn; string autocvar_g_forced_team_blue; string autocvar_g_forced_team_otherwise; string autocvar_g_forced_team_pink; string autocvar_g_forced_team_red; string autocvar_g_forced_team_yellow; -bool autocvar_g_freezetag_frozen_damage_trigger; -float autocvar_g_freezetag_frozen_force; -float autocvar_g_freezetag_frozen_maxtime; -float autocvar_g_freezetag_revive_falldamage; -float autocvar_g_freezetag_revive_falldamage_health; -bool autocvar_g_freezetag_revive_nade; -float autocvar_g_freezetag_revive_nade_health; -int autocvar_g_freezetag_point_leadlimit; -int autocvar_g_freezetag_point_limit; -float autocvar_g_freezetag_revive_extra_size; -float autocvar_g_freezetag_revive_speed; -float autocvar_g_freezetag_revive_clearspeed; -float autocvar_g_freezetag_round_timelimit; -int autocvar_g_freezetag_teams; -int autocvar_g_freezetag_teams_override; -bool autocvar_g_freezetag_team_spawns; -float autocvar_g_freezetag_warmup; #define autocvar_g_friendlyfire cvar("g_friendlyfire") #define autocvar_g_friendlyfire_virtual cvar("g_friendlyfire_virtual") #define autocvar_g_friendlyfire_virtual_force cvar("g_friendlyfire_virtual_force") @@ -347,35 +239,6 @@ float autocvar_g_jetpack_antigravity; int autocvar_g_jetpack_fuel; float autocvar_g_jetpack_maxspeed_side; float autocvar_g_jetpack_maxspeed_up; -int autocvar_g_keepaway_ballcarrier_effects; -float autocvar_g_keepaway_ballcarrier_damage; -float autocvar_g_keepaway_ballcarrier_force; -float autocvar_g_keepaway_ballcarrier_highspeed; -float autocvar_g_keepaway_ballcarrier_selfdamage; -float autocvar_g_keepaway_ballcarrier_selfforce; -float autocvar_g_keepaway_noncarrier_damage; -float autocvar_g_keepaway_noncarrier_force; -float autocvar_g_keepaway_noncarrier_selfdamage; -float autocvar_g_keepaway_noncarrier_selfforce; -bool autocvar_g_keepaway_noncarrier_warn; -int autocvar_g_keepaway_score_bckill; -int autocvar_g_keepaway_score_killac; -int autocvar_g_keepaway_score_timepoints; -float autocvar_g_keepaway_score_timeinterval; -float autocvar_g_keepawayball_damageforcescale; -int autocvar_g_keepawayball_effects; -float autocvar_g_keepawayball_respawntime; -int autocvar_g_keepawayball_trail_color; -int autocvar_g_keyhunt_point_leadlimit; -bool autocvar_g_keyhunt_team_spawns; -#define autocvar_g_keyhunt_point_limit cvar("g_keyhunt_point_limit") -int autocvar_g_keyhunt_teams; -int autocvar_g_keyhunt_teams_override; -int autocvar_g_lms_extra_lives; -bool autocvar_g_lms_join_anytime; -int autocvar_g_lms_last_join; -#define autocvar_g_lms_lives_override cvar("g_lms_lives_override") -bool autocvar_g_lms_regenerate; #define autocvar_g_maplist cvar_string("g_maplist") bool autocvar_g_maplist_check_waypoints; int autocvar_g_maplist_index; @@ -414,8 +277,6 @@ float autocvar_g_multijump_speed; float autocvar_g_multijump_maxspeed; float autocvar_g_multijump_dodging = 1; string autocvar_g_mutatormsg; -int autocvar_g_nexball_goalleadlimit; -#define autocvar_g_nexball_goallimit cvar("g_nexball_goallimit") //float autocvar_g_nick_flood_penalty; int autocvar_g_nick_flood_penalty_red; int autocvar_g_nick_flood_penalty_yellow; @@ -445,10 +306,6 @@ int autocvar_g_projectiles_newton_style; float autocvar_g_projectiles_newton_style_2_maxfactor; float autocvar_g_projectiles_newton_style_2_minfactor; int autocvar_g_projectiles_spread_style; -#define autocvar_g_race_laps_limit cvar("g_race_laps_limit") -float autocvar_g_race_qualifying_timelimit; -float autocvar_g_race_qualifying_timelimit_override; -int autocvar_g_race_teams; float autocvar_g_respawn_delay_small; int autocvar_g_respawn_delay_small_count; float autocvar_g_respawn_delay_large; @@ -470,11 +327,6 @@ float autocvar_g_spawn_furthest; bool autocvar_g_spawn_useallspawns; bool autocvar_g_spawnpoints_auto_move_out_of_solid; #define autocvar_g_spawnshieldtime cvar("g_spawnshieldtime") -bool autocvar_g_tdm_team_spawns; -int autocvar_g_tdm_point_limit; -int autocvar_g_tdm_point_leadlimit; -int autocvar_g_tdm_teams; -int autocvar_g_tdm_teams_override; float autocvar_g_teamdamage_resetspeed; float autocvar_g_teamdamage_threshold; bool autocvar_g_telefrags; @@ -706,15 +558,6 @@ float autocvar_g_touchexplode_radius; float autocvar_g_touchexplode_damage; float autocvar_g_touchexplode_edgedamage; float autocvar_g_touchexplode_force; -float autocvar_g_invasion_round_timelimit; -int autocvar_g_invasion_teams; -bool autocvar_g_invasion_team_spawns; -float autocvar_g_invasion_spawnpoint_spawn_delay; -#define autocvar_g_invasion_point_limit cvar("g_invasion_point_limit") -float autocvar_g_invasion_warmup; -int autocvar_g_invasion_monster_count; -bool autocvar_g_invasion_zombies_only; -float autocvar_g_invasion_spawn_delay; #define autocvar_g_bloodloss cvar("g_bloodloss") float autocvar_g_random_gravity_negative_chance; float autocvar_g_random_gravity_min; @@ -792,30 +635,6 @@ float autocvar_g_spawn_near_teammate_distance; int autocvar_g_spawn_near_teammate_ignore_spawnpoint; float autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay; float autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death; -float autocvar_g_onslaught_debug; -float autocvar_g_onslaught_teleport_wait; -bool autocvar_g_onslaught_spawn_at_controlpoints; -bool autocvar_g_onslaught_spawn_at_generator; -float autocvar_g_onslaught_cp_proxydecap; -float autocvar_g_onslaught_cp_proxydecap_distance = 512; -float autocvar_g_onslaught_cp_proxydecap_dps = 100; -float autocvar_g_onslaught_spawn_at_controlpoints_chance = 0.5; -float autocvar_g_onslaught_spawn_at_controlpoints_random; -float autocvar_g_onslaught_spawn_at_generator_chance; -float autocvar_g_onslaught_spawn_at_generator_random; -float autocvar_g_onslaught_cp_buildhealth; -float autocvar_g_onslaught_cp_buildtime; -float autocvar_g_onslaught_cp_health; -float autocvar_g_onslaught_cp_regen; -float autocvar_g_onslaught_gen_health; -float autocvar_g_onslaught_shield_force = 100; -float autocvar_g_onslaught_allow_vehicle_touch; -float autocvar_g_onslaught_round_timelimit; -float autocvar_g_onslaught_point_limit; -float autocvar_g_onslaught_warmup; -float autocvar_g_onslaught_teleport_radius; -float autocvar_g_onslaught_spawn_choose; -float autocvar_g_onslaught_click_radius; int autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health; bool autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath; bool autocvar_g_physics_clientselect; @@ -881,4 +700,8 @@ float autocvar_g_rm_laser_rapid_refire; float autocvar_g_rm_laser_rapid_delay; float autocvar_g_rm_laser_radius; float autocvar_g_rm_laser_force; +float autocvar_g_frozen_revive_falldamage; +int autocvar_g_frozen_revive_falldamage_health; +bool autocvar_g_frozen_damage_trigger; +float autocvar_g_frozen_force; #endif diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index c608c5b2c..608a05adc 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -884,14 +884,8 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2 if(g_race_qualifying || g_cts) killtime = 0; - if(g_cts && self.killindicator && self.killindicator.health == 1) // self.killindicator.health == 1 means that the kill indicator was spawned by CTS_ClientKill - { - remove(self.killindicator); - self.killindicator = world; - - ClientKill_Now(); // allow instant kill in this case - return; - } + if(MUTATOR_CALLHOOK(ClientKill, self, killtime)) + return; self.killindicator_teamchange = targetteam; @@ -983,23 +977,10 @@ void ClientKill (void) ClientKill_TeamChange(0); } -void CTS_ClientKill (entity e) // silent version of ClientKill, used when player finishes a CTS run. Useful to prevent cheating by running back to the start line and starting out with more speed -{ - e.killindicator = spawn(); - e.killindicator.owner = e; - e.killindicator.think = KillIndicator_Think; - e.killindicator.nextthink = time + (e.lip) * 0.05; - e.killindicator.cnt = ceil(autocvar_g_cts_finish_kill_delay); - e.killindicator.health = 1; // this is used to indicate that it should be silent - e.lip = 0; -} - void FixClientCvars(entity e) { // send prediction settings to the client stuffcmd(e, "\nin_bindmap 0 0\n"); - if(g_race || g_cts) - stuffcmd(e, "cl_cmd settemp cl_movecliptokeyboard 2\n"); if(autocvar_g_antilag == 3) // client side hitscan stuffcmd(e, "cl_cmd settemp cl_prydoncursor_notrace 0\n"); if(autocvar_sv_gentle) @@ -1829,49 +1810,23 @@ void SetSpectator(entity player, entity spectatee) bool Spectate(entity pl) {SELFPARAM(); - if(g_ca && !autocvar_g_ca_spectate_enemies && self.caplayer) - if(DIFF_TEAM(pl, self)) + if(MUTATOR_CALLHOOK(SpectateSet, self, pl)) return false; + pl = spec_player; SetSpectator(self, pl); return SpectateSet(); } -// Returns next available player to spectate if g_ca_spectate_enemies == 0 -entity CA_SpectateNext(entity start) -{SELFPARAM(); - if(SAME_TEAM(start, self)) - return start; - - other = start; - // continue from current player - while(other && DIFF_TEAM(other, self)) - other = find(other, classname, "player"); - - if (!other) - { - // restart from begining - other = find(other, classname, "player"); - while(other && DIFF_TEAM(other, self)) - other = find(other, classname, "player"); - } - - return other; -} - bool SpectateNext() {SELFPARAM(); other = find(self.enemy, classname, "player"); - if (g_ca && !autocvar_g_ca_spectate_enemies && self.caplayer) - // CA and ca players when spectating enemies is forbidden - other = CA_SpectateNext(other); - else - { - // other modes and ca spectators or spectating enemies is allowed - if (!other) - other = find(other, classname, "player"); - } + bool mutator_returnvalue = MUTATOR_CALLHOOK(SpectateNext, self, other); + other = spec_player; + + if(!mutator_returnvalue && !other) + other = find(other, classname, "player"); if(other) { SetSpectator(self, other); } @@ -1891,27 +1846,24 @@ bool SpectatePrev() while(other && other != self.enemy) other = other.chain; - if (g_ca && !autocvar_g_ca_spectate_enemies && self.caplayer) - { - do { other = other.chain; } - while(other && DIFF_TEAM(other, self)); + int mutator_returnvalue = MUTATOR_CALLHOOK(SpectatePrev, self, other, first); + other = spec_player; - if (!other) + switch(mutator_returnvalue) + { + case MUT_SPECPREV_FOUND: break; + case MUT_SPECPREV_RETURN: return true; + case MUT_SPECPREV_CONTINUE: + default: { - other = first; - while(other && DIFF_TEAM(other, self)) + if(other.chain) other = other.chain; - if(other == self.enemy) - return true; + else + other = first; + break; } } - else - { - if(other.chain) - other = other.chain; - else - other = first; - } + SetSpectator(self, other); return SpectateSet(); } diff --git a/qcsrc/server/cl_client.qh b/qcsrc/server/cl_client.qh index 213a02945..1b462a329 100644 --- a/qcsrc/server/cl_client.qh +++ b/qcsrc/server/cl_client.qh @@ -8,6 +8,4 @@ float CalcRotRegen(float current, float regenstable, float regenfactor, float re float Spectate(entity pl); -void CTS_ClientKill (entity e); - #endif diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index b005da47a..6a80f7e5e 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -748,22 +748,22 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d if(targ.frozen) if(deathtype != DEATH_HURTTRIGGER.m_id && deathtype != DEATH_TEAMCHANGE.m_id && deathtype != DEATH_AUTOTEAMCHANGE.m_id) { - if(autocvar_g_freezetag_revive_falldamage > 0) + if(autocvar_g_frozen_revive_falldamage > 0) if(deathtype == DEATH_FALL.m_id) - if(damage >= autocvar_g_freezetag_revive_falldamage) + if(damage >= autocvar_g_frozen_revive_falldamage) { Unfreeze(targ); - targ.health = autocvar_g_freezetag_revive_falldamage_health; + targ.health = autocvar_g_frozen_revive_falldamage_health; Send_Effect(EFFECT_ICEORGLASS, targ.origin, '0 0 0', 3); Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_REVIVED_FALL, targ.netname); Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_FREEZETAG_REVIVE_SELF); } damage = 0; - force *= autocvar_g_freezetag_frozen_force; + force *= autocvar_g_frozen_force; } - if(targ.frozen && deathtype == DEATH_HURTTRIGGER.m_id && !autocvar_g_freezetag_frozen_damage_trigger) + if(targ.frozen && deathtype == DEATH_HURTTRIGGER.m_id && !autocvar_g_frozen_damage_trigger) { Send_Effect(EFFECT_TELEPORT, targ.origin, '0 0 0', 1); diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index bc034a660..b71d9f94f 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -643,4 +643,51 @@ MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch); /**/ int record_page; MUTATOR_HOOKABLE(GetRecords, EV_GetRecords); + +#define EV_Race_FinalCheckpoint(i, o) \ + /**/ i(entity, race_player) \ + /**/ +entity race_player; +MUTATOR_HOOKABLE(Race_FinalCheckpoint, EV_Race_FinalCheckpoint); + +/** called when player triggered kill (or is changing teams), return error to not do anything */ +#define EV_ClientKill(i, o) \ + /** player */ i(entity, __self) \ + /* kill delay */ i(float, ret_float) \ + /* kill delay */ o(float, ret_float) \ + /**/ +MUTATOR_HOOKABLE(ClientKill, EV_ClientKill); + +#define EV_FixClientCvars(i, o) \ + /**/ i(entity, fix_client) \ + /**/ +entity fix_client; +MUTATOR_HOOKABLE(FixClientCvars, EV_FixClientCvars); + +#define EV_SpectateSet(i, o) \ + /**/ i(entity, __self) \ + /**/ i(entity, spec_player) \ + /**/ +entity spec_player; +MUTATOR_HOOKABLE(SpectateSet, EV_SpectateSet); + +#define EV_SpectateNext(i, o) \ + /**/ i(entity, __self) \ + /**/ i(entity, spec_player) \ + /**/ +MUTATOR_HOOKABLE(SpectateNext, EV_SpectateNext); + +#define EV_SpectatePrev(i, o) \ + /**/ i(entity, __self) \ + /**/ i(entity, spec_player) \ + /**/ i(entity, spec_first) \ + /**/ +entity spec_first; +MUTATOR_HOOKABLE(SpectatePrev, EV_SpectatePrev); + +enum { + MUT_SPECPREV_CONTINUE, // return this flag to make the function continue as normal + MUT_SPECPREV_RETURN, // return this flag to make the function return (handled entirely by mutator) + MUT_SPECPREV_FOUND // return this flag to make the function continue without default functions (handled mostly by mutator) +}; #endif diff --git a/qcsrc/server/mutators/gamemode_ca.qc b/qcsrc/server/mutators/gamemode_ca.qc index fb66bb28f..b514fa296 100644 --- a/qcsrc/server/mutators/gamemode_ca.qc +++ b/qcsrc/server/mutators/gamemode_ca.qc @@ -2,6 +2,16 @@ #include "gamemode.qh" +float autocvar_g_ca_damage2score_multiplier; +int autocvar_g_ca_point_leadlimit; +int autocvar_g_ca_point_limit; +float autocvar_g_ca_round_timelimit; +bool autocvar_g_ca_spectate_enemies; +int autocvar_g_ca_teams; +int autocvar_g_ca_teams_override; +bool autocvar_g_ca_team_spawns; +float autocvar_g_ca_warmup; + float ca_teams; float allowed_to_spawn; @@ -161,6 +171,28 @@ float ca_isEliminated(entity e) return false; } +// Returns next available player to spectate if g_ca_spectate_enemies == 0 +entity CA_SpectateNext(entity player, entity start) +{ + if(SAME_TEAM(start, player)) + return start; + + entity spec_other = start; + // continue from current player + while(spec_other && DIFF_TEAM(spec_other, player)) + spec_other = find(spec_other, classname, "player"); + + if (!spec_other) + { + // restart from begining + spec_other = find(spec_other, classname, "player"); + while(spec_other && DIFF_TEAM(spec_other, player)) + spec_other = find(spec_other, classname, "player"); + } + + return spec_other; +} + MUTATOR_HOOKFUNCTION(ca, PlayerSpawn) {SELFPARAM(); self.caplayer = 1; @@ -360,6 +392,44 @@ MUTATOR_HOOKFUNCTION(ca, Scores_CountFragsRemaining) return true; } +MUTATOR_HOOKFUNCTION(ca, SpectateSet) +{ + if(!autocvar_g_ca_spectate_enemies && self.caplayer) + if(DIFF_TEAM(spec_player, self)) + return true; + return false; +} + +MUTATOR_HOOKFUNCTION(ca, SpectateNext) +{SELFPARAM(); + if(!autocvar_g_ca_spectate_enemies && self.caplayer) + { + spec_player = CA_SpectateNext(self, spec_player); + return true; + } + return false; +} + +MUTATOR_HOOKFUNCTION(ca, SpectatePrev) +{SELFPARAM(); + if(!autocvar_g_ca_spectate_enemies && self.caplayer) + { + do { spec_player = spec_player.chain; } + while(spec_player && DIFF_TEAM(spec_player, self)); + + if (!spec_player) + { + spec_player = spec_first; + while(spec_player && DIFF_TEAM(spec_player, self)) + spec_player = spec_player.chain; + if(spec_player == self.enemy) + return MUT_SPECPREV_RETURN; + } + } + + return MUT_SPECPREV_FOUND; +} + void ca_Initialize() { allowed_to_spawn = true; diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 0b2cad28c..b813ed87f 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -9,6 +9,75 @@ #include "../../lib/warpzone/common.qh" +bool autocvar_g_ctf_allow_vehicle_carry; +bool autocvar_g_ctf_allow_vehicle_touch; +bool autocvar_g_ctf_allow_monster_touch; +bool autocvar_g_ctf_throw; +float autocvar_g_ctf_throw_angle_max; +float autocvar_g_ctf_throw_angle_min; +int autocvar_g_ctf_throw_punish_count; +float autocvar_g_ctf_throw_punish_delay; +float autocvar_g_ctf_throw_punish_time; +float autocvar_g_ctf_throw_strengthmultiplier; +float autocvar_g_ctf_throw_velocity_forward; +float autocvar_g_ctf_throw_velocity_up; +float autocvar_g_ctf_drop_velocity_up; +float autocvar_g_ctf_drop_velocity_side; +bool autocvar_g_ctf_oneflag_reverse; +bool autocvar_g_ctf_portalteleport; +bool autocvar_g_ctf_pass; +float autocvar_g_ctf_pass_arc; +float autocvar_g_ctf_pass_arc_max; +float autocvar_g_ctf_pass_directional_max; +float autocvar_g_ctf_pass_directional_min; +float autocvar_g_ctf_pass_radius; +float autocvar_g_ctf_pass_wait; +bool autocvar_g_ctf_pass_request; +float autocvar_g_ctf_pass_turnrate; +float autocvar_g_ctf_pass_timelimit; +float autocvar_g_ctf_pass_velocity; +bool autocvar_g_ctf_dynamiclights; +float autocvar_g_ctf_flag_collect_delay; +float autocvar_g_ctf_flag_damageforcescale; +bool autocvar_g_ctf_flag_dropped_waypoint; +bool autocvar_g_ctf_flag_dropped_floatinwater; +bool autocvar_g_ctf_flag_glowtrails; +int autocvar_g_ctf_flag_health; +bool autocvar_g_ctf_flag_return; +float autocvar_g_ctf_flag_return_carried_radius; +float autocvar_g_ctf_flag_return_time; +bool autocvar_g_ctf_flag_return_when_unreachable; +float autocvar_g_ctf_flag_return_damage; +float autocvar_g_ctf_flag_return_damage_delay; +float autocvar_g_ctf_flag_return_dropped; +float autocvar_g_ctf_flagcarrier_auto_helpme_damage; +float autocvar_g_ctf_flagcarrier_auto_helpme_time; +float autocvar_g_ctf_flagcarrier_selfdamagefactor; +float autocvar_g_ctf_flagcarrier_selfforcefactor; +float autocvar_g_ctf_flagcarrier_damagefactor; +float autocvar_g_ctf_flagcarrier_forcefactor; +//float autocvar_g_ctf_flagcarrier_waypointforenemy_spotting; +bool autocvar_g_ctf_fullbrightflags; +bool autocvar_g_ctf_ignore_frags; +int autocvar_g_ctf_score_capture; +int autocvar_g_ctf_score_capture_assist; +int autocvar_g_ctf_score_kill; +int autocvar_g_ctf_score_penalty_drop; +int autocvar_g_ctf_score_penalty_returned; +int autocvar_g_ctf_score_pickup_base; +int autocvar_g_ctf_score_pickup_dropped_early; +int autocvar_g_ctf_score_pickup_dropped_late; +int autocvar_g_ctf_score_return; +float autocvar_g_ctf_shield_force; +float autocvar_g_ctf_shield_max_ratio; +int autocvar_g_ctf_shield_min_negscore; +bool autocvar_g_ctf_stalemate; +int autocvar_g_ctf_stalemate_endcondition; +float autocvar_g_ctf_stalemate_time; +bool autocvar_g_ctf_reverse; +float autocvar_g_ctf_dropped_capture_delay; +float autocvar_g_ctf_dropped_capture_radius; + void ctf_FakeTimeLimit(entity e, float t) { msg_entity = e; diff --git a/qcsrc/server/mutators/gamemode_cts.qc b/qcsrc/server/mutators/gamemode_cts.qc index 21d96d82f..ae148fd47 100644 --- a/qcsrc/server/mutators/gamemode_cts.qc +++ b/qcsrc/server/mutators/gamemode_cts.qc @@ -4,6 +4,9 @@ #include "../race.qh" +float autocvar_g_cts_finish_kill_delay; +bool autocvar_g_cts_selfdamage; + // legacy bot roles .float race_checkpoint; void havocbot_role_cts() @@ -55,6 +58,17 @@ void cts_EventLog(string mode, entity actor) // use an alias for easy changing a GameLogEcho(strcat(":cts:", mode, ":", ((actor != world) ? (strcat(":", ftos(actor.playerid))) : ""))); } +void CTS_ClientKill(entity e) // silent version of ClientKill, used when player finishes a CTS run. Useful to prevent cheating by running back to the start line and starting out with more speed +{ + e.killindicator = spawn(); + e.killindicator.owner = e; + e.killindicator.think = KillIndicator_Think; + e.killindicator.nextthink = time + (e.lip) * 0.05; + e.killindicator.cnt = ceil(autocvar_g_cts_finish_kill_delay); + e.killindicator.health = 1; // this is used to indicate that it should be silent + e.lip = 0; +} + MUTATOR_HOOKFUNCTION(cts, PlayerPhysics) {SELFPARAM(); // force kbd movement for fairness @@ -304,6 +318,35 @@ MUTATOR_HOOKFUNCTION(cts, GetRecords) return false; } +MUTATOR_HOOKFUNCTION(cts, ClientKill) +{ + ret_float = 0; + + if(self.killindicator && self.killindicator.health == 1) // self.killindicator.health == 1 means that the kill indicator was spawned by CTS_ClientKill + { + remove(self.killindicator); + self.killindicator = world; + + ClientKill_Now(); // allow instant kill in this case + return; + } + +} + +MUTATOR_HOOKFUNCTION(cts, Race_FinalCheckpoint) +{ + if(autocvar_g_cts_finish_kill_delay) + CTS_ClientKill(self); + + return false; +} + +MUTATOR_HOOKFUNCTION(cts, FixClientCvars) +{ + stuffcmd(fix_client, "cl_cmd settemp cl_movecliptokeyboard 2\n"); + return false; +} + void cts_Initialize() { cts_ScoreRules(); diff --git a/qcsrc/server/mutators/gamemode_domination.qc b/qcsrc/server/mutators/gamemode_domination.qc index 732022019..740d16c62 100644 --- a/qcsrc/server/mutators/gamemode_domination.qc +++ b/qcsrc/server/mutators/gamemode_domination.qc @@ -4,6 +4,19 @@ #include "../teamplay.qh" +int autocvar_g_domination_default_teams; +bool autocvar_g_domination_disable_frags; +int autocvar_g_domination_point_amt; +bool autocvar_g_domination_point_fullbright; +int autocvar_g_domination_point_leadlimit; +bool autocvar_g_domination_roundbased; +int autocvar_g_domination_roundbased_point_limit; +float autocvar_g_domination_round_timelimit; +float autocvar_g_domination_warmup; +#define autocvar_g_domination_point_limit cvar("g_domination_point_limit") +float autocvar_g_domination_point_rate; +int autocvar_g_domination_teams_override; + void dom_EventLog(string mode, float team_before, entity actor) // use an alias for easy changing and quick editing later { if(autocvar_sv_eventlog) diff --git a/qcsrc/server/mutators/gamemode_freezetag.qc b/qcsrc/server/mutators/gamemode_freezetag.qc index bcddf704d..22d515909 100644 --- a/qcsrc/server/mutators/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/gamemode_freezetag.qc @@ -2,6 +2,20 @@ #include "gamemode.qh" +float autocvar_g_freezetag_frozen_maxtime; +bool autocvar_g_freezetag_revive_nade; +float autocvar_g_freezetag_revive_nade_health; +int autocvar_g_freezetag_point_leadlimit; +int autocvar_g_freezetag_point_limit; +float autocvar_g_freezetag_revive_extra_size; +float autocvar_g_freezetag_revive_speed; +float autocvar_g_freezetag_revive_clearspeed; +float autocvar_g_freezetag_round_timelimit; +int autocvar_g_freezetag_teams; +int autocvar_g_freezetag_teams_override; +bool autocvar_g_freezetag_team_spawns; +float autocvar_g_freezetag_warmup; + const float SP_FREEZETAG_REVIVALS = 4; void freezetag_ScoreRules(float teams) { diff --git a/qcsrc/server/mutators/gamemode_invasion.qc b/qcsrc/server/mutators/gamemode_invasion.qc index afad193f5..c6f6a02f6 100644 --- a/qcsrc/server/mutators/gamemode_invasion.qc +++ b/qcsrc/server/mutators/gamemode_invasion.qc @@ -7,6 +7,16 @@ #include "../teamplay.qh" +float autocvar_g_invasion_round_timelimit; +int autocvar_g_invasion_teams; +bool autocvar_g_invasion_team_spawns; +float autocvar_g_invasion_spawnpoint_spawn_delay; +#define autocvar_g_invasion_point_limit cvar("g_invasion_point_limit") +float autocvar_g_invasion_warmup; +int autocvar_g_invasion_monster_count; +bool autocvar_g_invasion_zombies_only; +float autocvar_g_invasion_spawn_delay; + spawnfunc(invasion_spawnpoint) { if(!g_invasion) { remove(self); return; } diff --git a/qcsrc/server/mutators/gamemode_keepaway.qc b/qcsrc/server/mutators/gamemode_keepaway.qc index 991285c92..ca1f241d6 100644 --- a/qcsrc/server/mutators/gamemode_keepaway.qc +++ b/qcsrc/server/mutators/gamemode_keepaway.qc @@ -2,10 +2,25 @@ #include "gamemode.qh" -// =========================================================== -// Keepaway game mode coding, written by Samual and Diabolik -// Last updated: September, 2012 -// =========================================================== +int autocvar_g_keepaway_ballcarrier_effects; +float autocvar_g_keepaway_ballcarrier_damage; +float autocvar_g_keepaway_ballcarrier_force; +float autocvar_g_keepaway_ballcarrier_highspeed; +float autocvar_g_keepaway_ballcarrier_selfdamage; +float autocvar_g_keepaway_ballcarrier_selfforce; +float autocvar_g_keepaway_noncarrier_damage; +float autocvar_g_keepaway_noncarrier_force; +float autocvar_g_keepaway_noncarrier_selfdamage; +float autocvar_g_keepaway_noncarrier_selfforce; +bool autocvar_g_keepaway_noncarrier_warn; +int autocvar_g_keepaway_score_bckill; +int autocvar_g_keepaway_score_killac; +int autocvar_g_keepaway_score_timepoints; +float autocvar_g_keepaway_score_timeinterval; +float autocvar_g_keepawayball_damageforcescale; +int autocvar_g_keepawayball_effects; +float autocvar_g_keepawayball_respawntime; +int autocvar_g_keepawayball_trail_color; float ka_ballcarrier_waypointsprite_visible_for_player(entity e) // runs on waypoints which are attached to ballcarriers, updates once per frame { diff --git a/qcsrc/server/mutators/gamemode_keyhunt.qc b/qcsrc/server/mutators/gamemode_keyhunt.qc index a27ebee02..5ff452408 100644 --- a/qcsrc/server/mutators/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/gamemode_keyhunt.qc @@ -2,6 +2,11 @@ #include "gamemode.qh" +int autocvar_g_keyhunt_point_leadlimit; +bool autocvar_g_keyhunt_team_spawns; +#define autocvar_g_keyhunt_point_limit cvar("g_keyhunt_point_limit") +int autocvar_g_keyhunt_teams; +int autocvar_g_keyhunt_teams_override; // #define KH_PLAYER_USE_ATTACHMENT // #define KH_PLAYER_USE_CARRIEDMODEL diff --git a/qcsrc/server/mutators/gamemode_lms.qc b/qcsrc/server/mutators/gamemode_lms.qc index 84105f012..9660fcee7 100644 --- a/qcsrc/server/mutators/gamemode_lms.qc +++ b/qcsrc/server/mutators/gamemode_lms.qc @@ -5,6 +5,12 @@ #include "../campaign.qh" #include "../command/cmd.qh" +int autocvar_g_lms_extra_lives; +bool autocvar_g_lms_join_anytime; +int autocvar_g_lms_last_join; +#define autocvar_g_lms_lives_override cvar("g_lms_lives_override") +bool autocvar_g_lms_regenerate; + // main functions float LMS_NewPlayerLives() { diff --git a/qcsrc/server/mutators/gamemode_onslaught.qc b/qcsrc/server/mutators/gamemode_onslaught.qc index eb0a2e990..869cd90d2 100644 --- a/qcsrc/server/mutators/gamemode_onslaught.qc +++ b/qcsrc/server/mutators/gamemode_onslaught.qc @@ -1,8 +1,32 @@ - #include "gamemode.qh" #include "../controlpoint.qh" #include "../generator.qh" +float autocvar_g_onslaught_debug; +float autocvar_g_onslaught_teleport_wait; +bool autocvar_g_onslaught_spawn_at_controlpoints; +bool autocvar_g_onslaught_spawn_at_generator; +float autocvar_g_onslaught_cp_proxydecap; +float autocvar_g_onslaught_cp_proxydecap_distance = 512; +float autocvar_g_onslaught_cp_proxydecap_dps = 100; +float autocvar_g_onslaught_spawn_at_controlpoints_chance = 0.5; +float autocvar_g_onslaught_spawn_at_controlpoints_random; +float autocvar_g_onslaught_spawn_at_generator_chance; +float autocvar_g_onslaught_spawn_at_generator_random; +float autocvar_g_onslaught_cp_buildhealth; +float autocvar_g_onslaught_cp_buildtime; +float autocvar_g_onslaught_cp_health; +float autocvar_g_onslaught_cp_regen; +float autocvar_g_onslaught_gen_health; +float autocvar_g_onslaught_shield_force = 100; +float autocvar_g_onslaught_allow_vehicle_touch; +float autocvar_g_onslaught_round_timelimit; +float autocvar_g_onslaught_point_limit; +float autocvar_g_onslaught_warmup; +float autocvar_g_onslaught_teleport_radius; +float autocvar_g_onslaught_spawn_choose; +float autocvar_g_onslaught_click_radius; + void FixSize(entity e); // ======================= diff --git a/qcsrc/server/mutators/gamemode_race.qc b/qcsrc/server/mutators/gamemode_race.qc index 34196b38e..d5e85c069 100644 --- a/qcsrc/server/mutators/gamemode_race.qc +++ b/qcsrc/server/mutators/gamemode_race.qc @@ -4,6 +4,11 @@ #include "../race.qh" +#define autocvar_g_race_laps_limit cvar("g_race_laps_limit") +float autocvar_g_race_qualifying_timelimit; +float autocvar_g_race_qualifying_timelimit_override; +int autocvar_g_race_teams; + // legacy bot roles .float race_checkpoint; void havocbot_role_race() @@ -300,6 +305,12 @@ MUTATOR_HOOKFUNCTION(rc, GetRecords) return false; } +MUTATOR_HOOKFUNCTION(rc, FixClientCvars) +{ + stuffcmd(fix_client, "cl_cmd settemp cl_movecliptokeyboard 2\n"); + return false; +} + void race_Initialize() { race_ScoreRules(); diff --git a/qcsrc/server/mutators/gamemode_tdm.qc b/qcsrc/server/mutators/gamemode_tdm.qc index acb875c55..20270b5a2 100644 --- a/qcsrc/server/mutators/gamemode_tdm.qc +++ b/qcsrc/server/mutators/gamemode_tdm.qc @@ -1,6 +1,11 @@ - #include "gamemode.qh" +bool autocvar_g_tdm_team_spawns; +int autocvar_g_tdm_point_limit; +int autocvar_g_tdm_point_leadlimit; +int autocvar_g_tdm_teams; +int autocvar_g_tdm_teams_override; + /*QUAKED spawnfunc_tdm_team (0 .5 .8) (-16 -16 -24) (16 16 32) Team declaration for TDM gameplay, this allows you to decide what team names and control point models are used in your map. Note: If you use spawnfunc_tdm_team entities you must define at least 2! However, unlike domination, you don't need to make a blank one too. diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 94f3100a4..4f8298238 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -416,10 +416,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid) if(cp == race_timed_checkpoint) { race_setTime(GetMapname(), t, e.crypto_idfp, e.netname, e); - if(g_cts && autocvar_g_cts_finish_kill_delay) - { - CTS_ClientKill(e); - } + MUTATOR_CALLHOOK(Race_FinalCheckpoint, e); } if(t < recordtime || recordtime == 0) { @@ -1145,6 +1142,9 @@ void penalty_use() spawnfunc(trigger_race_penalty) { + // TODO: find out why this wasnt done: + //if(!g_cts && !g_race) { remove(self); return; } + EXACTTRIGGER_INIT; self.use = penalty_use; -- 2.39.2