From: Mario Date: Fri, 3 Feb 2017 17:10:02 +0000 (+1000) Subject: Add a way to set the score given for a flag per entity (supports assists, caps, dropp... X-Git-Tag: xonotic-v0.8.2~250 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5be8b9ff8880d9a6cc38487139e5bf59aa594036;p=xonotic%2Fxonotic-data.pk3dir.git Add a way to set the score given for a flag per entity (supports assists, caps, dropping, picking up and returning of flags) --- diff --git a/gamemodes.cfg b/gamemodes.cfg index e46c30718..13a04fb42 100644 --- a/gamemodes.cfg +++ b/gamemodes.cfg @@ -309,6 +309,7 @@ set g_ctf_pass_velocity 750 "how fast or far a player can pass the flag" set g_ctf_allow_vehicle_touch 0 "allow flags to be picked up/captured/returned without even leaving the vehicle" set g_ctf_allow_vehicle_carry 1 "allow players to hold flags inside a vehicle" set g_ctf_allow_monster_touch 0 "allow flags to be returned by monsters" +set g_ctf_score_ignore_fields 0 "force regular score settings to override per entity specified scores" set g_ctf_shield_max_ratio 0 "shield at most this percentage of a team from the enemy flag (try: 0.4 for 40%)" set g_ctf_shield_min_negscore 20 "shield the player from the flag if he's got this negative amount of points or less" diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index badab5104..534b41618 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -91,6 +91,7 @@ float autocvar_g_ctf_flagcarrier_forcefactor; //float autocvar_g_ctf_flagcarrier_waypointforenemy_spotting; bool autocvar_g_ctf_fullbrightflags; bool autocvar_g_ctf_ignore_frags; +bool autocvar_g_ctf_score_ignore_fields; int autocvar_g_ctf_score_capture; int autocvar_g_ctf_score_capture_assist; int autocvar_g_ctf_score_kill; @@ -385,7 +386,7 @@ void ctf_Handle_Drop(entity flag, entity player, int droptype) ctf_EventLog("dropped", player.team, player); // scoring - PlayerTeamScore_AddScore(player, -autocvar_g_ctf_score_penalty_drop); + PlayerTeamScore_AddScore(player, -((flag.score_drop) ? flag.score_drop : autocvar_g_ctf_score_penalty_drop)); PlayerScore_Add(player, SP_CTF_DROPS, 1); // waypoints @@ -595,7 +596,7 @@ void ctf_Handle_Capture(entity flag, entity toucher, int capturetype) } // scoring - PlayerTeamScore_AddScore(player, autocvar_g_ctf_score_capture); + PlayerTeamScore_AddScore(player, ((flag.score_capture) ? flag.score_capture : autocvar_g_ctf_score_capture)); PlayerTeamScore_Add(player, SP_CTF_CAPS, ST_CTF_CAPS, 1); old_time = PlayerScore_Add(player, SP_CTF_CAPTIME, 0); @@ -614,7 +615,7 @@ void ctf_Handle_Capture(entity flag, entity toucher, int capturetype) if(flag.speedrunning) { ctf_FakeTimeLimit(player, -1); } if((enemy_flag.ctf_dropper) && (player != enemy_flag.ctf_dropper)) - { PlayerTeamScore_AddScore(enemy_flag.ctf_dropper, autocvar_g_ctf_score_capture_assist); } + { PlayerTeamScore_AddScore(enemy_flag.ctf_dropper, ((flag.score_assist) ? flag.score_assist : autocvar_g_ctf_score_capture_assist)); } } // reset the flag @@ -640,7 +641,7 @@ void ctf_Handle_Return(entity flag, entity player) // scoring if(IS_PLAYER(player)) { - PlayerTeamScore_AddScore(player, autocvar_g_ctf_score_return); // reward for return + PlayerTeamScore_AddScore(player, ((flag.score_return) ? flag.score_return : autocvar_g_ctf_score_return)); // reward for return PlayerScore_Add(player, SP_CTF_RETURNS, 1); // add to count of returns nades_GiveBonus(player,autocvar_g_nades_bonus_score_medium); @@ -731,7 +732,7 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype) { case PICKUP_BASE: { - PlayerTeamScore_AddScore(player, autocvar_g_ctf_score_pickup_base); + PlayerTeamScore_AddScore(player, ((flag.score_pickup) ? flag.score_pickup : autocvar_g_ctf_score_pickup_base)); ctf_EventLog("steal", flag.team, player); break; } @@ -1272,6 +1273,10 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e flag.nextthink = time + FLAG_THINKRATE; flag.ctf_status = FLAG_BASE; + // crudely force them all to 0 + if(autocvar_g_ctf_score_ignore_fields) + flag.score_assist = flag.score_capture = flag.score_drop = flag.score_pickup = flag.score_return = 0; + string teamname = Static_Team_ColorName_Lower(teamnumber); // appearence if(!flag.scale) { flag.scale = FLAG_SCALE; } diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qh b/qcsrc/server/mutators/mutator/gamemode_ctf.qh index 593b0bec3..098a0addd 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qh +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qh @@ -48,6 +48,13 @@ const float VEHICLE_FLAG_SCALE = 1.0; .string snd_flag_touch; .string snd_flag_pass; +// score fields +.float score_assist; +.float score_capture; +.float score_drop; // note: negated +.float score_pickup; +.float score_return; + // effects .string toucheffect; .string passeffect;