]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/gamemode_onslaught.qc
Merge branch 'master' into terencehill/bot_fixes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / gamemode_onslaught.qc
index e47999e7407647d0c800d715e4175d6f52fbc6fe..fb6e0c10eecd7fe2557c70760f38201d31991cf7 100644 (file)
@@ -1,15 +1,31 @@
+#include "../_all.qh"
+
+#include "gamemode.qh"
+#include "../controlpoint.qh"
+#include "../generator.qh"
+
+vector randompos(vector m1, vector m2)
+{
+       vector v;
+       m2 = m2 - m1;
+       v_x = m2_x * random() + m1_x;
+       v_y = m2_y * random() + m1_y;
+       v_z = m2_z * random() + m1_z;
+       return  v;
+}
+
 // =======================
 // CaptureShield Functions
 // =======================
 
-float ons_CaptureShield_Customize()
+bool ons_CaptureShield_Customize()
 {
        entity e = WaypointSprite_getviewentity(other);
 
-       if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, e.team) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return FALSE; }
-       if(SAME_TEAM(self, e)) { return FALSE; }
+       if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, e.team) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return false; }
+       if(SAME_TEAM(self, e)) { return false; }
 
-       return TRUE;
+       return true;
 }
 
 void ons_CaptureShield_Touch()
@@ -40,7 +56,7 @@ void ons_CaptureShield_Reset()
        self.team = self.enemy.team;
 }
 
-void ons_CaptureShield_Spawn(entity generator, float is_generator)
+void ons_CaptureShield_Spawn(entity generator, bool is_generator)
 {
        entity shield = spawn();
 
@@ -57,7 +73,7 @@ void ons_CaptureShield_Spawn(entity generator, float is_generator)
        shield.avelocity = '7 0 11';
        shield.scale = 1;
        shield.model = ((is_generator) ? "models/onslaught/generator_shield.md3" : "models/onslaught/controlpoint_shield.md3");
-       
+
        precache_model(shield.model);
        setorigin(shield, generator.origin);
        setmodel(shield, shield.model);
@@ -78,27 +94,6 @@ void ons_debug(string input)
        }
 }
 
-void FixSize(entity e)
-{
-       e.mins_x = rint(e.mins_x);
-       e.mins_y = rint(e.mins_y);
-       e.mins_z = rint(e.mins_z);
-       
-       e.maxs_x = rint(e.maxs_x);
-       e.maxs_y = rint(e.maxs_y);
-       e.maxs_z = rint(e.maxs_z);
-}
-
-vector randompos(vector m1, vector m2)
-{
-       vector v;
-       m2 = m2 - m1;
-       v_x = m2_x * random() + m1_x;
-       v_y = m2_y * random() + m1_y;
-       v_z = m2_z * random() + m1_z;
-       return  v;
-}
-
 void setmodel_fixsize(entity e, string m)
 {
        setmodel(e, m);
@@ -124,18 +119,18 @@ void onslaught_updatelinks()
        // mark points as shielded and not networked
        for(l = ons_worldcplist; l; l = l.ons_worldcpnext)
        {
-               l.islinked = FALSE;
-               l.isshielded = TRUE;
-               float i;
-               for(i = 0; i < 17; ++i) { l.isgenneighbor[i] = FALSE; l.iscpneighbor[i] = FALSE; }
+               l.islinked = false;
+               l.isshielded = true;
+               int i;
+               for(i = 0; i < 17; ++i) { l.isgenneighbor[i] = false; l.iscpneighbor[i] = false; }
                ons_debug(strcat(etos(l), " (point) belongs to team ", ftos(l.team), "\n"));
                l.sprite.SendFlags |= 16;
        }
        // flow power outward from the generators through the network
-       float stop = FALSE;
+       bool stop = false;
        while (!stop)
        {
-               stop = TRUE;
+               stop = true;
                for(l = ons_worldlinklist; l; l = l.ons_worldlinknext)
                {
                        // if both points are captured by the same team, and only one of
@@ -146,14 +141,14 @@ void onslaught_updatelinks()
                                        {
                                                if (!l.goalentity.islinked)
                                                {
-                                                       stop = FALSE;
-                                                       l.goalentity.islinked = TRUE;
+                                                       stop = false;
+                                                       l.goalentity.islinked = true;
                                                        ons_debug(strcat(etos(l), " (link) is marking ", etos(l.goalentity), " (point) because its team matches ", etos(l.enemy), " (point)\n"));
                                                }
                                                else if (!l.enemy.islinked)
                                                {
-                                                       stop = FALSE;
-                                                       l.enemy.islinked = TRUE;
+                                                       stop = false;
+                                                       l.enemy.islinked = true;
                                                        ons_debug(strcat(etos(l), " (link) is marking ", etos(l.enemy), " (point) because its team matches ", etos(l.goalentity), " (point)\n"));
                                                }
                                        }
@@ -168,24 +163,24 @@ void onslaught_updatelinks()
                        if(DIFF_TEAM(l.goalentity, l.enemy))
                        {
                                ons_debug(strcat(etos(l), " (link) is unshielding ", etos(l.enemy), " (point) because its team does not match ", etos(l.goalentity), " (point)\n"));
-                               l.enemy.isshielded = FALSE;
+                               l.enemy.isshielded = false;
                        }
                        if(l.goalentity.classname == "onslaught_generator")
-                               l.enemy.isgenneighbor[l.goalentity.team] = TRUE;
+                               l.enemy.isgenneighbor[l.goalentity.team] = true;
                        else
-                               l.enemy.iscpneighbor[l.goalentity.team] = TRUE;
+                               l.enemy.iscpneighbor[l.goalentity.team] = true;
                }
                if (l.enemy.islinked)
                {
                        if(DIFF_TEAM(l.goalentity, l.enemy))
                        {
                                ons_debug(strcat(etos(l), " (link) is unshielding ", etos(l.goalentity), " (point) because its team does not match ", etos(l.enemy), " (point)\n"));
-                               l.goalentity.isshielded = FALSE;
+                               l.goalentity.isshielded = false;
                        }
                        if(l.enemy.classname == "onslaught_generator")
-                               l.goalentity.isgenneighbor[l.enemy.team] = TRUE;
+                               l.goalentity.isgenneighbor[l.enemy.team] = true;
                        else
-                               l.goalentity.iscpneighbor[l.enemy.team] = TRUE;
+                               l.goalentity.iscpneighbor[l.enemy.team] = true;
                }
        }
        // now update the generators
@@ -195,13 +190,13 @@ void onslaught_updatelinks()
                {
                        ons_debug(strcat(etos(l), " (generator) is shielded\n"));
                        l.takedamage = DAMAGE_NO;
-                       l.bot_attack = FALSE;
+                       l.bot_attack = false;
                }
                else
                {
                        ons_debug(strcat(etos(l), " (generator) is not shielded\n"));
                        l.takedamage = DAMAGE_AIM;
-                       l.bot_attack = TRUE;
+                       l.bot_attack = true;
                }
 
                ons_Generator_UpdateSprite(l);
@@ -215,7 +210,7 @@ void onslaught_updatelinks()
                        if (l.goalentity)
                        {
                                l.goalentity.takedamage = DAMAGE_NO;
-                               l.goalentity.bot_attack = FALSE;
+                               l.goalentity.bot_attack = false;
                        }
                }
                else
@@ -224,7 +219,7 @@ void onslaught_updatelinks()
                        if (l.goalentity)
                        {
                                l.goalentity.takedamage = DAMAGE_AIM;
-                               l.goalentity.bot_attack = TRUE;
+                               l.goalentity.bot_attack = true;
                        }
                }
                ons_ControlPoint_UpdateSprite(l);
@@ -243,7 +238,7 @@ void onslaught_updatelinks()
 // Main Link Functions
 // ===================
 
-float ons_Link_Send(entity to, float sendflags)
+bool ons_Link_Send(entity to, int sendflags)
 {
        WriteByte(MSG_ENTITY, ENT_CLIENT_RADARLINK);
        WriteByte(MSG_ENTITY, sendflags);
@@ -263,17 +258,17 @@ float ons_Link_Send(entity to, float sendflags)
        {
                WriteByte(MSG_ENTITY, self.clientcolors); // which is goalentity's color + enemy's color * 16
        }
-       return TRUE;
+       return true;
 }
 
 void ons_Link_CheckUpdate()
 {
        // TODO check if the two sides have moved (currently they won't move anyway)
        float cc = 0, cc1 = 0, cc2 = 0;
-       
+
        if(self.goalentity.islinked || self.goalentity.iscaptured) { cc1 = (self.goalentity.team - 1) * 0x01; }
        if(self.enemy.islinked || self.enemy.iscaptured) { cc2 = (self.enemy.team - 1) * 0x10; }
-       
+
        cc = cc1 + cc2;
 
        if(cc != self.clientcolors)
@@ -303,7 +298,7 @@ void ons_DelayedLinkSetup()
 // Main Control Point Functions
 // =============================
 
-float ons_ControlPoint_CanBeLinked(entity cp, float teamnumber)
+int ons_ControlPoint_CanBeLinked(entity cp, int teamnumber)
 {
        if(cp.isgenneighbor[teamnumber]) { return 2; }
        if(cp.iscpneighbor[teamnumber]) { return 1; }
@@ -311,7 +306,7 @@ float ons_ControlPoint_CanBeLinked(entity cp, float teamnumber)
        return 0;
 }
 
-float ons_ControlPoint_Attackable(entity cp, float teamnumber)
+int ons_ControlPoint_Attackable(entity cp, int teamnumber)
        // -2: SAME TEAM, attackable by enemy!
        // -1: SAME TEAM!
        // 0: off limits
@@ -320,7 +315,7 @@ float ons_ControlPoint_Attackable(entity cp, float teamnumber)
        // 3: attack it (HIGH PRIO)
        // 4: touch it (HIGH PRIO)
 {
-       float a;
+       int a;
 
        if(cp.isshielded)
        {
@@ -358,10 +353,10 @@ float ons_ControlPoint_Attackable(entity cp, float teamnumber)
        return 0;
 }
 
-void ons_ControlPoint_Icon_Damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+void ons_ControlPoint_Icon_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
        entity oself;
-       
+
        if(damage <= 0) { return; }
 
        if (self.owner.isshielded)
@@ -404,13 +399,13 @@ void ons_ControlPoint_Icon_Damage(entity inflictor, entity attacker, float damag
                sound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTEN_NORM);
                pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1);
                Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(self.team, INFO_ONSLAUGHT_CPDESTROYED_), self.owner.message, attacker.netname);
-               
+
                PlayerScore_Add(attacker, SP_ONS_TAKES, 1);
                PlayerScore_Add(attacker, SP_SCORE, 10);
-               
+
                self.owner.goalentity = world;
-               self.owner.islinked = FALSE;
-               self.owner.iscaptured = FALSE;
+               self.owner.islinked = false;
+               self.owner.iscaptured = false;
                self.owner.team = 0;
                self.owner.colormap = 1024;
 
@@ -432,7 +427,7 @@ void ons_ControlPoint_Icon_Damage(entity inflictor, entity attacker, float damag
 
                remove(self);
        }
-       
+
        self.SendFlags |= CPSF_STATUS;
 }
 
@@ -443,8 +438,8 @@ void ons_ControlPoint_Icon_Think()
 
        if(autocvar_g_onslaught_cp_proxydecap)
        {
-        float _enemy_count = 0;
-        float _friendly_count = 0;
+        int _enemy_count = 0;
+        int _friendly_count = 0;
         float _dist;
         entity _player;
 
@@ -489,8 +484,7 @@ void ons_ControlPoint_Icon_Think()
        if(self.owner.islinked != self.owner.waslinked)
        {
                // unteam the spawnpoint if needed
-               float t;
-               t = self.owner.team;
+               int t = self.owner.team;
                if(!self.owner.islinked)
                        self.owner.team = 0;
 
@@ -508,7 +502,7 @@ void ons_ControlPoint_Icon_Think()
        // damaged fx
        if(random() < 0.6 - self.health / self.max_health)
        {
-               pointparticles(particleeffectnum("electricity_sparks"), self.origin + randompos('-10 -10 -20', '10 10 20'), '0 0 0', 1);
+               Send_Effect("electricity_sparks", self.origin + randompos('-10 -10 -20', '10 10 20'), '0 0 0', 1);
 
                if(random() > 0.8)
                        sound(self, CH_PAIN, "onslaught/ons_spark1.wav", VOL_BASE, ATTEN_NORM);
@@ -520,7 +514,7 @@ void ons_ControlPoint_Icon_Think()
 void ons_ControlPoint_Icon_BuildThink()
 {
        entity oself;
-       float a;
+       int a;
 
        self.nextthink = time + ONS_CP_THINKRATE;
 
@@ -530,7 +524,7 @@ void ons_ControlPoint_Icon_BuildThink()
                return;
 
        self.health = self.health + self.count;
-       
+
        self.SendFlags |= CPSF_STATUS;
 
        if (self.health >= self.max_health)
@@ -539,10 +533,10 @@ void ons_ControlPoint_Icon_BuildThink()
                self.count = autocvar_g_onslaught_cp_regen * ONS_CP_THINKRATE; // slow repair rate from now on
                self.think = ons_ControlPoint_Icon_Think;
                sound(self, CH_TRIGGER, "onslaught/controlpoint_built.wav", VOL_BASE, ATTEN_NORM);
-               self.owner.iscaptured = TRUE;
+               self.owner.iscaptured = true;
                self.solid = SOLID_BBOX;
 
-               pointparticles(particleeffectnum(sprintf("%s_cap", Static_Team_ColorName_Lower(self.owner.team))), self.owner.origin, '0 0 0', 1);
+               Send_Effect(sprintf("%s_cap", Static_Team_ColorName_Lower(self.owner.team)), self.owner.origin, '0 0 0', 1);
 
                WaypointSprite_UpdateMaxHealth(self.owner.sprite, self.max_health);
                WaypointSprite_UpdateHealth(self.owner.sprite, self.health);
@@ -555,7 +549,7 @@ void ons_ControlPoint_Icon_BuildThink()
                        PlayerScore_Add(self.owner.ons_toucher, SP_ONS_CAPS, 1);
                        PlayerTeamScore_AddScore(self.owner.ons_toucher, 10);
                }
-               
+
                self.owner.ons_toucher = world;
 
                onslaught_updatelinks();
@@ -566,42 +560,42 @@ void ons_ControlPoint_Icon_BuildThink()
                activator = self;
                SUB_UseTargets ();
                self = oself;
-               
+
                self.SendFlags |= CPSF_SETUP;
        }
        if(self.owner.model != "models/onslaught/controlpoint_pad2.md3")
                setmodel_fixsize(self.owner, "models/onslaught/controlpoint_pad2.md3");
-               
+
        if(random() < 0.9 - self.health / self.max_health)
-               pointparticles(particleeffectnum("rage"), self.origin + 10 * randomvec(), '0 0 -1', 1);
+               Send_Effect("rage", self.origin + 10 * randomvec(), '0 0 -1', 1);
 }
 
 void ons_ControlPoint_Icon_Spawn(entity cp, entity player)
 {
        entity e = spawn();
-       
+
        setsize(e, CPICON_MIN, CPICON_MAX);
        setorigin(e, cp.origin + CPICON_OFFSET);
-       
+
        e.classname = "onslaught_controlpoint_icon";
        e.owner = cp;
        e.max_health = autocvar_g_onslaught_cp_health;
        e.health = autocvar_g_onslaught_cp_buildhealth;
        e.solid = SOLID_NOT;
        e.takedamage = DAMAGE_AIM;
-       e.bot_attack = TRUE;
+       e.bot_attack = true;
        e.event_damage = ons_ControlPoint_Icon_Damage;
        e.team = player.team;
        e.colormap = 1024 + (e.team - 1) * 17;
        e.count = (e.max_health - e.health) * ONS_CP_THINKRATE / autocvar_g_onslaught_cp_buildtime; // how long it takes to build
-       
+
        sound(e, CH_TRIGGER, "onslaught/controlpoint_build.wav", VOL_BASE, ATTEN_NORM);
-       
+
        cp.goalentity = e;
        cp.team = e.team;
        cp.colormap = e.colormap;
 
-       pointparticles(particleeffectnum(sprintf("%sflag_touch", Static_Team_ColorName_Lower(player.team))), e.origin, '0 0 0', 1);
+       Send_Effect(sprintf("%sflag_touch", Static_Team_ColorName_Lower(player.team)), e.origin, '0 0 0', 1);
 
        WaypointSprite_UpdateBuildFinished(cp.sprite, time + (e.max_health - e.health) / (e.count / ONS_CP_THINKRATE));
        WaypointSprite_UpdateRule(cp.sprite,cp.team,SPRITERULE_TEAMPLAY);
@@ -612,11 +606,10 @@ void ons_ControlPoint_Icon_Spawn(entity cp, entity player)
 
 string ons_ControlPoint_Waypoint(entity e)
 {
-       float a;
        if(e.team)
        {
-               a = ons_ControlPoint_Attackable(e, e.team);
-               
+               int a = ons_ControlPoint_Attackable(e, e.team);
+
                if(a == -2) { return "ons-cp-dfnd"; } // defend now
                if(a == -1 || a == 1 || a == 2) { return "ons-cp"; } // touch
                if(a == 3 || a == 4) { return "ons-cp-atck"; } // attack
@@ -633,7 +626,7 @@ void ons_ControlPoint_UpdateSprite(entity e)
        s1 = ons_ControlPoint_Waypoint(e);
        WaypointSprite_UpdateSprites(e.sprite, s1, s1, s1);
 
-       float sh;
+       bool sh;
        sh = !(ons_ControlPoint_CanBeLinked(e, NUM_TEAM_1) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_2) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_3) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_4));
 
        if(e.lastteam != e.team + 2 || e.lastshielded != sh || e.iscaptured != e.lastcaptured)
@@ -653,14 +646,14 @@ void ons_ControlPoint_UpdateSprite(entity e)
                if(e.lastshielded)
                {
                        if(e.team)
-                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, 0.5 * colormapPaletteColor(e.team - 1, FALSE));
+                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, 0.5 * colormapPaletteColor(e.team - 1, false));
                        else
                                WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.5 0.5 0.5');
                }
                else
                {
                        if(e.team)
-                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, colormapPaletteColor(e.team - 1, FALSE));
+                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, colormapPaletteColor(e.team - 1, false));
                        else
                                WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.75 0.75 0.75');
                }
@@ -675,18 +668,18 @@ void ons_ControlPoint_UpdateSprite(entity e)
 void ons_ControlPoint_Touch()
 {
        entity toucher = other;
-       float attackable;
-       
-       if((toucher.vehicle_flags & VHF_ISVEHICLE) && toucher.owner)
+       int attackable;
+
+       if(IS_VEHICLE(toucher) && toucher.owner)
        if(autocvar_g_onslaught_allow_vehicle_touch)
                toucher = toucher.owner;
        else
                return;
-               
+
        if(!IS_PLAYER(toucher)) { return; }
        if(toucher.frozen) { return; }
        if(toucher.deadflag != DEAD_NO) { return; }
-       
+
        if ( SAME_TEAM(self,toucher) )
        if ( self.iscaptured )
        {
@@ -695,7 +688,7 @@ void ons_ControlPoint_Touch()
                else
                        Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT);
        }
-               
+
        attackable = ons_ControlPoint_Attackable(self, toucher.team);
        if(attackable != 2 && attackable != 4)
                return;
@@ -703,7 +696,7 @@ void ons_ControlPoint_Touch()
        // so start building the captured point icon (which only captures this
        // point if it successfully builds without being destroyed first)
        ons_ControlPoint_Icon_Spawn(self, toucher);
-       
+
        self.ons_toucher = toucher;
 
        onslaught_updatelinks();
@@ -723,9 +716,9 @@ void ons_ControlPoint_Reset()
        self.goalentity = world;
        self.team = 0;
        self.colormap = 1024;
-       self.iscaptured = FALSE;
-       self.islinked = FALSE;
-       self.isshielded = TRUE;
+       self.iscaptured = false;
+       self.islinked = false;
+       self.isshielded = true;
        self.think = ons_ControlPoint_Think;
        self.ons_toucher = world;
        self.nextthink = time + ONS_CP_THINKRATE;
@@ -745,9 +738,9 @@ void ons_ControlPoint_Reset()
 void ons_DelayedControlPoint_Setup(void)
 {
        onslaught_updatelinks();
-       
+
        // captureshield setup
-       ons_CaptureShield_Spawn(self, FALSE);
+       ons_CaptureShield_Spawn(self, false);
 
        CSQCMODEL_AUTOINIT();
 }
@@ -756,11 +749,11 @@ void ons_ControlPoint_Setup(entity cp)
 {
        // declarations
        self = cp; // for later usage with droptofloor()
-       
+
        // main setup
        cp.ons_worldcpnext = ons_worldcplist; // link control point into ons_worldcplist
        ons_worldcplist = cp;
-       
+
        cp.netname = "Control point";
        cp.team = 0;
        cp.solid = SOLID_BBOX;
@@ -770,10 +763,10 @@ void ons_ControlPoint_Setup(entity cp)
        cp.nextthink = time + ONS_CP_THINKRATE;
        cp.reset = ons_ControlPoint_Reset;
        cp.colormap = 1024;
-       cp.iscaptured = FALSE;
-       cp.islinked = FALSE;
-       cp.isshielded = TRUE;
-       
+       cp.iscaptured = false;
+       cp.islinked = false;
+       cp.isshielded = true;
+
        if(cp.message == "") { cp.message = "a"; }
 
        // precache - TODO: clean up!
@@ -794,29 +787,29 @@ void ons_ControlPoint_Setup(entity cp)
        precache_sound("onslaught/controlpoint_underattack.wav");
        precache_sound("onslaught/ons_spark1.wav");
        precache_sound("onslaught/ons_spark2.wav");
-       
+
        // appearence
        setmodel_fixsize(cp, "models/onslaught/controlpoint_pad.md3");
-       
+
        // control point placement
        if((cp.spawnflags & 1) || cp.noalign) // don't drop to floor, just stay at fixed location
        {
-               cp.noalign = TRUE;
+               cp.noalign = true;
                cp.movetype = MOVETYPE_NONE;
        }
        else // drop to floor, automatically find a platform and set that as spawn origin
        {
                setorigin(cp, cp.origin + '0 0 20');
-               cp.noalign = FALSE;
+               cp.noalign = false;
                self = cp;
                droptofloor();
                cp.movetype = MOVETYPE_TOSS;
        }
-       
+
        // waypointsprites
        WaypointSprite_SpawnFixed(string_null, self.origin + CPGEN_WAYPOINT_OFFSET, self, sprite, RADARICON_NONE, '0 0 0');
        WaypointSprite_UpdateRule(self.sprite, self.team, SPRITERULE_TEAMPLAY);
-       
+
        InitializeEntity(cp, ons_DelayedControlPoint_Setup, INITPRIO_SETLOCATION);
 }
 
@@ -834,8 +827,7 @@ string ons_Generator_Waypoint(entity e)
 
 void ons_Generator_UpdateSprite(entity e)
 {
-       string s1;
-       s1 = ons_Generator_Waypoint(e);
+       string s1 = ons_Generator_Waypoint(e);
        WaypointSprite_UpdateSprites(e.sprite, s1, s1, s1);
 
        if(e.lastteam != e.team + 2 || e.lastshielded != e.isshielded)
@@ -845,14 +837,14 @@ void ons_Generator_UpdateSprite(entity e)
                if(e.lastshielded)
                {
                        if(e.team)
-                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, 0.5 * colormapPaletteColor(e.team - 1, FALSE));
+                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, 0.5 * colormapPaletteColor(e.team - 1, false));
                        else
                                WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.5 0.5 0.5');
                }
                else
                {
                        if(e.team)
-                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, colormapPaletteColor(e.team - 1, FALSE));
+                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, colormapPaletteColor(e.team - 1, false));
                        else
                                WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.75 0.75 0.75');
                }
@@ -860,7 +852,7 @@ void ons_Generator_UpdateSprite(entity e)
        }
 }
 
-void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
        if(damage <= 0) { return; }
        if(warmup_stage || gameover) { return; }
@@ -906,9 +898,9 @@ void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, float
                        Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(self.team, INFO_ONSLAUGHT_GENDESTROYED_));
                        PlayerScore_Add(attacker, SP_SCORE, 100);
                }
-               self.iscaptured = FALSE;
-               self.islinked = FALSE;
-               self.isshielded = FALSE;
+               self.iscaptured = false;
+               self.islinked = false;
+               self.isshielded = false;
                self.takedamage = DAMAGE_NO; // can't be hurt anymore
                self.event_damage = func_null; // won't do anything if hurt
                self.count = 0; // reset counter
@@ -931,7 +923,7 @@ void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, float
        else
        {
                // particles on every hit
-               pointparticles(particleeffectnum("sparks"), hitloc, force * -1, 1);
+               Send_Effect("sparks", hitloc, force * -1, 1);
 
                //sound on every hit
                if (random() < 0.5)
@@ -971,23 +963,23 @@ void ons_GeneratorReset()
        self.team = self.team_saved;
        self.lasthealth = self.max_health = self.health = autocvar_g_onslaught_gen_health;
        self.takedamage = DAMAGE_AIM;
-       self.bot_attack = TRUE;
-       self.iscaptured = TRUE;
-       self.islinked = TRUE;
-       self.isshielded = TRUE;
+       self.bot_attack = true;
+       self.iscaptured = true;
+       self.islinked = true;
+       self.isshielded = true;
        self.event_damage = ons_GeneratorDamage;
        self.think = ons_GeneratorThink;
        self.nextthink = time + GEN_THINKRATE;
-       
-       Net_LinkEntity(self, FALSE, 0, generator_send);
-       
+
+       Net_LinkEntity(self, false, 0, generator_send);
+
        self.SendFlags = GSF_SETUP; // just incase
        self.SendFlags |= GSF_STATUS;
 
        WaypointSprite_UpdateMaxHealth(self.sprite, self.max_health);
        WaypointSprite_UpdateHealth(self.sprite, self.health);
        WaypointSprite_UpdateRule(self.sprite,self.team,SPRITERULE_TEAMPLAY);
-       
+
        onslaught_updatelinks();
 }
 
@@ -999,11 +991,11 @@ void ons_DelayedGeneratorSetup()
        self.bot_basewaypoint = self.nearestwaypoint;
 
        // captureshield setup
-       ons_CaptureShield_Spawn(self, TRUE);
-       
+       ons_CaptureShield_Spawn(self, true);
+
        onslaught_updatelinks();
-       
-       Net_LinkEntity(self, FALSE, 0, generator_send);
+
+       Net_LinkEntity(self, false, 0, generator_send);
 }
 
 
@@ -1020,13 +1012,13 @@ void onslaught_generator_touch()
 void ons_GeneratorSetup(entity gen) // called when spawning a generator entity on the map as a spawnfunc
 {
        // declarations
-       float teamnumber = gen.team;
+       int teamnumber = gen.team;
        self = gen; // for later usage with droptofloor()
-       
+
        // main setup
        gen.ons_worldgeneratornext = ons_worldgeneratorlist; // link generator into ons_worldgeneratorlist
        ons_worldgeneratorlist = gen;
-       
+
        gen.netname = sprintf("%s generator", Team_ColoredFullName(teamnumber));
        gen.classname = "onslaught_generator";
        gen.solid = SOLID_BBOX;
@@ -1034,16 +1026,16 @@ void ons_GeneratorSetup(entity gen) // called when spawning a generator entity o
        gen.movetype = MOVETYPE_NONE;
        gen.lasthealth = gen.max_health = gen.health = autocvar_g_onslaught_gen_health;
        gen.takedamage = DAMAGE_AIM;
-       gen.bot_attack = TRUE;
+       gen.bot_attack = true;
        gen.event_damage = ons_GeneratorDamage;
        gen.reset = ons_GeneratorReset;
        gen.think = ons_GeneratorThink;
        gen.nextthink = time + GEN_THINKRATE;
-       gen.iscaptured = TRUE;
-       gen.islinked = TRUE;
-       gen.isshielded = TRUE;
+       gen.iscaptured = true;
+       gen.islinked = true;
+       gen.isshielded = true;
        gen.touch = onslaught_generator_touch;
-       
+
        // precache - TODO: clean up!
        precache_model("models/onslaught/generator_shield.md3");
        precache_model("models/onslaught/gen_gib1.md3");
@@ -1057,23 +1049,23 @@ void ons_GeneratorSetup(entity gen) // called when spawning a generator entity o
        precache_sound("onslaught/ons_hit1.wav");
        precache_sound("onslaught/ons_hit2.wav");
        precache_sound("onslaught/generator_underattack.wav");
-       
+
        // appearence
        // model handled by CSQC
        setsize(gen, GENERATOR_MIN, GENERATOR_MAX);
        setorigin(gen, (gen.origin + CPGEN_SPAWN_OFFSET));
        gen.colormap = 1024 + (teamnumber - 1) * 17;
-       
+
        // generator placement
        self = gen;
        droptofloor();
-       
+
        // waypointsprites
        WaypointSprite_SpawnFixed(string_null, self.origin + CPGEN_WAYPOINT_OFFSET, self, sprite, RADARICON_NONE, '0 0 0');
        WaypointSprite_UpdateRule(self.sprite, self.team, SPRITERULE_TEAMPLAY);
        WaypointSprite_UpdateMaxHealth(self.sprite, self.max_health);
        WaypointSprite_UpdateHealth(self.sprite, self.health);
-       
+
        InitializeEntity(gen, ons_DelayedGeneratorSetup, INITPRIO_SETLOCATION);
 }
 
@@ -1082,7 +1074,7 @@ void ons_GeneratorSetup(entity gen) // called when spawning a generator entity o
 //  Round Handler
 // ===============
 
-float total_generators, redowned, blueowned, yellowowned, pinkowned;
+int total_generators;
 void Onslaught_count_generators()
 {
        entity e;
@@ -1097,9 +1089,9 @@ void Onslaught_count_generators()
        }
 }
 
-float Onslaught_GetWinnerTeam()
+int Onslaught_GetWinnerTeam()
 {
-       float winner_team = 0;
+       int winner_team = 0;
        if(redowned > 0)
                winner_team = NUM_TEAM_1;
        if(blueowned > 0)
@@ -1124,20 +1116,20 @@ float Onslaught_GetWinnerTeam()
 
 #define ONS_OWNED_GENERATORS() ((redowned > 0) + (blueowned > 0) + (yellowowned > 0) + (pinkowned > 0))
 #define ONS_OWNED_GENERATORS_OK() (ONS_OWNED_GENERATORS() > 1)
-float Onslaught_CheckWinner()
+bool Onslaught_CheckWinner()
 {
        entity e;
-       
+
        if ((autocvar_timelimit && time > game_starttime + autocvar_timelimit * 60) || (round_handler_GetEndTime() > 0 && round_handler_GetEndTime() - time <= 0))
        {
-               ons_stalemate = TRUE;
+               ons_stalemate = true;
 
                if (!wpforenemy_announced)
                {
                        Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT);
                        sound(world, CH_INFO, "onslaught/generator_decay.wav", VOL_BASE, ATTEN_NONE);
 
-                       wpforenemy_announced = TRUE;
+                       wpforenemy_announced = true;
                }
 
                entity tmp_entity; // temporary entity
@@ -1160,20 +1152,20 @@ float Onslaught_CheckWinner()
                                d = d * tmp_entity.max_health / max(30, 60 * autocvar_timelimit_suddendeath);
 
                        Damage(tmp_entity, tmp_entity, tmp_entity, d, DEATH_HURTTRIGGER, tmp_entity.origin, '0 0 0');
-                       
+
                        tmp_entity.sprite.SendFlags |= 16;
 
                        tmp_entity.ons_overtime_damagedelay = time + 1;
                }
        }
-       else { wpforenemy_announced = FALSE; ons_stalemate = FALSE; }
+       else { wpforenemy_announced = false; ons_stalemate = false; }
 
        Onslaught_count_generators();
-       
+
        if(ONS_OWNED_GENERATORS_OK())
                return 0;
 
-       float winner_team = Onslaught_GetWinnerTeam();
+       int winner_team = Onslaught_GetWinnerTeam();
 
        if(winner_team > 0)
        {
@@ -1186,17 +1178,17 @@ float Onslaught_CheckWinner()
                Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_TIED);
                Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_TIED);
        }
-       
-       ons_stalemate = FALSE;
+
+       ons_stalemate = false;
 
        play2all(sprintf("ctf/%s_capture.wav", Static_Team_ColorName_Lower(winner_team)));
-       
+
        round_handler_Init(7, autocvar_g_onslaught_warmup, autocvar_g_onslaught_round_timelimit);
-       
+
        FOR_EACH_PLAYER(e)
        {
-               e.ons_roundlost = TRUE;
-               e.player_blocked = TRUE;
+               e.ons_roundlost = true;
+               e.player_blocked = true;
 
                nades_Clear(e);
        }
@@ -1204,7 +1196,7 @@ float Onslaught_CheckWinner()
        return 1;
 }
 
-float Onslaught_CheckPlayers()
+bool Onslaught_CheckPlayers()
 {
        return 1;
 }
@@ -1212,7 +1204,7 @@ float Onslaught_CheckPlayers()
 void Onslaught_RoundStart()
 {
        entity tmp_entity;
-       FOR_EACH_PLAYER(tmp_entity) { tmp_entity.player_blocked = FALSE; }
+       FOR_EACH_PLAYER(tmp_entity) { tmp_entity.player_blocked = false; }
 
        for(tmp_entity = ons_worldcplist; tmp_entity; tmp_entity = tmp_entity.ons_worldcpnext)
                tmp_entity.sprite.SendFlags |= 16;
@@ -1231,11 +1223,13 @@ void Onslaught_RoundStart()
 void havocbot_goalrating_ons_offenseitems(float ratingscale, vector org, float sradius)
 {
        entity head;
-       float t, i, c, needarmor = FALSE, needweapons = FALSE;
+       float t, c;
+       int i;
+       bool needarmor = false, needweapons = false;
 
        // Needs armor/health?
        if(self.health<100)
-               needarmor = TRUE;
+               needarmor = true;
 
        // Needs weapons?
        c = 0;
@@ -1248,7 +1242,7 @@ void havocbot_goalrating_ons_offenseitems(float ratingscale, vector org, float s
        }
 
        if(c<4)
-               needweapons = TRUE;
+               needweapons = true;
 
        if(!needweapons && !needarmor)
                return;
@@ -1257,7 +1251,7 @@ void havocbot_goalrating_ons_offenseitems(float ratingscale, vector org, float s
        ons_debug(strcat(self.netname, " needs armor ", ftos(needarmor) , "\n"));
 
        // See what is around
-       head = findchainfloat(bot_pickup, TRUE);
+       head = findchainfloat(bot_pickup, true);
        while (head)
        {
                // gather health and armor only
@@ -1273,7 +1267,7 @@ void havocbot_goalrating_ons_offenseitems(float ratingscale, vector org, float s
        }
 }
 
-void havocbot_role_ons_setrole(entity bot, float role)
+void havocbot_role_ons_setrole(entity bot, int role)
 {
        ons_debug(strcat(bot.netname," switched to "));
        switch(role)
@@ -1300,9 +1294,9 @@ void havocbot_role_ons_setrole(entity bot, float role)
        ons_debug("\n");
 }
 
-float havocbot_ons_teamcount(entity bot, float role)
+int havocbot_ons_teamcount(entity bot, int role)
 {
-       float c = 0;
+       int c = 0;
        entity head;
 
        FOR_EACH_PLAYER(head)
@@ -1316,13 +1310,15 @@ float havocbot_ons_teamcount(entity bot, float role)
 void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
 {
        entity cp, cp1, cp2, best, pl, wp;
-       float radius, found, bestvalue, c;
+       float radius, bestvalue;
+       int c;
+       bool found;
 
        // Filter control points
        for(cp2 = ons_worldcplist; cp2; cp2 = cp2.ons_worldcpnext)
        {
                cp2.wpcost = c = 0;
-               cp2.wpconsidered = FALSE;
+               cp2.wpconsidered = false;
 
                if(cp2.isshielded)
                        continue;
@@ -1341,7 +1337,7 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
 
                // NOTE: probably decrease the cost of attackable control points
                cp2.wpcost = c;
-               cp2.wpconsidered = TRUE;
+               cp2.wpconsidered = true;
        }
 
        // We'll consider only the best case
@@ -1369,7 +1365,7 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
        {
                // Should be attacked
                // Rate waypoints near it
-               found = FALSE;
+               found = false;
                best = world;
                bestvalue = 99999999999;
                for(radius=0; radius<1000 && !found; radius+=500)
@@ -1380,7 +1376,7 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
                                if(wp.classname=="waypoint")
                                if(checkpvs(wp.origin,cp))
                                {
-                                       found = TRUE;
+                                       found = true;
                                        if(wp.cnt<bestvalue)
                                        {
                                                best = wp;
@@ -1410,7 +1406,7 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
        {
                // Should be touched
                ons_debug(strcat(self.netname, " found a touchable controlpoint at ", vtos(cp.origin) ,"\n"));
-               found = FALSE;
+               found = false;
 
                // Look for auto generated waypoint
                if (!bot_waypoints_for_items)
@@ -1419,7 +1415,7 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
                        if(wp.classname=="waypoint")
                        {
                                navigation_routerating(wp, ratingscale, 10000);
-                               found = TRUE;
+                               found = true;
                        }
                }
 
@@ -1429,10 +1425,11 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
        }
 }
 
-float havocbot_goalrating_ons_generator_attack(float ratingscale)
+bool havocbot_goalrating_ons_generator_attack(float ratingscale)
 {
        entity g, wp, bestwp;
-       float found, best;
+       bool found;
+       int best;
 
        for(g = ons_worldgeneratorlist; g; g = g.ons_worldgeneratornext)
        {
@@ -1441,7 +1438,7 @@ float havocbot_goalrating_ons_generator_attack(float ratingscale)
 
                // Should be attacked
                // Rate waypoints near it
-               found = FALSE;
+               found = false;
                bestwp = world;
                best = 99999999999;
 
@@ -1450,7 +1447,7 @@ float havocbot_goalrating_ons_generator_attack(float ratingscale)
                        if(wp.classname=="waypoint")
                        if(checkpvs(wp.origin,g))
                        {
-                               found = TRUE;
+                               found = true;
                                if(wp.cnt<best)
                                {
                                        bestwp = wp;
@@ -1470,7 +1467,7 @@ float havocbot_goalrating_ons_generator_attack(float ratingscale)
                        if(checkpvs(self.view_ofs,bestwp))
                                self.havocbot_attack_time = time + 5;
 
-                       return TRUE;
+                       return true;
                }
                else
                {
@@ -1478,10 +1475,10 @@ float havocbot_goalrating_ons_generator_attack(float ratingscale)
                        // if there aren't waypoints near the generator go straight to it
                        navigation_routerating(g, ratingscale, 10000);
                        self.havocbot_attack_time = 0;
-                       return TRUE;
+                       return true;
                }
        }
-       return FALSE;
+       return false;
 }
 
 void havocbot_role_ons_offense()
@@ -1532,7 +1529,7 @@ void havocbot_role_ons_defense()
 void havocbot_ons_reset_role(entity bot)
 {
        entity head;
-       float c;
+       int c = 0;
 
        if(self.deadflag != DEAD_NO)
                return;
@@ -1583,7 +1580,7 @@ entity ons_Nearest_ControlPoint(vector pos, float max_dist)
                        closest_target = tmp_entity;
                tmp_entity = tmp_entity.chain;
        }
-       
+
        return closest_target;
 }
 
@@ -1597,14 +1594,14 @@ entity ons_Nearest_ControlPoint_2D(vector pos, float max_dist)
        entity tmp_entity, closest_target = world;
        vector delta;
        float smallest_distance = 0, distance;
-       
+
        tmp_entity = findchain(classname, "onslaught_controlpoint");
        while(tmp_entity)
        {
                delta = tmp_entity.origin - pos;
                delta_z = 0;
                distance = vlen(delta);
-               
+
                if(SAME_TEAM(tmp_entity, self))
                if(tmp_entity.iscaptured)
                if(max_dist <= 0 || distance <= max_dist)
@@ -1613,7 +1610,7 @@ entity ons_Nearest_ControlPoint_2D(vector pos, float max_dist)
                        closest_target = tmp_entity;
                        smallest_distance = distance;
                }
-               
+
                tmp_entity = tmp_entity.chain;
        }
        tmp_entity = findchain(classname, "onslaught_generator");
@@ -1622,7 +1619,7 @@ entity ons_Nearest_ControlPoint_2D(vector pos, float max_dist)
                delta = tmp_entity.origin - pos;
                delta_z = 0;
                distance = vlen(delta);
-               
+
                if(SAME_TEAM(tmp_entity, self))
                if(max_dist <= 0 || distance <= max_dist)
                if(closest_target == world || distance <= smallest_distance )
@@ -1630,20 +1627,20 @@ entity ons_Nearest_ControlPoint_2D(vector pos, float max_dist)
                        closest_target = tmp_entity;
                        smallest_distance = distance;
                }
-               
+
                tmp_entity = tmp_entity.chain;
        }
-       
+
        return closest_target;
 }
 /**
  * find the number of control points and generators in the same team as self
  */
-float ons_Count_SelfControlPoints()
+int ons_Count_SelfControlPoints()
 {
        entity tmp_entity;
        tmp_entity = findchain(classname, "onslaught_controlpoint");
-       float n = 0;
+       int n = 0;
        while(tmp_entity)
        {
                if(SAME_TEAM(tmp_entity, self))
@@ -1664,14 +1661,14 @@ float ons_Count_SelfControlPoints()
 /**
  * Teleport player to a random position near tele_target
  * if tele_effects is true, teleport sound+particles are created
- * return FALSE on failure
+ * return false on failure
  */
-float ons_Teleport(entity player, entity tele_target, float range, float tele_effects)
+bool ons_Teleport(entity player, entity tele_target, float range, bool tele_effects)
 {
        if ( !tele_target )
-               return FALSE;
-       
-       float i;
+               return false;
+
+       int i;
        vector loc;
        float theta;
        for(i = 0; i < 16; ++i)
@@ -1681,9 +1678,9 @@ float ons_Teleport(entity player, entity tele_target, float range, float tele_ef
                loc_x = cos(theta);
                loc_z = 0;
                loc *= random() * range;
-               
+
                loc += tele_target.origin + '0 0 128';
-               
+
                tracebox(loc, PL_MIN, PL_MAX, loc, MOVE_NORMAL, player);
                if(trace_fraction == 1.0 && !trace_startsolid)
                {
@@ -1692,23 +1689,23 @@ float ons_Teleport(entity player, entity tele_target, float range, float tele_ef
                        {
                                if ( tele_effects )
                                {
-                                       pointparticles(particleeffectnum("teleport"), player.origin, '0 0 0', 1);
+                                       Send_Effect("teleport", player.origin, '0 0 0', 1);
                                        sound (player, CH_TRIGGER, "misc/teleport.wav", VOL_BASE, ATTEN_NORM);
                                }
                                setorigin(player, loc);
                                player.angles = '0 1 0' * ( theta * RAD2DEG + 180 );
                                makevectors(player.angles);
-                               player.fixangle = TRUE;
+                               player.fixangle = true;
                                player.teleport_antispam = time + autocvar_g_onslaught_teleport_wait;
 
                                if ( tele_effects )
-                                       pointparticles(particleeffectnum("teleport"), player.origin + v_forward * 32, '0 0 0', 1);
-                               return TRUE;
+                                       Send_Effect("teleport", player.origin + v_forward * 32, '0 0 0', 1);
+                               return true;
                        }
                }
        }
-       
-       return FALSE;
+
+       return false;
 }
 
 // ==============
@@ -1719,27 +1716,27 @@ MUTATOR_HOOKFUNCTION(ons_ResetMap)
 {
        FOR_EACH_PLAYER(self)
        {
-               self.ons_roundlost = FALSE;
+               self.ons_roundlost = false;
                self.ons_deathloc = '0 0 0';
                PutClientInServer();
        }
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ons_RemovePlayer)
 {
        self.ons_deathloc = '0 0 0';
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ons_PlayerSpawn)
 {
        if(!round_handler_IsRoundStarted())
        {
-               self.player_blocked = TRUE;
-               return FALSE;
+               self.player_blocked = true;
+               return false;
        }
-       
+
        entity l;
        for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext)
        {
@@ -1754,21 +1751,21 @@ MUTATOR_HOOKFUNCTION(ons_PlayerSpawn)
 
        if ( autocvar_g_onslaught_spawn_choose )
        if ( self.ons_spawn_by )
-       if ( ons_Teleport(self,self.ons_spawn_by,autocvar_g_onslaught_teleport_radius,FALSE) )
+       if ( ons_Teleport(self,self.ons_spawn_by,autocvar_g_onslaught_teleport_radius,false) )
        {
                self.ons_spawn_by = world;
-               return FALSE;
+               return false;
        }
-       
+
        if(autocvar_g_onslaught_spawn_at_controlpoints)
        if(random() <= autocvar_g_onslaught_spawn_at_controlpoints_chance)
        {
                float random_target = autocvar_g_onslaught_spawn_at_controlpoints_random;
                entity tmp_entity, closest_target = world;
                vector spawn_loc = self.ons_deathloc;
-               
+
                // new joining player or round reset, don't bother checking
-               if(spawn_loc == '0 0 0') { return FALSE; }
+               if(spawn_loc == '0 0 0') { return false; }
 
                if(random_target) { RandomSelection_Init(); }
 
@@ -1780,9 +1777,9 @@ MUTATOR_HOOKFUNCTION(ons_PlayerSpawn)
                        else if(vlen(tmp_entity.origin - spawn_loc) <= vlen(closest_target.origin - spawn_loc) || closest_target == world)
                                closest_target = tmp_entity;
                }
-               
+
                if(random_target) { closest_target = RandomSelection_chosen_ent; }
-               
+
                if(closest_target)
                {
                        float i;
@@ -1799,23 +1796,23 @@ MUTATOR_HOOKFUNCTION(ons_PlayerSpawn)
                                        {
                                                setorigin(self, loc);
                                                self.angles = normalize(loc - closest_target.origin) * RAD2DEG;
-                                               return FALSE;
+                                               return false;
                                        }
                                }
                        }
                }
        }
-       
+
        if(autocvar_g_onslaught_spawn_at_generator)
        if(random() <= autocvar_g_onslaught_spawn_at_generator_chance)
        {
                float random_target = autocvar_g_onslaught_spawn_at_generator_random;
                entity tmp_entity, closest_target = world;
                vector spawn_loc = self.ons_deathloc;
-               
+
                // new joining player or round reset, don't bother checking
-               if(spawn_loc == '0 0 0') { return FALSE; }
-               
+               if(spawn_loc == '0 0 0') { return false; }
+
                if(random_target) { RandomSelection_Init(); }
 
                for(tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext)
@@ -1829,9 +1826,9 @@ MUTATOR_HOOKFUNCTION(ons_PlayerSpawn)
                                        closest_target = tmp_entity;
                        }
                }
-               
+
                if(random_target) { closest_target = RandomSelection_chosen_ent; }
-               
+
                if(closest_target)
                {
                        float i;
@@ -1848,14 +1845,14 @@ MUTATOR_HOOKFUNCTION(ons_PlayerSpawn)
                                        {
                                                setorigin(self, loc);
                                                self.angles = normalize(loc - closest_target.origin) * RAD2DEG;
-                                               return FALSE;
+                                               return false;
                                        }
                                }
                        }
                }
        }
 
-    return FALSE;
+    return false;
 }
 
 MUTATOR_HOOKFUNCTION(ons_PlayerDies)
@@ -1870,12 +1867,12 @@ MUTATOR_HOOKFUNCTION(ons_PlayerDies)
        {
                l.sprite.SendFlags |= 16;
        }
-       
+
        if ( autocvar_g_onslaught_spawn_choose )
        if ( ons_Count_SelfControlPoints() > 1 )
                stuffcmd(self, "qc_cmd_cl hud clickradar\n");
-       
-       return FALSE;
+
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ons_MonsterThink)
@@ -1884,27 +1881,27 @@ MUTATOR_HOOKFUNCTION(ons_MonsterThink)
        if (e != world)
                self.team = e.team;
 
-       return FALSE;
+       return false;
 }
 
 void ons_MonsterSpawn_Delayed()
 {
        entity e, own = self.owner;
-       
+
        if(!own) { remove(self); return; }
-       
+
        if(own.targetname)
        {
                e = find(world, target, own.targetname);
                if(e != world)
                {
                        own.team = e.team;
-                       
+
                        activator = e;
                        own.use();
                }
        }
-       
+
        remove(self);
 }
 
@@ -1914,7 +1911,7 @@ MUTATOR_HOOKFUNCTION(ons_MonsterSpawn)
        e.owner = self;
        InitializeEntity(e, ons_MonsterSpawn_Delayed, INITPRIO_FINDTARGET);
 
-       return FALSE;
+       return false;
 }
 
 void ons_TurretSpawn_Delayed()
@@ -1930,7 +1927,7 @@ void ons_TurretSpawn_Delayed()
                {
                        own.team = e.team;
                        own.active = ACTIVE_NOT;
-                       
+
                        activator = e;
                        own.use();
                }
@@ -1945,13 +1942,13 @@ MUTATOR_HOOKFUNCTION(ons_TurretSpawn)
        e.owner = self;
        InitializeEntity(e, ons_TurretSpawn_Delayed, INITPRIO_FINDTARGET);
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ons_BotRoles)
 {
        havocbot_ons_reset_role(self);
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(ons_GetTeamCount)
@@ -1969,19 +1966,19 @@ MUTATOR_HOOKFUNCTION(ons_GetTeamCount)
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(ons_SpectateCopy)
 {
        self.ons_roundlost = other.ons_roundlost; // make spectators see it too
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ons_SV_ParseClientCommand)
 {
        if(MUTATOR_RETURNVALUE) // command was already handled?
-               return FALSE;
+               return false;
 
        if ( cmd_name == "ons_spawn" )
        {
@@ -1992,28 +1989,28 @@ MUTATOR_HOOKFUNCTION(ons_SV_ParseClientCommand)
                        pos_y = stof(argv(2));
                if(cmd_argc > 3)
                        pos_z = stof(argv(3));
-               
+
                if ( IS_PLAYER(self) )
                {
                        if ( !self.frozen )
                        {
                                entity source_point = ons_Nearest_ControlPoint(self.origin, autocvar_g_onslaught_teleport_radius);
-                               
+
                                if ( !source_point && self.health > 0 )
                                {
                                        sprint(self, "\nYou need to be next to a control point\n");
                                        return 1;
                                }
-                               
-                               
+
+
                                entity closest_target = ons_Nearest_ControlPoint_2D(pos, autocvar_g_onslaught_click_radius);
-                       
+
                                if ( closest_target == world )
                                {
                                        sprint(self, "\nNo control point found\n");
                                        return 1;
                                }
-                               
+
                                if ( self.health <= 0 )
                                {
                                        self.ons_spawn_by = closest_target;
@@ -2026,17 +2023,17 @@ MUTATOR_HOOKFUNCTION(ons_SV_ParseClientCommand)
                                                sprint(self, "\nTeleporting to the same point\n");
                                                return 1;
                                        }
-                                       
-                                       if ( !ons_Teleport(self,closest_target,autocvar_g_onslaught_teleport_radius,TRUE) )
+
+                                       if ( !ons_Teleport(self,closest_target,autocvar_g_onslaught_teleport_radius,true) )
                                                sprint(self, "\nUnable to teleport there\n");
                                }
-                               
+
                                return 1;
                        }
-                       
+
                        sprint(self, "\nNo teleportation for you\n");
                }
-               
+
                return 1;
        }
        return 0;
@@ -2044,19 +2041,25 @@ MUTATOR_HOOKFUNCTION(ons_SV_ParseClientCommand)
 
 MUTATOR_HOOKFUNCTION(ons_PlayerUseKey)
 {
-       if(MUTATOR_RETURNVALUE || gameover) { return FALSE; }
-       
+       if(MUTATOR_RETURNVALUE || gameover) { return false; }
+
        if((time > self.teleport_antispam) && (self.deadflag == DEAD_NO) && !self.vehicle)
        {
                entity source_point = ons_Nearest_ControlPoint(self.origin, autocvar_g_onslaught_teleport_radius);
                if ( source_point )
                {
                        stuffcmd(self, "qc_cmd_cl hud clickradar\n");
-                       return TRUE;
+                       return true;
                }
        }
-       
-       return FALSE;
+
+       return false;
+}
+
+MUTATOR_HOOKFUNCTION(ons_PlayHitsound)
+{
+       return (frag_victim.classname == "onslaught_generator" && !frag_victim.isshielded)
+               || (frag_victim.classname == "onslaught_controlpoint_icon" && !frag_victim.owner.isshielded);
 }
 
 // ==========
@@ -2083,7 +2086,7 @@ void spawnfunc_onslaught_link()
        ons_worldlinklist = self;
 
        InitializeEntity(self, ons_DelayedLinkSetup, INITPRIO_FINDTARGET);
-       Net_LinkEntity(self, FALSE, 0, ons_Link_Send);
+       Net_LinkEntity(self, false, 0, ons_Link_Send);
 }
 
 /*QUAKED spawnfunc_onslaught_controlpoint (0 .5 .8) (-32 -32 0) (32 32 128)
@@ -2100,7 +2103,7 @@ keys:
 void spawnfunc_onslaught_controlpoint()
 {
        if(!g_onslaught) { remove(self); return; }
-       
+
        ons_ControlPoint_Setup(self);
 }
 
@@ -2121,12 +2124,11 @@ void spawnfunc_onslaught_generator()
        ons_GeneratorSetup(self);
 }
 
-
 // scoreboard setup
 void ons_ScoreRules()
 {
        CheckAllowedTeams(world);
-       ScoreRules_basics(((c4>=0) ? 4 : (c3>=0) ? 3 : 2), SFL_SORT_PRIO_PRIMARY, 0, TRUE);
+       ScoreRules_basics(((c4>=0) ? 4 : (c3>=0) ? 3 : 2), SFL_SORT_PRIO_PRIMARY, 0, true);
        ScoreInfo_SetLabel_TeamScore  (ST_ONS_CAPS,     "destroyed", SFL_SORT_PRIO_PRIMARY);
        ScoreInfo_SetLabel_PlayerScore(SP_ONS_CAPS,     "caps",      SFL_SORT_PRIO_SECONDARY);
        ScoreInfo_SetLabel_PlayerScore(SP_ONS_TAKES,    "takes",     0);
@@ -2136,7 +2138,7 @@ void ons_ScoreRules()
 void ons_DelayedInit() // Do this check with a delay so we can wait for teams to be set up
 {
        ons_ScoreRules();
-       
+
        round_handler_Spawn(Onslaught_CheckPlayers, Onslaught_CheckWinner, Onslaught_RoundStart);
        round_handler_Init(5, autocvar_g_onslaught_warmup, autocvar_g_onslaught_round_timelimit);
 }
@@ -2170,6 +2172,7 @@ MUTATOR_DEFINITION(gamemode_onslaught)
        MUTATOR_HOOK(SpectateCopy, ons_SpectateCopy, CBC_ORDER_ANY);
        MUTATOR_HOOK(SV_ParseClientCommand, ons_SV_ParseClientCommand, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerUseKey, ons_PlayerUseKey, CBC_ORDER_ANY);
+       MUTATOR_HOOK(PlayHitsound, ons_PlayHitsound, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {
@@ -2191,5 +2194,5 @@ MUTATOR_DEFINITION(gamemode_onslaught)
                return -1;
        }
 
-       return FALSE;
+       return false;
 }