+.float anticheat_jointime;
+
void mean_accumulate(entity e, .float a, .float c, float mean, float value, float weight)
{
if(weight == 0)
{
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
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;
}
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()
void anticheat_init()
{
self.anticheat_speedhack_offset = 0;
+ self.anticheat_jointime = servertime;
}
void anticheat_shutdown()
.float freezetag_frozen;
.float freezetag_beginrevive_time;
.float freezetag_revive_progress;
+
+.entity muzzle_flash;
+.float misc_bulletcounter; // replaces uzi & hlac bullet counter.
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;
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)
{
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;
}
{
// 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;
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);
}
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;
missile = spawn ();
missile.owner = self;
missile.classname = "hlacbolt";
- // missile.dmg = issecondary;
missile.bot_dodge = TRUE;
missile.bot_dodgerating = autocvar_g_balance_hlac_primary_damage;
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;
missile = spawn ();
missile.owner = self;
missile.classname = "hlacbolt";
- // missile.dmg = issecondary;
missile.bot_dodge = TRUE;
missile.bot_dodgerating = autocvar_g_balance_hlac_secondary_damage;
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;
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
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);
}
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()
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;
// 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);
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);
}
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);
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");
}
}
if (self.BUTTON_ATCK)
if (weapon_prepareattack(0, 0))
{
- self.uzi_bulletcounter = 0;
+ self.misc_bulletcounter = 0;
uzi_mode1_fire_auto();
}
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();
}
}
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);
}
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);
}