]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mode_onslaught.qc
Merge remote branch 'origin/master' into samual/hagar_secondary_autorelease
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mode_onslaught.qc
index da227980921853701d99c66984ebacd293c424c9..4f8aee2e76431f3cb36d5f438007c7037cdd6076 100644 (file)
@@ -372,6 +372,7 @@ float onslaught_controlpoint_attackable(entity cp, float t)
        return 0;
 }
 
+float overtime_msg_time;
 void onslaught_generator_think()
 {
        local float d;
@@ -379,12 +380,17 @@ void onslaught_generator_think()
        self.nextthink = ceil(time + 1);
        if (!gameover)
        {
-               if (autocvar_timelimit)
-               if (time > game_starttime + autocvar_timelimit * 60)
+               if (autocvar_timelimit && time > game_starttime + autocvar_timelimit * 60)
                {
+                       if (!overtime_msg_time)
+                       {
+                               FOR_EACH_PLAYER(e)
+                                       centerprint(e, "^3Now playing ^1OVERTIME^3!\n^3Generators start now to self-damaging.\n^3The more control points your team holds,\n^3the more damage the enemy generator gets.");
+                               overtime_msg_time = time;
+                       }
                        // self.max_health / 300 gives 5 minutes of overtime.
                        // control points reduce the overtime duration.
-                       asound(self, CH_TRIGGER, "onslaught/generator_decay.wav", VOL_BASE, ATTN_NORM);
+                       sound(self, CH_TRIGGER, "onslaught/generator_decay.wav", VOL_BASE, ATTN_NORM);
                        d = 1;
                        e = findchain(classname, "onslaught_controlpoint");
                        while (e)
@@ -397,6 +403,8 @@ void onslaught_generator_think()
                        d = d * self.max_health / 300;
                        Damage(self, self, self, d, DEATH_HURTTRIGGER, self.origin, '0 0 0');
                }
+               else if (overtime_msg_time)
+                       overtime_msg_time = 0;
        }
 };
 
@@ -455,7 +463,7 @@ void onslaught_generator_damage_think()
                if(random() < 0.01)
                {
                        pointparticles(particleeffectnum("electro_ballexplode"), self.origin + randompos('-50 -50 -20', '50 50 50'), '0 0 0', 1);
-                       asound(self, CH_TRIGGER, "onslaught/electricity_explode.wav", VOL_BASE, ATTN_NORM);
+                       sound(self, CH_TRIGGER, "onslaught/electricity_explode.wav", VOL_BASE, ATTN_NORM);
                }
                else
                        pointparticles(particleeffectnum("torch_small"), self.origin + randompos('-60 -60 -20', '60 60 60'), '0 0 0', 1);
@@ -484,7 +492,7 @@ void onslaught_generator_deaththink()
        if(self.count==40||self.count==20)
        {
                onslaught_generator_ring_spawn(self.origin);
-               asound(self, CH_TRIGGER, "onslaught/shockwave.wav", VOL_BASE, ATTN_NORM);
+               sound(self, CH_TRIGGER, "onslaught/shockwave.wav", VOL_BASE, ATTN_NORM);
        }
 
        // Throw some gibs
@@ -510,7 +518,7 @@ void onslaught_generator_deaththink()
        if(random() < 0.25)
        {
                te_explosion(self.origin);
-               asound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
+               sound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
        }
 
        // Particles
@@ -530,7 +538,7 @@ void onslaught_generator_deaththink()
                te_explosion(org);
                onslaught_generator_shockwave_spawn(org);
                pointparticles(particleeffectnum("onslaught_generator_finalexplosion"), org, '0 0 0', 1);
-               asound(self, CH_TRIGGER, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
+               sound(self, CH_TRIGGER, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
        }
        else
                self.nextthink = time + 0.05;
@@ -631,7 +639,7 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage,
        // Throw some flaming gibs on damage, more damage = more chance for gib
        if(random() < damage/220)
        {
-               asound(self, CH_TRIGGER, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
+               sound(self, CH_TRIGGER, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
                i = random();
                if(i < 0.3)
                        ons_throwgib(hitloc + '0 0 20', force * -1, "models/onslaught/gen_gib1.md3", 5, TRUE);
@@ -647,9 +655,9 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage,
 
                //sound on every hit
                if (random() < 0.5)
-                       asound(self, CH_TRIGGER, "onslaught/ons_hit1.wav", VOL_BASE, ATTN_NORM);
+                       sound(self, CH_TRIGGER, "onslaught/ons_hit1.wav", VOL_BASE, ATTN_NORM);
                else
-                       asound(self, CH_TRIGGER, "onslaught/ons_hit2.wav", VOL_BASE, ATTN_NORM);
+                       sound(self, CH_TRIGGER, "onslaught/ons_hit2.wav", VOL_BASE, ATTN_NORM);
        }
 
        //throw some gibs on damage
@@ -819,6 +827,7 @@ void onslaught_generator_reset()
        self.think = onslaught_generator_delayed;
        self.nextthink = time + 0.2;
        setmodel(self, "models/onslaught/generator.md3");
+       setsize(self, '-52 -52 -14', '52 52 75');
 
        WaypointSprite_UpdateMaxHealth(self.sprite, self.max_health);
        WaypointSprite_UpdateHealth(self.sprite, self.health);
@@ -977,13 +986,13 @@ void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float
        pointparticles(particleeffectnum("sparks"), hitloc, force*-1, 1);
        //sound on every hit
        if (random() < 0.5)
-               asound(self, CH_TRIGGER, "onslaught/ons_hit1.wav", VOL_BASE+0.3, ATTN_NORM);
+               sound(self, CH_TRIGGER, "onslaught/ons_hit1.wav", VOL_BASE+0.3, ATTN_NORM);
        else
-               asound(self, CH_TRIGGER, "onslaught/ons_hit2.wav", VOL_BASE+0.3, ATTN_NORM);
+               sound(self, CH_TRIGGER, "onslaught/ons_hit2.wav", VOL_BASE+0.3, ATTN_NORM);
 
        if (self.health < 0)
        {
-               asound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
+               sound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
                pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1);
                {
                        string t;
@@ -1067,33 +1076,55 @@ void onslaught_controlpoint_icon_think()
 
                self.owner.waslinked = self.owner.islinked;
        }
-       if (self.punchangle_x > 2)
-               self.punchangle_x = self.punchangle_x - 2;
-       else if (self.punchangle_x < -2)
-               self.punchangle_x = self.punchangle_x + 2;
-       else
-               self.punchangle_x = 0;
-       if (self.punchangle_y > 2)
-               self.punchangle_y = self.punchangle_y - 2;
-       else if (self.punchangle_y < -2)
-               self.punchangle_y = self.punchangle_y + 2;
-       else
-               self.punchangle_y = 0;
-       if (self.punchangle_z > 2)
-               self.punchangle_z = self.punchangle_z - 2;
-       else if (self.punchangle_z < -2)
-               self.punchangle_z = self.punchangle_z + 2;
-       else
-               self.punchangle_z = 0;
+
+       if (self.punchangle_x > 0)
+       {
+               self.punchangle_x = self.punchangle_x - 60 * sys_frametime;
+               if (self.punchangle_x < 0)
+                       self.punchangle_x = 0;
+       }
+       else if (self.punchangle_x < 0)
+       {
+               self.punchangle_x = self.punchangle_x + 60 * sys_frametime;
+               if (self.punchangle_x > 0)
+                       self.punchangle_x = 0;
+       }
+
+       if (self.punchangle_y > 0)
+       {
+               self.punchangle_y = self.punchangle_y - 60 * sys_frametime;
+               if (self.punchangle_y < 0)
+                       self.punchangle_y = 0;
+       }
+       else if (self.punchangle_y < 0)
+       {
+               self.punchangle_y = self.punchangle_y + 60 * sys_frametime;
+               if (self.punchangle_y > 0)
+                       self.punchangle_y = 0;
+       }
+
+       if (self.punchangle_z > 0)
+       {
+               self.punchangle_z = self.punchangle_z - 60 * sys_frametime;
+               if (self.punchangle_z < 0)
+                       self.punchangle_z = 0;
+       }
+       else if (self.punchangle_z < 0)
+       {
+               self.punchangle_z = self.punchangle_z + 60 * sys_frametime;
+               if (self.punchangle_z > 0)
+                       self.punchangle_z = 0;
+       }
+
        self.angles_x = self.punchangle_x;
        self.angles_y = self.punchangle_y + self.mangle_y;
        self.angles_z = self.punchangle_z;
-       self.mangle_y = self.mangle_y + 1.5;
+       self.mangle_y = self.mangle_y + 45 * sys_frametime;
 
-       self.cp_bob_origin_z = 4 * PI * (1 - cos(self.cp_bob_spd / 8));
-       self.cp_bob_spd = self.cp_bob_spd + 0.5;
+       self.cp_bob_origin_z = 4 * PI * (1 - cos(self.cp_bob_spd));
+       self.cp_bob_spd = self.cp_bob_spd + 1.875 * sys_frametime;
        if(self.cp_bob_dmg_z > 0)
-               self.cp_bob_dmg_z = self.cp_bob_dmg_z - 0.1;
+               self.cp_bob_dmg_z = self.cp_bob_dmg_z - 3 * sys_frametime;
        else
                self.cp_bob_dmg_z = 0;
        setorigin(self,self.cp_origin + self.cp_bob_origin + self.cp_bob_dmg);
@@ -1104,9 +1135,9 @@ void onslaught_controlpoint_icon_think()
                pointparticles(particleeffectnum("electricity_sparks"), self.origin + randompos('-10 -10 -20', '10 10 20'), '0 0 0', 1);
 
                if(random() > 0.8)
-                       asound(self, CH_PAIN, "onslaught/ons_spark1.wav", VOL_BASE, ATTN_NORM);
+                       sound(self, CH_PAIN, "onslaught/ons_spark1.wav", VOL_BASE, ATTN_NORM);
                else if (random() > 0.5)
-                       asound(self, CH_PAIN, "onslaught/ons_spark2.wav", VOL_BASE, ATTN_NORM);
+                       sound(self, CH_PAIN, "onslaught/ons_spark2.wav", VOL_BASE, ATTN_NORM);
        }
 };
 
@@ -1129,7 +1160,7 @@ void onslaught_controlpoint_icon_buildthink()
                self.health = self.max_health;
                self.count = autocvar_g_onslaught_cp_regen * sys_frametime; // slow repair rate from now on
                self.think = onslaught_controlpoint_icon_think;
-               asound(self, CH_TRIGGER, "onslaught/controlpoint_built.wav", VOL_BASE, ATTN_NORM);
+               sound(self, CH_TRIGGER, "onslaught/controlpoint_built.wav", VOL_BASE, ATTN_NORM);
                bprint(ColoredTeamName(self.team), " captured ", self.owner.message, " control point\n");
                self.owner.iscaptured = TRUE;
 
@@ -1192,7 +1223,7 @@ void onslaught_controlpoint_touch()
        e.think = onslaught_controlpoint_icon_buildthink;
        e.nextthink = time + sys_frametime;
        e.count = (e.max_health - e.health) * sys_frametime / autocvar_g_onslaught_cp_buildtime; // how long it takes to build
-       asound(e, CH_TRIGGER, "onslaught/controlpoint_build.wav", VOL_BASE, ATTN_NORM);
+       sound(e, CH_TRIGGER, "onslaught/controlpoint_build.wav", VOL_BASE, ATTN_NORM);
        self.team = e.team;
        self.colormap = e.colormap;
        WaypointSprite_UpdateBuildFinished(self.sprite, time + (e.max_health - e.health) / (e.count / sys_frametime));