]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/gamemode_assault.qc
Make most server includes order insensitive
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / gamemode_assault.qc
index fa12b8bdb3dd0624564faf2a9ecf5948e6fba55c..d14d9da8c7c5fe2bd42854510b8c1fb8c00a3f86 100644 (file)
@@ -1,3 +1,10 @@
+#include "gamemode_assault.qh"
+#include "../_.qh"
+
+#include "gamemode.qh"
+
+.entity sprite;
+
 // random functions
 void assault_objective_use()
 {
@@ -106,9 +113,9 @@ float assault_decreaser_sprite_visible(entity e)
        decreaser = self.assault_decreaser;
 
        if(decreaser.enemy.health >= ASSAULT_VALUE_INACTIVE)
-               return FALSE;
+               return false;
 
-       return TRUE;
+       return true;
 }
 
 void target_objective_decrease_activate()
@@ -205,31 +212,8 @@ void assault_wall_think()
 
 // trigger new round
 // reset objectives, toggle spawnpoints, reset triggers, ...
-void vehicles_clearrturn();
-void vehicles_spawn();
 void assault_new_round()
 {
-    entity oldself;
-       //bprint("ASSAULT: new round\n");
-
-       oldself = self;
-       // Eject players from vehicles
-    FOR_EACH_PLAYER(self)
-    {
-        if(self.vehicle)
-            vehicles_exit(VHEF_RELESE);
-    }
-
-    self = findchainflags(vehicle_flags, VHF_ISVEHICLE);
-    while(self)
-    {
-        vehicles_clearrturn();
-        vehicles_spawn();
-        self = self.chain;
-    }
-
-    self = oldself;
-
        // up round counter
        self.winning = self.winning + 1;
 
@@ -259,24 +243,24 @@ void assault_new_round()
 // spawnfuncs
 void spawnfunc_info_player_attacker()
 {
-       if not(g_assault) { remove(self); return; }
-       
+       if (!g_assault) { remove(self); return; }
+
        self.team = NUM_TEAM_1; // red, gets swapped every round
        spawnfunc_info_player_deathmatch();
 }
 
 void spawnfunc_info_player_defender()
 {
-       if not(g_assault) { remove(self); return; }
-       
+       if (!g_assault) { remove(self); return; }
+
        self.team = NUM_TEAM_2; // blue, gets swapped every round
        spawnfunc_info_player_deathmatch();
 }
 
 void spawnfunc_target_objective()
 {
-       if not(g_assault) { remove(self); return; }
-       
+       if (!g_assault) { remove(self); return; }
+
        self.classname = "target_objective";
        self.use = assault_objective_use;
        assault_objective_reset();
@@ -286,7 +270,7 @@ void spawnfunc_target_objective()
 
 void spawnfunc_target_objective_decrease()
 {
-       if not(g_assault) { remove(self); return; }
+       if (!g_assault) { remove(self); return; }
 
        self.classname = "target_objective_decrease";
 
@@ -304,11 +288,11 @@ void spawnfunc_target_objective_decrease()
 // destructible walls that can be used to trigger target_objective_decrease
 void spawnfunc_func_assault_destructible()
 {
-       if not(g_assault) { remove(self); return; }
-       
+       if (!g_assault) { remove(self); return; }
+
        self.spawnflags = 3;
        self.classname = "func_assault_destructible";
-       
+
        if(assault_attacker_team == NUM_TEAM_1)
                self.team = NUM_TEAM_2;
        else
@@ -319,8 +303,8 @@ void spawnfunc_func_assault_destructible()
 
 void spawnfunc_func_assault_wall()
 {
-       if not(g_assault) { remove(self); return; }
-       
+       if (!g_assault) { remove(self); return; }
+
        self.classname = "func_assault_wall";
        self.mdl = self.model;
        setmodel(self, self.mdl);
@@ -332,7 +316,7 @@ void spawnfunc_func_assault_wall()
 
 void spawnfunc_target_assault_roundend()
 {
-       if not(g_assault) { remove(self); return; }
+       if (!g_assault) { remove(self); return; }
 
        self.winning = 0; // round not yet won by attackers
        self.classname = "target_assault_roundend";
@@ -343,8 +327,8 @@ void spawnfunc_target_assault_roundend()
 
 void spawnfunc_target_assault_roundstart()
 {
-       if not(g_assault) { remove(self); return; }
-       
+       if (!g_assault) { remove(self); return; }
+
        assault_attacker_team = NUM_TEAM_1;
        self.classname = "target_assault_roundstart";
        self.use = assault_roundstart_use;
@@ -366,10 +350,10 @@ void havocbot_goalrating_ast_targets(float ratingscale)
                if (ad.target == "")
                        continue;
 
-               if not(ad.bot_attack)
+               if (!ad.bot_attack)
                        continue;
 
-               found = FALSE;
+               found = false;
                for(tod = world; (tod = find(tod, targetname, ad.target)); )
                {
                        if(tod.classname == "target_objective_decrease")
@@ -377,7 +361,7 @@ void havocbot_goalrating_ast_targets(float ratingscale)
                                if(tod.enemy.health > 0 && tod.enemy.health < ASSAULT_VALUE_INACTIVE)
                                {
                                //      dprint(etos(ad),"\n");
-                                       found = TRUE;
+                                       found = true;
                                        break;
                                }
                        }
@@ -397,7 +381,7 @@ void havocbot_goalrating_ast_targets(float ratingscale)
        //      te_lightning2(world, '0 0 0', p);
 
                // Find and rate waypoints around it
-               found = FALSE;
+               found = false;
                best = world;
                bestvalue = 99999999999;
                for(radius=0; radius<1500 && !found; radius+=500)
@@ -408,7 +392,7 @@ void havocbot_goalrating_ast_targets(float ratingscale)
                                if(wp.classname=="waypoint")
                                if(checkpvs(wp.origin, ad))
                                {
-                                       found = TRUE;
+                                       found = true;
                                        if(wp.cnt<bestvalue)
                                        {
                                                best = wp;
@@ -542,35 +526,35 @@ MUTATOR_HOOKFUNCTION(assault_PlayerSpawn)
                Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_ASSAULT_ATTACKING);
        else
                Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_ASSAULT_DEFENDING);
-               
-       return FALSE;
+
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(assault_TurretSpawn)
 {
-       if not (self.team)
+       if (!self.team)
                self.team = 14;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(assault_VehicleSpawn)
 {
        self.nextthink = time + 0.5;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(assault_BotRoles)
 {
        havocbot_ast_reset_role(self);
-       return TRUE;
+       return true;
 }
 
 // scoreboard setup
 void assault_ScoreRules()
 {
-       ScoreRules_basics(2, SFL_SORT_PRIO_SECONDARY, SFL_SORT_PRIO_SECONDARY, TRUE);
+       ScoreRules_basics(2, SFL_SORT_PRIO_SECONDARY, SFL_SORT_PRIO_SECONDARY, true);
        ScoreInfo_SetLabel_TeamScore(  ST_ASSAULT_OBJECTIVES,    "objectives",      SFL_SORT_PRIO_PRIMARY);
        ScoreInfo_SetLabel_PlayerScore(SP_ASSAULT_OBJECTIVES,    "objectives",      SFL_SORT_PRIO_PRIMARY);
        ScoreRules_basics_end();
@@ -581,8 +565,8 @@ MUTATOR_DEFINITION(gamemode_assault)
        MUTATOR_HOOK(PlayerSpawn, assault_PlayerSpawn, CBC_ORDER_ANY);
        MUTATOR_HOOK(TurretSpawn, assault_TurretSpawn, CBC_ORDER_ANY);
        MUTATOR_HOOK(VehicleSpawn, assault_VehicleSpawn, CBC_ORDER_ANY);
-       MUTATOR_HOOK(HavocBot_ChooseRule, assault_BotRoles, CBC_ORDER_ANY);
-       
+       MUTATOR_HOOK(HavocBot_ChooseRole, assault_BotRoles, CBC_ORDER_ANY);
+
        MUTATOR_ONADD
        {
                if(time > 1) // game loads at time 1