From bc2aec1a96a506d8f8cd9916e920c88886baa29c Mon Sep 17 00:00:00 2001 From: cypress Date: Sun, 14 Apr 2024 21:53:14 -0700 Subject: [PATCH] SERVER: Clean up Flamethrower Logic Streamlines Flamethrower contact code to be faster/simpler as well as do some damage so Insta-Kill activates on time. --- source/server/ai/zombie_core.qc | 2 +- source/server/damage.qc | 31 ++++++++++++------- source/server/weapons/flamethrower.qc | 43 +++++++++++++++++---------- source/shared/defs/custom.qc | 1 + 4 files changed, 51 insertions(+), 26 deletions(-) diff --git a/source/server/ai/zombie_core.qc b/source/server/ai/zombie_core.qc index 444e06b..a807c49 100644 --- a/source/server/ai/zombie_core.qc +++ b/source/server/ai/zombie_core.qc @@ -400,7 +400,7 @@ void() Zombie_Think = //called every frame for zombies Effect_Fire(self.origin); if (self.ltime < time && self.onfire){ - DamageHandler(self, self.firer, 300, S_NORMAL); + DamageHandler(self, self.firer, 300, S_FLAME); self.ltime = time + 2; if (self.fire_timeout < time) diff --git a/source/server/damage.qc b/source/server/damage.qc index 68fe153..a3790f5 100644 --- a/source/server/damage.qc +++ b/source/server/damage.qc @@ -426,16 +426,27 @@ void(entity attacker, float d_style) DieHandler = if (attacker.classname == "player") { attacker.kills++; - if (d_style == S_HEADSHOT) { - addmoney(attacker, 100, true); - attacker.headshots++; - } else if (d_style == S_NORMAL) { - addmoney(attacker, 60, true); - } - else if (d_style == S_KNIFE){ - addmoney(attacker, 130, true); - } else if (d_style == S_TESLA) { - addmoney(attacker, 50, true); + + switch(d_style) { + case S_HEADSHOT: + addmoney(attacker, 100, true); + attacker.headshots++; + break; + case S_KNIFE: + addmoney(attacker, 130, true); + break; + case S_TESLA: + addmoney(attacker, 50, true); + break; + case S_FLAME: + addmoney(attacker, 50, true); + + // override their death sound (FIXME: make a new sound..) + sound(self, CHAN_BODY, "sounds/pu/drop.wav", 1, ATTN_NORM); + break; + default: + addmoney(attacker, 60, true); + break; } } } diff --git a/source/server/weapons/flamethrower.qc b/source/server/weapons/flamethrower.qc index dbaf5db..61e3cad 100644 --- a/source/server/weapons/flamethrower.qc +++ b/source/server/weapons/flamethrower.qc @@ -63,25 +63,38 @@ void(vector org, entity whodunit) Flame_Linger = // void() Flame_Touch = { - if (other == world) { + entity target = other; + + // Flame hit a BSP object, so persist/linger to wait for a catch. + if (target == world) { Flame_Linger(self.origin, self); remove(self); - } else { - if (other.onfire || other.owner.onfire) + } + // Some other entity + else { + // Only impact monsters (this also serves as a limb skip :D) + if (!(target.flags & FL_MONSTER)) return; - if (other.classname == "ai_zombie_head" || other.classname == "ai_zombie_larm" - || other.classname == "ai_zombie_rarm") { - other.owner.onfire = true; - other.owner.ltime = time + 2; - other.owner.fire_timeout = time + 10; - addmoney(self.owner, 10, true); - } else if (other.classname == "ai_zombie" || other.classname == "ai_dog") { - other.onfire = true; - other.firer = self.owner; - other.ltime = time + 2; - other.fire_timeout = time + 10; - addmoney(self.owner, 10, true); + + // Guard this stuff behind first-light + if (!target.onfire) { + // They're ours + target.firer = self.owner; + + // Initialize next-light (this is done to make sure we arent + // doing intense fire damage right away) + target.ltime = time + 2; + + // Start the Fire Effect + Effect_Fire(target.origin); + + // Only do 1 damage to trigger insta-kill damage. + DamageHandler(target, target.firer, 1, S_FLAME); } + + // Set the monster alight + target.onfire = true; + target.fire_timeout = time + 10; } } diff --git a/source/shared/defs/custom.qc b/source/shared/defs/custom.qc index 0cd7726..f9a52e9 100644 --- a/source/shared/defs/custom.qc +++ b/source/shared/defs/custom.qc @@ -268,6 +268,7 @@ float map_compatibility_mode; #define S_EXPLOSIVE 5 #define S_ZAPPER 6 #define S_TESLA 7 +#define S_FLAME 8 //Perk types #define P_JUG 1