From 2466b0f6464d077e18b01df1ac2e42b5ec01caae Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Sat, 4 Nov 2023 02:43:17 +1000 Subject: [PATCH] Monsters: always run at server ticrate --- monsters.cfg | 1 - qcsrc/common/monsters/sv_monsters.qc | 12 +++++------- qcsrc/common/monsters/sv_monsters.qh | 1 - 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/monsters.cfg b/monsters.cfg index 7b85e76c9..d6e10751f 100644 --- a/monsters.cfg +++ b/monsters.cfg @@ -95,7 +95,6 @@ set g_monster_golem_speed_walk 150 // {{{ Misc set g_monsters 1 set g_monsters_edit 0 -set g_monsters_think_delay 0.03333 set g_monsters_skill 1 "Monster skill (affecting some of their attributes). 1 - easy, 2 - medium, 3 - hard, 4 - insane, 5 - nightmare" set g_monsters_miniboss_chance 5 set g_monsters_miniboss_healthboost 100 diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 2371a4008..b71e1054d 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -943,7 +943,7 @@ void Monster_Remove(entity this) void Monster_Dead_Think(entity this) { - this.nextthink = time + this.ticrate; + this.nextthink = time; Monster mon = REGISTRY_GET(Monsters, this.monsterid); mon.mr_deadthink(mon, this); @@ -1252,7 +1252,7 @@ void Monster_Frozen_Think(entity this) { if (STAT(FROZEN, this) == FROZEN_TEMP_REVIVING) { - STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) + this.ticrate * this.revive_speed, 1); + STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) + frametime * this.revive_speed, 1); SetResourceExplicit(this, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, this) * this.max_health)); if (this.iceblock) this.iceblock.alpha = bound(0.2, 1 - STAT(REVIVE_PROGRESS, this), 1); @@ -1265,7 +1265,7 @@ void Monster_Frozen_Think(entity this) } else if (STAT(FROZEN, this) == FROZEN_TEMP_DYING) { - STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) - this.ticrate * this.revive_speed, 1); + STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) - frametime * this.revive_speed, 1); SetResourceExplicit(this, RES_HEALTH, max(0, autocvar_g_nades_ice_health + (this.max_health-autocvar_g_nades_ice_health) * STAT(REVIVE_PROGRESS, this))); if(!(this.spawnflags & MONSTERFLAG_INVINCIBLE) && this.sprite) @@ -1328,7 +1328,7 @@ void Monster_Enemy_Check(entity this) void Monster_Think(entity this) { setthink(this, Monster_Think); - this.nextthink = time + this.ticrate; + this.nextthink = time; if(this.monster_lifetime && time >= this.monster_lifetime) { @@ -1413,7 +1413,7 @@ bool Monster_Spawn_Setup(entity this) } setthink(this, Monster_Think); - this.nextthink = time + this.ticrate; + this.nextthink = time; if(MUTATOR_CALLHOOK(MonsterSpawn, this)) return false; @@ -1528,8 +1528,6 @@ bool Monster_Spawn(entity this, bool check_appear, Monster mon) setsize(this, RoundPerfectVector(mon.m_mins * this.scale), RoundPerfectVector(mon.m_maxs * this.scale)); this.view_ofs = '0 0 0.7' * (this.maxs_z * 0.5); - this.ticrate = bound(sys_frametime, ((!this.ticrate) ? autocvar_g_monsters_think_delay : this.ticrate), 60); - Monster_UpdateModel(this); if(!Monster_Spawn_Setup(this)) diff --git a/qcsrc/common/monsters/sv_monsters.qh b/qcsrc/common/monsters/sv_monsters.qh index 6a3fdd1c4..49c560e25 100644 --- a/qcsrc/common/monsters/sv_monsters.qh +++ b/qcsrc/common/monsters/sv_monsters.qh @@ -5,7 +5,6 @@ float autocvar_g_monsters; bool autocvar_g_monsters_edit; bool autocvar_g_monsters_sounds; -float autocvar_g_monsters_think_delay; int autocvar_g_monsters_max; int autocvar_g_monsters_max_perplayer; float autocvar_g_monsters_damageforcescale = 0.8; -- 2.39.2