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.
This commit is contained in:
cypress 2024-04-14 21:53:14 -07:00
parent aaca254c03
commit bc2aec1a96
4 changed files with 51 additions and 26 deletions

View file

@ -400,7 +400,7 @@ void() Zombie_Think = //called every frame for zombies
Effect_Fire(self.origin); Effect_Fire(self.origin);
if (self.ltime < time && self.onfire){ if (self.ltime < time && self.onfire){
DamageHandler(self, self.firer, 300, S_NORMAL); DamageHandler(self, self.firer, 300, S_FLAME);
self.ltime = time + 2; self.ltime = time + 2;
if (self.fire_timeout < time) if (self.fire_timeout < time)

View file

@ -426,16 +426,27 @@ void(entity attacker, float d_style) DieHandler =
if (attacker.classname == "player") { if (attacker.classname == "player") {
attacker.kills++; attacker.kills++;
if (d_style == S_HEADSHOT) {
addmoney(attacker, 100, true); switch(d_style) {
attacker.headshots++; case S_HEADSHOT:
} else if (d_style == S_NORMAL) { addmoney(attacker, 100, true);
addmoney(attacker, 60, true); attacker.headshots++;
} break;
else if (d_style == S_KNIFE){ case S_KNIFE:
addmoney(attacker, 130, true); addmoney(attacker, 130, true);
} else if (d_style == S_TESLA) { break;
addmoney(attacker, 50, true); 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;
} }
} }
} }

View file

@ -63,25 +63,38 @@ void(vector org, entity whodunit) Flame_Linger =
// //
void() Flame_Touch = 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); Flame_Linger(self.origin, self);
remove(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; return;
if (other.classname == "ai_zombie_head" || other.classname == "ai_zombie_larm"
|| other.classname == "ai_zombie_rarm") { // Guard this stuff behind first-light
other.owner.onfire = true; if (!target.onfire) {
other.owner.ltime = time + 2; // They're ours
other.owner.fire_timeout = time + 10; target.firer = self.owner;
addmoney(self.owner, 10, true);
} else if (other.classname == "ai_zombie" || other.classname == "ai_dog") { // Initialize next-light (this is done to make sure we arent
other.onfire = true; // doing intense fire damage right away)
other.firer = self.owner; target.ltime = time + 2;
other.ltime = time + 2;
other.fire_timeout = time + 10; // Start the Fire Effect
addmoney(self.owner, 10, true); 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;
} }
} }

View file

@ -268,6 +268,7 @@ float map_compatibility_mode;
#define S_EXPLOSIVE 5 #define S_EXPLOSIVE 5
#define S_ZAPPER 6 #define S_ZAPPER 6
#define S_TESLA 7 #define S_TESLA 7
#define S_FLAME 8
//Perk types //Perk types
#define P_JUG 1 #define P_JUG 1