]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/domination.qc
Merge remote branch 'origin/samual/balancesamual'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / domination.qc
index d87d8419b25b5302d127ecd49780191e1601d3d0..891863f97a3a32daa771675391405563ad4675ca 100644 (file)
@@ -26,7 +26,7 @@ void() dom_controlpoint_setup;
 void LogDom(string mode, float team_before, entity actor)
 {
        string s;
-       if(!cvar("sv_eventlog"))
+       if(!autocvar_sv_eventlog)
                return;
        s = strcat(":dom:", mode);
        s = strcat(s, ":", ftos(team_before));
@@ -63,7 +63,22 @@ void dompoint_captured ()
        //bprint(self.message);
        //bprint("\n");
 
-       bprint("^3", head.netname, "^3", self.message, "\n");
+       float points, wait_time;
+       if (autocvar_g_domination_point_amt)
+               points = autocvar_g_domination_point_amt;
+       else
+               points = self.frags;
+       if (autocvar_g_domination_point_rate)
+               wait_time = autocvar_g_domination_point_rate;
+       else
+               wait_time = self.wait;
+
+       bprint("^3", head.netname, "^3", self.message);
+       if (points != 1)
+               bprint(" ^7(", ftos(points), " points every ", ftos(wait_time), " seconds)\n");
+       else
+               bprint(" ^7(", ftos(points), " point every ", ftos(wait_time), " seconds)\n");
+
        if(self.enemy.playerid == self.enemy_playerid)
                PlayerScore_Add(self.enemy, SP_DOM_TAKES, 1);
        else
@@ -77,13 +92,10 @@ void dompoint_captured ()
        if (head.noise1 != "")
                play2all(head.noise1);
 
-       //self.nextthink = time + cvar("g_domination_point_rate");
+       //self.nextthink = time + autocvar_g_domination_point_rate;
        //self.think = dompointthink;
 
-       if(cvar("g_domination_point_rate"))
-               self.delay = time + cvar("g_domination_point_rate");
-       else
-               self.delay = time + self.wait;
+       self.delay = time + wait_time;
 
        // do trigger work
        old_delay = self.delay;
@@ -131,7 +143,6 @@ void AnimateDomPoint()
 
 void dompointthink()
 {
-       local float waittime;
        local float fragamt;
 
        self.nextthink = time + 0.1;
@@ -146,17 +157,18 @@ void dompointthink()
        if (gameover || self.delay > time || time < game_starttime)     // game has ended, don't keep giving points
                return;
 
-       waittime = cvar("g_domination_point_rate");
-       if(!waittime)
-               waittime = self.wait;
-       self.delay = time + waittime;
+       if(autocvar_g_domination_point_rate)
+               self.delay = time + autocvar_g_domination_point_rate;
+       else
+               self.delay = time + self.wait;
 
        // give credit to the team
        // NOTE: this defaults to 0
        if (self.goalentity.netname != "")
        {
-               fragamt = cvar("g_domination_point_amt");
-               if(!fragamt)
+               if(autocvar_g_domination_point_amt)
+                       fragamt = autocvar_g_domination_point_amt;
+               else
                        fragamt = self.DOMPOINTFRAGS;
                TeamScore_AddToTeam(self.goalentity.team, ST_SCORE, fragamt);
                TeamScore_AddToTeam(self.goalentity.team, ST_DOM_TICKS, fragamt);
@@ -252,7 +264,7 @@ Keys:
 
 void spawnfunc_dom_team()
 {
-       if(!g_domination || cvar("g_domination_teams_override") >= 2)
+       if(!g_domination || autocvar_g_domination_teams_override >= 2)
        {
                remove(self);
                return;
@@ -327,8 +339,8 @@ void dom_controlpoint_setup()
        float c1, c2, c3, c4, totalteams, smallestteam, smallestteam_count, selectedteam;
        float balance_teams, force_balance, balance_type;
 
-       balance_teams = cvar("g_balance_teams");
-       balance_teams = cvar("g_balance_teams_force");
+       balance_teams = autocvar_g_balance_teams;
+       balance_teams = autocvar_g_balance_teams_force;
 
        c1 = c2 = c3 = c4 = -1;
        totalteams = 0;
@@ -529,7 +541,7 @@ void spawnfunc_dom_controlpoint()
        //if(!self.glow_size)
        //      self.glow_size = cvar("g_domination_point_glow");
        self.effects = self.effects | EF_LOWPRECISION;
-       if (cvar("g_domination_point_fullbright"))
+       if (autocvar_g_domination_point_fullbright)
                self.effects |= EF_FULLBRIGHT;
 };
 
@@ -578,10 +590,10 @@ void dom_spawnpoint(vector org)
 void dom_spawnteams()
 {
        float numteams;
-       if(cvar("g_domination_teams_override") < 2)
-               numteams = cvar("g_domination_default_teams");
+       if(autocvar_g_domination_teams_override < 2)
+               numteams = autocvar_g_domination_default_teams;
        else
-               numteams = cvar("g_domination_teams_override");
+               numteams = autocvar_g_domination_teams_override;
        // LordHavoc: edit this if you want to change defaults
        dom_spawnteam("Red", COLOR_TEAM1-1, "models/domination/dom_red.md3", 0, "domination/claim.wav", "", "Red team has captured a control point");
        dom_spawnteam("Blue", COLOR_TEAM2-1, "models/domination/dom_blue.md3", 0, "domination/claim.wav", "", "Blue team has captured a control point");
@@ -597,7 +609,7 @@ void dom_delayedinit()
        local entity head;
 
        // if no teams are found, spawn defaults, if custom teams are set, use them
-       if (find(world, classname, "dom_team") == world || cvar("g_domination_teams_override") >= 2)
+       if (find(world, classname, "dom_team") == world || autocvar_g_domination_teams_override >= 2)
                dom_spawnteams();
        // if no control points are found, spawn defaults
        if (find(world, classname, "dom_controlpoint") == world)
@@ -636,9 +648,5 @@ void dom_init()
        precache_model("models/domination/dom_unclaimed.md3");
        precache_sound("domination/claim.wav");
        InitializeEntity(world, dom_delayedinit, INITPRIO_GAMETYPE);
-
-       // teamplay is always on in domination, defaults to hurt self but not teammates
-       //if(!teams_matter)
-       //      cvar_set("teamplay", "3");
 };