From: bones_was_here Date: Sat, 29 Aug 2020 05:44:04 +0000 (+1000) Subject: q3compat: make 'fast' trigger_hurt do damage every frame (no delay from other trigger... X-Git-Tag: xonotic-v0.8.5~352^2~36 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7187966327172a52c75e372d6119efcd22f97354;p=xonotic%2Fxonotic-data.pk3dir.git q3compat: make 'fast' trigger_hurt do damage every frame (no delay from other triggers), and some cleanup --- diff --git a/qcsrc/common/mapobjects/trigger/hurt.qc b/qcsrc/common/mapobjects/trigger/hurt.qc index 19447c41b..20c08feb1 100644 --- a/qcsrc/common/mapobjects/trigger/hurt.qc +++ b/qcsrc/common/mapobjects/trigger/hurt.qc @@ -11,6 +11,8 @@ void trigger_hurt_use(entity this, entity actor, entity trigger) .float triggerhurttime; void trigger_hurt_touch(entity this, entity toucher) { + if (!toucher.takedamage) + return; if (this.active != ACTIVE_ACTIVE) return; @@ -21,11 +23,10 @@ void trigger_hurt_touch(entity this, entity toucher) // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu) if (toucher.iscreature) { - if (toucher.takedamage) - if (toucher.triggerhurttime < time) + if (time >= toucher.triggerhurttime + ((q3compat && !(this.spawnflags & HURT_SLOW)) ? autocvar_sys_ticrate : 1)) { EXACTTRIGGER_TOUCH(this, toucher); - toucher.triggerhurttime = time + ((q3compat && !(this.spawnflags & HURT_SLOW)) ? 0.1 : 1); + toucher.triggerhurttime = time; entity own; own = this.enemy; @@ -40,14 +41,9 @@ void trigger_hurt_touch(entity this, entity toucher) } else if(toucher.damagedbytriggers) { - if(toucher.takedamage) - { - EXACTTRIGGER_TOUCH(this, toucher); - Damage(toucher, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, toucher.origin, '0 0 0'); - } + EXACTTRIGGER_TOUCH(this, toucher); + Damage(toucher, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, toucher.origin, '0 0 0'); } - - return; } /*QUAKED spawnfunc_trigger_hurt (.5 .5 .5) ?