From: bones_was_here Date: Fri, 3 Nov 2023 16:44:29 +0000 (+1000) Subject: Turrets: always run at server ticrate X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d9f2e88b9bdbbf22eee64b6d6447b6c970443664;p=xonotic%2Fxonotic-data.pk3dir.git Turrets: always run at server ticrate --- diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index 4c7ce5ab4..d8e2e9af2 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -297,7 +297,7 @@ void turret_respawn(entity this) this.volly_counter = this.shot_volly; this.ammo = this.ammo_max; - this.nextthink = time + this.ticrate; + this.nextthink = time; setthink(this, turret_think); this.SendFlags = TNSF_FULL_UPDATE; @@ -572,7 +572,7 @@ void turret_track(entity this) switch(this.track_type) { case TFL_TRACKTYPE_STEPMOTOR: - f_tmp = this.aim_speed * this.ticrate; // dgr/sec -> dgr/tic + f_tmp = this.aim_speed * frametime; // dgr/sec -> dgr/tic if (this.track_flags & TFL_TRACK_PITCH) { this.tur_head.angles_x += bound(-f_tmp,move_angle_x, f_tmp); @@ -599,7 +599,7 @@ void turret_track(entity this) return; case TFL_TRACKTYPE_FLUIDINERTIA: - f_tmp = this.aim_speed * this.ticrate; // dgr/sec -> dgr/tic + f_tmp = this.aim_speed * frametime; // dgr/sec -> dgr/tic move_angle_x = bound(-this.aim_speed, move_angle_x * this.track_accel_pitch * f_tmp, this.aim_speed); move_angle_y = bound(-this.aim_speed, move_angle_y * this.track_accel_rot * f_tmp, this.aim_speed); move_angle = (this.tur_head.avelocity * this.track_blendrate) + (move_angle * (1 - this.track_blendrate)); @@ -617,7 +617,7 @@ void turret_track(entity this) if (this.track_flags & TFL_TRACK_PITCH) { this.tur_head.avelocity_x = move_angle_x; - if((this.tur_head.angles_x + this.tur_head.avelocity_x * this.ticrate) > this.aim_maxpitch) + if((this.tur_head.angles_x + this.tur_head.avelocity_x * frametime) > this.aim_maxpitch) { this.tur_head.avelocity_x = 0; this.tur_head.angles_x = this.aim_maxpitch; @@ -625,7 +625,7 @@ void turret_track(entity this) this.SendFlags |= TNSF_ANG; } - if((this.tur_head.angles_x + this.tur_head.avelocity_x * this.ticrate) < -this.aim_maxpitch) + if((this.tur_head.angles_x + this.tur_head.avelocity_x * frametime) < -this.aim_maxpitch) { this.tur_head.avelocity_x = 0; this.tur_head.angles_x = -this.aim_maxpitch; @@ -639,7 +639,7 @@ void turret_track(entity this) { this.tur_head.avelocity_y = move_angle_y; - if((this.tur_head.angles_y + this.tur_head.avelocity_y * this.ticrate) > this.aim_maxrot) + if((this.tur_head.angles_y + this.tur_head.avelocity_y * frametime) > this.aim_maxrot) { this.tur_head.avelocity_y = 0; this.tur_head.angles_y = this.aim_maxrot; @@ -647,7 +647,7 @@ void turret_track(entity this) this.SendFlags |= TNSF_ANG; } - if((this.tur_head.angles_y + this.tur_head.avelocity_y * this.ticrate) < -this.aim_maxrot) + if((this.tur_head.angles_y + this.tur_head.avelocity_y * frametime) < -this.aim_maxrot) { this.tur_head.avelocity_y = 0; this.tur_head.angles_y = -this.aim_maxrot; @@ -1022,7 +1022,7 @@ void turret_fire(entity this) void turret_think(entity this) { - this.nextthink = time + this.ticrate; + this.nextthink = time; MUTATOR_CALLHOOK(TurretThink, this); @@ -1038,7 +1038,7 @@ void turret_think(entity this) // Handle ammo if (!(this.spawnflags & TSF_NO_AMMO_REGEN)) if (this.ammo < this.ammo_max) - this.ammo = min(this.ammo + this.ammo_recharge, this.ammo_max); + this.ammo = min(this.ammo + this.ammo_recharge * frametime, this.ammo_max); // Inactive turrets needs to run the think loop, // So they can handle animation and wake up if need be. @@ -1305,7 +1305,6 @@ bool turret_initialize(entity this, Turret tur) load_unit_settings(this, 0); if(!this.team || !teamplay) { this.team = FLOAT_MAX; } - if(!this.ticrate) { this.ticrate = ((this.turret_flags & TUR_FLAG_SUPPORT) ? 0.2 : 0.1); } if(!GetResource(this, RES_HEALTH)) { SetResourceExplicit(this, RES_HEALTH, 1000); } if(!this.shot_refire) { this.shot_refire = 1; } if(!this.tur_shotorg) { this.tur_shotorg = '50 0 50'; } @@ -1361,11 +1360,9 @@ bool turret_initialize(entity this, Turret tur) this.active = ACTIVE_ACTIVE; this.effects = EF_NODRAW; this.netname = tur.turret_name; - this.ticrate = bound(sys_frametime, this.ticrate, 60); this.max_health = GetResource(this, RES_HEALTH); this.target_validate_flags = this.target_select_flags; this.ammo = this.ammo_max; - this.ammo_recharge *= this.ticrate; this.solid = SOLID_BBOX; this.takedamage = DAMAGE_AIM; set_movetype(this, MOVETYPE_NOCLIP); @@ -1376,7 +1373,7 @@ bool turret_initialize(entity this, Turret tur) this.event_heal = turret_heal; this.use = turret_use; this.bot_attack = true; - this.nextthink = time + 1 + turret_count * sys_frametime; + this.nextthink = time + 1; this.reset = turret_reset; this.tur_head = new(turret_head); diff --git a/qcsrc/common/turrets/sv_turrets.qh b/qcsrc/common/turrets/sv_turrets.qh index 727a8cbc7..35192d08e 100644 --- a/qcsrc/common/turrets/sv_turrets.qh +++ b/qcsrc/common/turrets/sv_turrets.qh @@ -25,7 +25,6 @@ TR_PROPS_COMMON(X, , ) .float shot_volly_refire; // refire after completed volly */ -.float ticrate; // interal ai think rate .entity tur_head; // top part of the turret .entity tur_defend; // defend this entity .vector tur_shotorg; // shot origin diff --git a/qcsrc/common/turrets/turret/ewheel.qc b/qcsrc/common/turrets/turret/ewheel.qc index 7312d0f16..d5420aa0c 100644 --- a/qcsrc/common/turrets/turret/ewheel.qc +++ b/qcsrc/common/turrets/turret/ewheel.qc @@ -209,7 +209,7 @@ METHOD(EWheel, tr_setup, void(EWheel this, entity it)) // Convert from dgr / sec to dgr / tic it.tur_head.aim_speed = (autocvar_g_turrets_unit_ewheel_turnrate); - it.tur_head.aim_speed = it.tur_head.aim_speed / (1 / it.ticrate); + it.tur_head.aim_speed = it.tur_head.aim_speed / (1 / frametime); } #endif // SVQC diff --git a/qcsrc/common/turrets/turret/hk_weapon.qc b/qcsrc/common/turrets/turret/hk_weapon.qc index deb508bca..4bb856d95 100644 --- a/qcsrc/common/turrets/turret/hk_weapon.qc +++ b/qcsrc/common/turrets/turret/hk_weapon.qc @@ -33,7 +33,6 @@ METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, .entity missile.velocity = actor.tur_shotdir_updated * (actor.shot_speed * 0.75); missile.angles = vectoangles(missile.velocity); missile.cnt = time + 30; - missile.ticrate = max(autocvar_sys_ticrate, 0.05); missile.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_GUIDED_AI; if (!isPlayer) @@ -53,7 +52,7 @@ void turret_hk_missile_think(entity this) float pt_seek; // Pitch of Trace SEEK (How mutch to angele left, right up, down trace towards v_forward) float myspeed; - this.nextthink = time + this.ticrate; + this.nextthink = time; //if (this.cnt < time) // turret_hk_missile_explode(); diff --git a/qcsrc/common/turrets/turret/phaser_weapon.qc b/qcsrc/common/turrets/turret/phaser_weapon.qc index e4d09d193..b9547bedd 100644 --- a/qcsrc/common/turrets/turret/phaser_weapon.qc +++ b/qcsrc/common/turrets/turret/phaser_weapon.qc @@ -20,7 +20,6 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); } entity beam = new(PhaserTurret_beam); - beam.ticrate = 0.1; //autocvar_sys_ticrate; setmodel(beam, MDL_TUR_PHASER_BEAM); beam.effects = EF_LOWPRECISION; beam.solid = SOLID_NOT; @@ -29,7 +28,7 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity beam.shot_spread = time + 2; beam.nextthink = time; beam.owner = actor; - beam.shot_dmg = actor.shot_dmg / (actor.shot_speed / beam.ticrate); + beam.shot_dmg = actor.shot_dmg / (actor.shot_speed / frametime); beam.scale = actor.target_range / 256; set_movetype(beam, MOVETYPE_NONE); beam.enemy = actor.enemy; @@ -72,7 +71,7 @@ void beam_think(entity this) sound (this, CH_SHOTS_SINGLE, SND_TUR_PHASER, VOL_BASE, ATTEN_NORM); } - this.nextthink = time + this.ticrate; + this.nextthink = time; actor.attack_finished_single[0] = time + frametime; FireImoBeam ( actor, actor.tur_shotorg, diff --git a/qcsrc/common/turrets/turret/walker.qc b/qcsrc/common/turrets/turret/walker.qc index 051ea0acc..8e347f962 100644 --- a/qcsrc/common/turrets/turret/walker.qc +++ b/qcsrc/common/turrets/turret/walker.qc @@ -569,8 +569,6 @@ METHOD(WalkerTurret, tr_death, void(WalkerTurret this, entity it)) } METHOD(WalkerTurret, tr_setup, void(WalkerTurret this, entity it)) { - it.ticrate = 0.05; - // Respawn is called & first spawn to, to set team. need to make sure we do not move the initial spawn. if(it.move_movetype == MOVETYPE_WALK) {