]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/mutator/gamemode_keepaway.qc
Register score fields
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator / gamemode_keepaway.qc
index 4654795608ff7566a9461b12cc8c5ce7880b2d84..5f5f278b62223773bac531e50d48f8fba3a9ea93 100644 (file)
@@ -32,10 +32,6 @@ REGISTER_MUTATOR(ka, false)
 
 entity ka_ball;
 
-const float SP_KEEPAWAY_PICKUPS = 4;
-const float SP_KEEPAWAY_CARRIERKILLS = 5;
-const float SP_KEEPAWAY_BCTIME = 6;
-
 void(entity this) havocbot_role_ka_carrier;
 void(entity this) havocbot_role_ka_collector;
 
@@ -82,8 +78,8 @@ void ka_EventLog(string mode, entity actor) // use an alias for easy changing an
 }
 
 void ka_TouchEvent();
-void ka_RespawnBall() // runs whenever the ball needs to be relocated
-{SELFPARAM();
+void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated
+{
        if(gameover) { return; }
        vector oldballorigin = self.origin;
 
@@ -100,7 +96,7 @@ void ka_RespawnBall() // runs whenever the ball needs to be relocated
        self.angles = '0 0 0';
        self.effects = autocvar_g_keepawayball_effects;
        self.touch = ka_TouchEvent;
-       self.think = ka_RespawnBall;
+       setthink(self, ka_RespawnBall);
        self.nextthink = time + autocvar_g_keepawayball_respawntime;
 
        Send_Effect(EFFECT_ELECTRO_COMBO, oldballorigin, '0 0 0', 1);
@@ -130,7 +126,7 @@ void ka_TouchEvent() // runs any time that the ball comes in contact with someth
        if(!self) { return; }
        if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
        { // The ball fell off the map, respawn it since players can't get to it
-               ka_RespawnBall();
+               ka_RespawnBall(self);
                return;
        }
        if(IS_DEAD(other)) { return; }
@@ -193,7 +189,7 @@ void ka_DropEvent(entity plyr) // runs any time that a player is supposed to los
        ball.movetype = MOVETYPE_BOUNCE;
        ball.wait = time + 1;
        ball.touch = ka_TouchEvent;
-       ball.think = ka_RespawnBall;
+       setthink(ball, ka_RespawnBall);
        ball.nextthink = time + autocvar_g_keepawayball_respawntime;
        ball.takedamage = DAMAGE_YES;
        ball.effects &= ~EF_NODRAW;
@@ -230,12 +226,12 @@ void ka_Reset(entity this)
 
        if(time < game_starttime)
        {
-               this.think = ka_RespawnBall;
+               setthink(this, ka_RespawnBall);
                this.touch = func_null;
                this.nextthink = game_starttime;
        }
        else
-               ka_RespawnBall();
+               ka_RespawnBall(this);
 }
 
 
@@ -487,9 +483,9 @@ void ka_SpawnBall() // loads various values for the ball, runs only once at star
 void ka_ScoreRules()
 {
        ScoreRules_basics(0, SFL_SORT_PRIO_PRIMARY, 0, true); // SFL_SORT_PRIO_PRIMARY
-       ScoreInfo_SetLabel_PlayerScore(SP_KEEPAWAY_PICKUPS,                     "pickups",              0);
-       ScoreInfo_SetLabel_PlayerScore(SP_KEEPAWAY_CARRIERKILLS,        "bckills",              0);
-       ScoreInfo_SetLabel_PlayerScore(SP_KEEPAWAY_BCTIME,                      "bctime",               SFL_SORT_PRIO_SECONDARY);
+       ScoreInfo_SetLabel_PlayerScore(SP_KEEPAWAY_PICKUPS,             "pickups",              0);
+       ScoreInfo_SetLabel_PlayerScore(SP_KEEPAWAY_CARRIERKILLS,   "bckills",           0);
+       ScoreInfo_SetLabel_PlayerScore(SP_KEEPAWAY_BCTIME,                  "bctime",           SFL_SORT_PRIO_SECONDARY);
        ScoreRules_basics_end();
 }