]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote branch 'origin/fruitiex/crbalance'
authorRudolf Polzer <divverent@alientrap.org>
Tue, 28 Dec 2010 20:42:10 +0000 (21:42 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Tue, 28 Dec 2010 20:42:10 +0000 (21:42 +0100)
qcsrc/server/anticheat.qc
qcsrc/server/defs.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/tturrets/units/unit_walker.qc
qcsrc/server/vehicles/spiderbot.qc
qcsrc/server/w_hlac.qc
qcsrc/server/w_uzi.qc

index 1da6ad3ec6732043e3ad6abcd755b5d2993990e5..284e72be94602cbb1f5ea85585f015d24b6e6040 100644 (file)
@@ -1,3 +1,5 @@
+.float anticheat_jointime;
+
 void mean_accumulate(entity e, .float a, .float c, float mean, float value, float weight)
 {
        if(weight == 0)
@@ -67,14 +69,14 @@ void anticheat_physics()
        {
                if(time < self.anticheat_div0_evade_offset)
                        self.anticheat_div0_evade_v_angle = self.v_angle;
-               MEAN_ACCUMULATE(anticheat_div0_evade, 1 - (self.anticheat_div0_evade_forward_initial * v_forward), 1);
+               MEAN_ACCUMULATE(anticheat_div0_evade, 0.5 - 0.5 * (self.anticheat_div0_evade_forward_initial * v_forward), 1);
        }
 
-       MEAN_ACCUMULATE(anticheat_div0_strafebot_old, movement_oddity(self.movement, self.anticheat_div0_strafebot_movement_prev), max(0, sys_frametime - frametime));
+       MEAN_ACCUMULATE(anticheat_div0_strafebot_old, movement_oddity(self.movement, self.anticheat_div0_strafebot_movement_prev), 1);
        self.anticheat_div0_strafebot_movement_prev = self.movement;
 
        if(vlen(self.anticheat_div0_strafebot_forward_prev))
-               MEAN_ACCUMULATE(anticheat_div0_strafebot_new, 1 - (self.anticheat_div0_strafebot_forward_prev * v_forward), max(0, sys_frametime - frametime));
+               MEAN_ACCUMULATE(anticheat_div0_strafebot_new, 0.5 - 0.5 * (self.anticheat_div0_strafebot_forward_prev * v_forward), 1);
        self.anticheat_div0_strafebot_forward_prev = v_forward;
 
        // generic speedhack detection: correlate anticheat_speedhack_movetime (UPDATED BEFORE THIS) and server time
@@ -88,7 +90,7 @@ void anticheat_physics()
                self.anticheat_speedhack_offset = f;
        else
        {
-               MEAN_ACCUMULATE(anticheat_speedhack, fabs(f - self.anticheat_speedhack_offset), 1);
+               MEAN_ACCUMULATE(anticheat_speedhack, max(0, f - self.anticheat_speedhack_offset), 1);
                self.anticheat_speedhack_offset += (f - self.anticheat_speedhack_offset) * frametime * 0.1;
        }
 
@@ -151,14 +153,26 @@ void anticheat_prethink()
        self.anticheat_div0_evade_offset = 0;
 }
 
+string anticheat_display(float f, float mi, float ma)
+{
+       string s;
+       s = ftos(f);
+       if(f <= mi)
+               return strcat(s, ":N");
+       if(f >= ma)
+               return strcat(s, ":Y");
+       return strcat(s, ":-");
+}
+
 void anticheat_report()
 {
        if(!autocvar_sv_eventlog)
                return;
+       GameLogEcho(strcat(":anticheat:_time:", ftos(self.playerid), ":", ftos(servertime - self.anticheat_jointime)));
        GameLogEcho(strcat(":anticheat:speedhack:", ftos(self.playerid), ":", ftos(MEAN_EVALUATE(anticheat_speedhack))));
        GameLogEcho(strcat(":anticheat:div0_strafebot_old:", ftos(self.playerid), ":", ftos(MEAN_EVALUATE(anticheat_div0_strafebot_old))));
        GameLogEcho(strcat(":anticheat:div0_strafebot_new:", ftos(self.playerid), ":", ftos(MEAN_EVALUATE(anticheat_div0_strafebot_new))));
-       GameLogEcho(strcat(":anticheat:div0_evade:", ftos(self.playerid), ":", ftos(MEAN_EVALUATE(anticheat_div0_evade))));
+       GameLogEcho(strcat(":anticheat:div0_evade:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_div0_evade), 0.15, 0.3)));
 }
 
 void anticheat_serverframe()
@@ -169,6 +183,7 @@ void anticheat_serverframe()
 void anticheat_init()
 {
        self.anticheat_speedhack_offset = 0;
+       self.anticheat_jointime = servertime;
 }
 
 void anticheat_shutdown()
index 96bc87cd3a905acc5d2e02228ffc579eed6cef2e..bbd554f5e375697c29dace35b7ab1abcf79fd3d7 100644 (file)
@@ -660,3 +660,6 @@ float serverflags;
 .float freezetag_frozen;
 .float freezetag_beginrevive_time;
 .float freezetag_revive_progress;
+
+.entity muzzle_flash;
+.float misc_bulletcounter;     // replaces uzi & hlac bullet counter.
index 02fa0f806fdd7b880351e5c323c1dc34f1ea197a..a770ec55eb5c0bbd1be910cddf08844b3203e179 100644 (file)
@@ -997,9 +997,7 @@ void readplayerstartcvars()
                start_armorvalue = 0;
                start_weapons = WEPBIT_MINSTANEX;
                weapon_action(WEP_MINSTANEX, WR_PRECACHE);
-               start_ammo_cells = cvar("g_minstagib_ammo_start");
                g_minstagib_invis_alpha = cvar("g_minstagib_invis_alpha");
-               start_ammo_fuel = cvar("g_start_ammo_fuel");
 
                if (g_minstagib_invis_alpha <= 0)
                        g_minstagib_invis_alpha = -1;
@@ -1017,7 +1015,12 @@ void readplayerstartcvars()
        if(!cvar("g_use_ammunition"))
                start_items |= IT_UNLIMITED_AMMO;
 
-       if(start_items & IT_UNLIMITED_WEAPON_AMMO)
+       if(g_minstagib)
+       {
+               start_ammo_cells = cvar("g_minstagib_ammo_start");
+               start_ammo_fuel = cvar("g_start_ammo_fuel");
+       }
+       else if(start_items & IT_UNLIMITED_WEAPON_AMMO)
        {
                for (j = WEP_FIRST; j <= WEP_LAST; ++j)
                {
index 5d37db4929d115b40b30d0b634162066e0d005b4..d1d48c46cdb82b4f5d90746ea7ab8c5d42afe041 100644 (file)
@@ -618,16 +618,16 @@ void walker_attack()
     sound (self, CHAN_WEAPON, "weapons/uzi_fire.wav", VOL_BASE, ATTN_NORM);
     fireBallisticBullet (self.tur_shotorg, self.tur_shotdir_updated,self.shot_spread, self.shot_speed, 5, self.shot_dmg, 0, self.shot_force, DEATH_TURRET, 0, 1, autocvar_g_balance_uzi_bulletconstant);
     endFireBallisticBullet();
-    if (self.uzi_bulletcounter == 2)
+    if (self.misc_bulletcounter == 2)
     {
 
                UziFlash();
                setattachment(self.muzzle_flash, self.tur_head, "tag_fire");
 
-        self.uzi_bulletcounter = 0;
+        self.misc_bulletcounter = 0;
     }
 
-    self.uzi_bulletcounter = self.uzi_bulletcounter + 1;
+    self.misc_bulletcounter = self.misc_bulletcounter + 1;
     self.tur_head.frame    = self.tur_head.frame + 1;
 }
 
index fa0781fa786519e736ef39d86fa7a9da1d7d7730..6743f73d2305aeffc3ae4b66c623945bcd5c06e6 100644 (file)
@@ -255,17 +255,17 @@ void spiderbot_miniguns_do()
         {
             // Fire bullets, alternating trails left<->right
             self = self.owner;
-            if(self.uzi_bulletcounter == 1)
+            if(self.misc_bulletcounter == 1)
             {
                 spiderbot_minigun_fire(self.vehicle.gun1, 0);
                 spiderbot_minigun_fire(self.vehicle.gun2, 1);
-                self.uzi_bulletcounter = 0;
+                self.misc_bulletcounter = 0;
             }
             else
             {
                 spiderbot_minigun_fire(self.vehicle.gun1, 1);
                 spiderbot_minigun_fire(self.vehicle.gun2, 0);
-                self.uzi_bulletcounter += 1;
+                self.misc_bulletcounter += 1;
             }
 
             self = self.vehicle;
index e3d3cb991883e1f209cb666712a89a3110f3693e..a07d54c2283e330741d84697ac72b50a7b33126d 100644 (file)
@@ -2,25 +2,17 @@
 REGISTER_WEAPON(HLAC, w_hlac, IT_CELLS, 6, WEP_FLAG_NORMAL | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "hlac", "hlac", "Heavy Laser Assault Cannon");
 #else
 #ifdef SVQC
-.float HLAC_bulletcounter;
-void W_HLAC_Touch (void)
-{
-       PROJECTILE_TOUCH;
 
-       self.event_damage = SUB_Null;
-
-    RadiusDamage (self, self.owner, autocvar_g_balance_hlac_primary_damage, autocvar_g_balance_hlac_primary_edgedamage, autocvar_g_balance_hlac_primary_radius, world, autocvar_g_balance_hlac_primary_force, self.projectiledeathtype, other);
-
-       remove (self);
-}
-
-void W_HLAC_Touch2 (void)
+void W_HLAC_Touch (void)
 {
        PROJECTILE_TOUCH;
 
        self.event_damage = SUB_Null;
-
-    RadiusDamage (self, self.owner, autocvar_g_balance_hlac_secondary_damage, autocvar_g_balance_hlac_secondary_edgedamage, autocvar_g_balance_hlac_secondary_radius, world, autocvar_g_balance_hlac_secondary_force, self.projectiledeathtype, other);
+       
+       if(self.projectiledeathtype & HITTYPE_SECONDARY)
+               RadiusDamage (self, self.owner, autocvar_g_balance_hlac_secondary_damage, autocvar_g_balance_hlac_secondary_edgedamage, autocvar_g_balance_hlac_secondary_radius, world, autocvar_g_balance_hlac_secondary_force, self.projectiledeathtype, other);
+       else
+               RadiusDamage (self, self.owner, autocvar_g_balance_hlac_primary_damage, autocvar_g_balance_hlac_primary_edgedamage, autocvar_g_balance_hlac_primary_radius, world, autocvar_g_balance_hlac_primary_force, self.projectiledeathtype, other);
 
        remove (self);
 }
@@ -35,7 +27,7 @@ void W_HLAC_Attack (void)
         self.ammo_cells = self.ammo_cells - autocvar_g_balance_hlac_primary_ammo;
     }
 
-    spread = autocvar_g_balance_hlac_primary_spread_min + (autocvar_g_balance_hlac_primary_spread_add * self.HLAC_bulletcounter);
+    spread = autocvar_g_balance_hlac_primary_spread_min + (autocvar_g_balance_hlac_primary_spread_add * self.misc_bulletcounter);
     spread = min(spread,autocvar_g_balance_hlac_primary_spread_max);
     if(self.crouch)
         spread = spread * autocvar_g_balance_hlac_primary_spread_crouchmod;
@@ -51,7 +43,6 @@ void W_HLAC_Attack (void)
        missile = spawn ();
        missile.owner = self;
        missile.classname = "hlacbolt";
-       // missile.dmg = issecondary;
        missile.bot_dodge = TRUE;
 
     missile.bot_dodgerating = autocvar_g_balance_hlac_primary_damage;
@@ -63,7 +54,7 @@ void W_HLAC_Attack (void)
        setsize(missile, '0 0 0', '0 0 0');
 
        W_SetupProjectileVelocity(missile, autocvar_g_balance_hlac_primary_speed, spread);
-       missile.angles = vectoangles (missile.velocity);
+       //missile.angles = vectoangles (missile.velocity); // csqc
 
        missile.touch = W_HLAC_Touch;
        missile.think = SUB_Remove;
@@ -95,7 +86,6 @@ void W_HLAC_Attack2f (void)
        missile = spawn ();
        missile.owner = self;
        missile.classname = "hlacbolt";
-       // missile.dmg = issecondary;
        missile.bot_dodge = TRUE;
 
     missile.bot_dodgerating = autocvar_g_balance_hlac_secondary_damage;
@@ -107,9 +97,9 @@ void W_HLAC_Attack2f (void)
        setsize(missile, '0 0 0', '0 0 0');
 
        W_SetupProjectileVelocity(missile, autocvar_g_balance_hlac_secondary_speed, spread);
-       missile.angles = vectoangles (missile.velocity);
+       //missile.angles = vectoangles (missile.velocity); // csqc
 
-       missile.touch = W_HLAC_Touch2;
+       missile.touch = W_HLAC_Touch;
        missile.think = SUB_Remove;
 
     missile.nextthink = time + autocvar_g_balance_hlac_secondary_lifetime;
@@ -161,7 +151,7 @@ void HLAC_fire1_02()
 
                ATTACK_FINISHED(self) = time + autocvar_g_balance_hlac_primary_refire * W_WeaponRateFactor();
                W_HLAC_Attack();
-               self.HLAC_bulletcounter = self.HLAC_bulletcounter + 1;
+               self.misc_bulletcounter = self.misc_bulletcounter + 1;
         weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
        }
        else
@@ -184,7 +174,7 @@ float w_hlac(float req)
                if (self.BUTTON_ATCK)
                if (weapon_prepareattack(0, autocvar_g_balance_hlac_primary_refire))
                {
-                       self.HLAC_bulletcounter = 0;
+                       self.misc_bulletcounter = 0;
                        W_HLAC_Attack();
                        weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
                }
index 2d50143deed1ddad0ca5623cca74363ed66ab9aa..50f59ff01e74cbce9010c7ca8b00446bf13612a8 100644 (file)
@@ -2,7 +2,6 @@
 REGISTER_WEAPON(UZI, w_uzi, IT_NAILS, 3, WEP_FLAG_NORMAL | WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_MID, "uzi", "uzi", "Machine Gun");
 #else
 #ifdef SVQC
-.entity muzzle_flash;
 
 // leilei's fancy muzzleflash stuff
 void Uzi_Flash_Go() 
@@ -40,17 +39,16 @@ void UziFlash()
        self.muzzle_flash.owner = self;
 }
 
-.float uzi_bulletcounter;
 void W_Uzi_Attack (float deathtype)
 {
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
        {
-               if (self.uzi_bulletcounter == 1)
+               if (self.misc_bulletcounter == 1)
                        self.ammo_nails = self.ammo_nails - autocvar_g_balance_uzi_first_ammo;
                else
                        self.ammo_nails = self.ammo_nails - autocvar_g_balance_uzi_sustained_ammo;
        }
-       W_SetupShot (self, autocvar_g_antilag_bullets && autocvar_g_balance_uzi_speed >= autocvar_g_antilag_bullets, 0, "weapons/uzi_fire.wav", CHAN_WEAPON, ((self.uzi_bulletcounter == 1) ? autocvar_g_balance_uzi_first_damage : autocvar_g_balance_uzi_sustained_damage));
+       W_SetupShot (self, autocvar_g_antilag_bullets && autocvar_g_balance_uzi_speed >= autocvar_g_antilag_bullets, 0, "weapons/uzi_fire.wav", CHAN_WEAPON, ((self.misc_bulletcounter == 1) ? autocvar_g_balance_uzi_first_damage : autocvar_g_balance_uzi_sustained_damage));
        if (!g_norecoil)
        {
                self.punchangle_x = random () - 0.5;
@@ -60,7 +58,7 @@ void W_Uzi_Attack (float deathtype)
        // this attack_finished just enforces a cooldown at the end of a burst
        ATTACK_FINISHED(self) = time + autocvar_g_balance_uzi_first_refire * W_WeaponRateFactor();
 
-       if (self.uzi_bulletcounter == 1)
+       if (self.misc_bulletcounter == 1)
                fireBallisticBullet(w_shotorg, w_shotdir, autocvar_g_balance_uzi_first_spread, autocvar_g_balance_uzi_speed, 5, autocvar_g_balance_uzi_first_damage, 0, autocvar_g_balance_uzi_first_force, deathtype, 0, 1, autocvar_g_balance_uzi_bulletconstant);
        else
                fireBallisticBullet(w_shotorg, w_shotdir, autocvar_g_balance_uzi_sustained_spread, autocvar_g_balance_uzi_speed, 5, autocvar_g_balance_uzi_sustained_damage, 0, autocvar_g_balance_uzi_sustained_force, deathtype, 0, 1, autocvar_g_balance_uzi_bulletconstant);
@@ -92,7 +90,7 @@ void uzi_fire1_02()
                        w_ready();
                        return;
                }
-               self.uzi_bulletcounter = self.uzi_bulletcounter + 1;
+               self.misc_bulletcounter = self.misc_bulletcounter + 1;
                W_Uzi_Attack(WEP_UZI);
                weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_uzi_sustained_refire, uzi_fire1_02);
        }
@@ -128,11 +126,11 @@ void uzi_mode1_fire_auto()
                self.punchangle_y = random () - 0.5;
        }
        
-       uzi_spread = bound(autocvar_g_balance_uzi_spread_min, autocvar_g_balance_uzi_spread_min + (autocvar_g_balance_uzi_spread_add * self.uzi_bulletcounter), autocvar_g_balance_uzi_spread_max);
+       uzi_spread = bound(autocvar_g_balance_uzi_spread_min, autocvar_g_balance_uzi_spread_min + (autocvar_g_balance_uzi_spread_add * self.misc_bulletcounter), autocvar_g_balance_uzi_spread_max);
        fireBallisticBullet(w_shotorg, w_shotdir, uzi_spread, autocvar_g_balance_uzi_speed, 5, autocvar_g_balance_uzi_sustained_damage, 0, autocvar_g_balance_uzi_sustained_force, WEP_UZI, 0, 1, autocvar_g_balance_uzi_bulletconstant);
        endFireBallisticBullet();
        
-       self.uzi_bulletcounter = self.uzi_bulletcounter + 1;
+       self.misc_bulletcounter = self.misc_bulletcounter + 1;
        
        pointparticles(particleeffectnum("uzi_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
@@ -168,13 +166,12 @@ void uzi_mode1_fire_burst()
        if (autocvar_g_casings >= 2) // casing code
                SpawnCasing (((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self);
 
-       self.uzi_bulletcounter = self.uzi_bulletcounter + 1;
-       if (self.uzi_bulletcounter == 0)
+       self.misc_bulletcounter = self.misc_bulletcounter + 1;
+       if (self.misc_bulletcounter == 0)
                weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_uzi_burst_refire2, w_ready);
        else
        {
                weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_uzi_burst_refire, uzi_mode1_fire_burst);
-               dprint("bullets:", ftos(self.uzi_bulletcounter),"\n");
        }
                
 }
@@ -197,7 +194,7 @@ float w_uzi(float req)
                        if (self.BUTTON_ATCK)
                        if (weapon_prepareattack(0, 0))
                        {                               
-                               self.uzi_bulletcounter = 0;
+                               self.misc_bulletcounter = 0;
                                uzi_mode1_fire_auto();
                        }
                        
@@ -214,7 +211,7 @@ float w_uzi(float req)
                                if not(self.items & IT_UNLIMITED_WEAPON_AMMO)   
                                        self.ammo_nails = self.ammo_nails - autocvar_g_balance_uzi_burst_ammo;
 
-                               self.uzi_bulletcounter = autocvar_g_balance_uzi_burst * -1;
+                               self.misc_bulletcounter = autocvar_g_balance_uzi_burst * -1;
                                uzi_mode1_fire_burst();
                        }
                }
@@ -224,7 +221,7 @@ float w_uzi(float req)
                        if (self.BUTTON_ATCK)
                        if (weapon_prepareattack(0, 0))
                        {
-                               self.uzi_bulletcounter = 1;
+                               self.misc_bulletcounter = 1;
                                W_Uzi_Attack(WEP_UZI); // sets attack_finished
                                weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_uzi_sustained_refire, uzi_fire1_02);
                        }
@@ -232,7 +229,7 @@ float w_uzi(float req)
                        if (self.BUTTON_ATCK2 && autocvar_g_balance_uzi_first)
                        if (weapon_prepareattack(1, 0))
                        {
-                               self.uzi_bulletcounter = 1;
+                               self.misc_bulletcounter = 1;
                                W_Uzi_Attack(WEP_UZI | HITTYPE_SECONDARY); // sets attack_finished
                                weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_uzi_first_refire, w_ready);
                        }