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) {
switch(d_style) {
case S_HEADSHOT:
addmoney(attacker, 100, true); addmoney(attacker, 100, true);
attacker.headshots++; attacker.headshots++;
} else if (d_style == S_NORMAL) { break;
addmoney(attacker, 60, true); case S_KNIFE:
}
else if (d_style == S_KNIFE){
addmoney(attacker, 130, true); addmoney(attacker, 130, true);
} else if (d_style == S_TESLA) { break;
case S_TESLA:
addmoney(attacker, 50, true); 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)
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);
} }
// Some other entity
else {
// Only impact monsters (this also serves as a limb skip :D)
if (!(target.flags & FL_MONSTER))
return;
// 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;
} }
} }

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