float autocvar_g_physical_items;
float autocvar_g_physical_items_damageforcescale;
float autocvar_g_physical_items_reset;
+float autocvar_g_touchexplode_radius;
+float autocvar_g_touchexplode_damage;
+float autocvar_g_touchexplode_edgedamage;
+float autocvar_g_touchexplode_force;
setcolor(self, stof(autocvar_sv_defaultplayercolors));
}
-void PlayerTouchExplode(entity p1, entity p2)
-{
- vector org;
- org = (p1.origin + p2.origin) * 0.5;
- org_z += (p1.mins_z + p2.mins_z) * 0.5;
-
- te_explosion(org);
-
- entity e;
- e = spawn();
- setorigin(e, org);
- RadiusDamage(e, world, g_touchexplode_damage, g_touchexplode_edgedamage, g_touchexplode_radius, world, g_touchexplode_force, DEATH_TOUCHEXPLODE, world);
- remove(e);
-}
-
/*
=============
PutClientInServer
MUTATOR_CALLHOOK(PlayerUseKey);
}
-.float touchexplode_time;
-
/*
=============
PlayerPreThink
return;
}
- // FIXME from now on self.deadflag is always 0 (and self.health is never < 1)
- // so (self.deadflag == DEAD_NO) is always true in the code below
-
- if(g_touchexplode)
- if(time > self.touchexplode_time)
- if(self.classname == "player")
- if(self.deadflag == DEAD_NO)
- if not(IS_INDEPENDENT_PLAYER(self))
- FOR_EACH_PLAYER(other) if(self != other)
- {
- if(time > other.touchexplode_time)
- if(other.deadflag == DEAD_NO)
- if not(IS_INDEPENDENT_PLAYER(other))
- if(boxesoverlap(self.absmin, self.absmax, other.absmin, other.absmax))
- {
- PlayerTouchExplode(self, other);
- self.touchexplode_time = other.touchexplode_time = time + 0.2;
- }
- }
if(g_lms && !self.deadflag && autocvar_g_lms_campcheck_interval)
{
rigvel_z -= frametime * autocvar_sv_gravity; // 4x gravity plays better
rigvel_xy = vec2(rigvel);
- if(g_bugrigs_planar_movement_car_jumping && !g_touchexplode) // touchexplode is a better way to handle collisions
+ if(g_bugrigs_planar_movement_car_jumping)
mt = MOVE_NORMAL;
else
mt = MOVE_NOMONSTERS;
float g_bugrigs_speed_pow;
float g_bugrigs_steer;
-float g_touchexplode;
-float g_touchexplode_radius;
-float g_touchexplode_damage;
-float g_touchexplode_edgedamage;
-float g_touchexplode_force;
-
float sv_autotaunt;
float sv_taunt;
MUTATOR_ADD(mutator_spawn_near_teammate);
if(cvar("g_physical_items"))
MUTATOR_ADD(mutator_physical_items);
+ if(cvar("g_touchexplode"))
+ MUTATOR_ADD(mutator_touchexplode);
if(!g_minstagib)
{
if(cvar("g_invincible_projectiles"))
g_bugrigs_speed_pow = cvar("g_bugrigs_speed_pow");
g_bugrigs_steer = cvar("g_bugrigs_steer");
- g_touchexplode = cvar("g_touchexplode");
- g_touchexplode_radius = cvar("g_touchexplode_radius");
- g_touchexplode_damage = cvar("g_touchexplode_damage");
- g_touchexplode_edgedamage = cvar("g_touchexplode_edgedamage");
- g_touchexplode_force = cvar("g_touchexplode_force");
-
sv_clones = cvar("sv_clones");
sv_foginterval = cvar("sv_foginterval");
g_cloaked = cvar("g_cloaked");
--- /dev/null
+.float touchexplode_time;
+
+void PlayerTouchExplode(entity p1, entity p2)
+{
+ vector org;
+ org = (p1.origin + p2.origin) * 0.5;
+ org_z += (p1.mins_z + p2.mins_z) * 0.5;
+
+ sound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
+ pointparticles(particleeffectnum("explosion_small"), org, '0 0 0', 1);
+
+ entity e;
+ e = spawn();
+ setorigin(e, org);
+ RadiusDamage(e, world, autocvar_g_touchexplode_damage, autocvar_g_touchexplode_edgedamage, autocvar_g_touchexplode_radius, world, autocvar_g_touchexplode_force, DEATH_TOUCHEXPLODE, world);
+ remove(e);
+}
+
+MUTATOR_HOOKFUNCTION(touchexplode_PlayerThink)
+{
+ if(time > self.touchexplode_time)
+ if not(gameover)
+ if(IS_PLAYER(self))
+ if(self.deadflag == DEAD_NO)
+ if not(IS_INDEPENDENT_PLAYER(self))
+ FOR_EACH_PLAYER(other) if(self != other)
+ {
+ if(time > other.touchexplode_time)
+ if(other.deadflag == DEAD_NO)
+ if not(IS_INDEPENDENT_PLAYER(other))
+ if(boxesoverlap(self.absmin, self.absmax, other.absmin, other.absmax))
+ {
+ PlayerTouchExplode(self, other);
+ self.touchexplode_time = other.touchexplode_time = time + 0.2;
+ }
+ }
+
+ return FALSE;
+}
+
+MUTATOR_DEFINITION(mutator_touchexplode)
+{
+ MUTATOR_HOOK(PlayerPreThink, touchexplode_PlayerThink, CBC_ORDER_ANY);
+
+ return FALSE;
+}
MUTATOR_DECLARATION(mutator_physical_items);
MUTATOR_DECLARATION(mutator_vampire);
MUTATOR_DECLARATION(mutator_superspec);
+MUTATOR_DECLARATION(mutator_touchexplode);
MUTATOR_DECLARATION(sandbox);
mutators/mutator_physical_items.qc
mutators/sandbox.qc
mutators/mutator_superspec.qc
+mutators/mutator_touchexplode.qc
../warpzonelib/anglestransform.qc
../warpzonelib/mathlib.qc