From bf43d3bacbf203b31200280d27a1a52912801795 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Thu, 30 Jun 2011 11:45:02 +0200 Subject: [PATCH] some fixes to what can be pushed, teleported, trigger_impulsed --- qcsrc/server/g_triggers.qc | 19 +------------ qcsrc/server/miscfunctions.qc | 21 ++++++++++++++ qcsrc/server/sv_main.qc | 53 +++++++++++++++++------------------ qcsrc/server/t_jumppads.qc | 12 +++++--- qcsrc/server/t_teleporters.qc | 9 ++++-- qcsrc/warpzonelib/server.qc | 2 +- 6 files changed, 64 insertions(+), 52 deletions(-) diff --git a/qcsrc/server/g_triggers.qc b/qcsrc/server/g_triggers.qc index 3ad43b0c3..98adee0c1 100644 --- a/qcsrc/server/g_triggers.qc +++ b/qcsrc/server/g_triggers.qc @@ -1377,24 +1377,7 @@ void trigger_impulse_touch1() if (self.active != ACTIVE_ACTIVE) return; - // FIXME: Better checking for what to push and not. - if not(other.iscreature) - if (other.classname != "corpse") - if (other.classname != "body") - if (other.classname != "gib") - if (other.classname != "missile") - if (other.classname != "rocket") - if (other.classname != "casing") - if (other.classname != "grenade") - if (other.classname != "plasma") - if (other.classname != "plasma_prim") - if (other.classname != "plasma_chain") - if (other.classname != "droppedweapon") - if (other.classname != "nexball_basketball") - if (other.classname != "nexball_football") - return; - - if (other.deadflag && other.iscreature) + if(!isPushable(other)) return; EXACTTRIGGER_TOUCH; diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index c34941e23..241dc3a99 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -3127,3 +3127,24 @@ float LostMovetypeFollow(entity ent) } return 0; } + +float isPushable(entity e) +{ + if(e.iscreature) + return TRUE; + switch(e.classname) + { + case "body": + case "corpse": + case "droppedweapon": + case "keepawayball": + case "nexball_basketball": + case "nexball_football": + return TRUE; + case "bullet": + return FALSE; + } + if (e.projectiledeathtype) + return TRUE; + return FALSE; +} diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index 0a2c04f93..fad33a8a1 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -84,40 +84,39 @@ void CreatureFrame (void) if (dm > 0) Damage (self, world, world, dm, DEATH_FALL, self.origin, '0 0 0'); } - } - if(autocvar_g_maxspeed > 0 && velocity_len > autocvar_g_maxspeed) - Damage (self, world, world, 100000, DEATH_SHOOTING_STAR, self.origin, '0 0 0'); - - // play stupid sounds - if (!vehic) // vehicles don't get footsteps - if (g_footsteps) - if (!gameover) - if (self.flags & FL_ONGROUND) - if (velocity_len > autocvar_sv_maxspeed * 0.6) - if (!self.deadflag) - if (time < self.lastground + 0.2) - { - if((time > self.nextstep) || (time < (self.nextstep - 10.0))) + if(autocvar_g_maxspeed > 0 && velocity_len > autocvar_g_maxspeed) + Damage (self, world, world, 100000, DEATH_SHOOTING_STAR, self.origin, '0 0 0'); + // play stupid sounds + if (g_footsteps) + if (!gameover) + if (self.flags & FL_ONGROUND) + if (velocity_len > autocvar_sv_maxspeed * 0.6) + if (!self.deadflag) + if (time < self.lastground + 0.2) { - self.nextstep = time + 0.3 + random() * 0.1; - trace_dphitq3surfaceflags = 0; - tracebox(self.origin, self.mins, self.maxs, self.origin - '0 0 1', MOVE_NOMONSTERS, self); - /* - if(trace_fraction == 1) - dprint("nohit\n"); - else - dprint(ftos(trace_dphitq3surfaceflags), "\n"); - */ - if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS) + if((time > self.nextstep) || (time < (self.nextstep - 10.0))) { - if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS) - GlobalSound(globalsound_metalstep, CHAN_PLAYER, VOICETYPE_PLAYERSOUND); + self.nextstep = time + 0.3 + random() * 0.1; + trace_dphitq3surfaceflags = 0; + tracebox(self.origin, self.mins, self.maxs, self.origin - '0 0 1', MOVE_NOMONSTERS, self); + /* + if(trace_fraction == 1) + dprint("nohit\n"); else - GlobalSound(globalsound_step, CHAN_PLAYER, VOICETYPE_PLAYERSOUND); + dprint(ftos(trace_dphitq3surfaceflags), "\n"); + */ + if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS) + { + if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS) + GlobalSound(globalsound_metalstep, CHAN_PLAYER, VOICETYPE_PLAYERSOUND); + else + GlobalSound(globalsound_step, CHAN_PLAYER, VOICETYPE_PLAYERSOUND); + } } } } + self.oldvelocity = self.velocity; } self = oldself; diff --git a/qcsrc/server/t_jumppads.qc b/qcsrc/server/t_jumppads.qc index 4712d5929..a61c6a79d 100644 --- a/qcsrc/server/t_jumppads.qc +++ b/qcsrc/server/t_jumppads.qc @@ -130,17 +130,21 @@ void trigger_push_touch() if (self.active == ACTIVE_NOT) return; - // FIXME: add a .float for whether an entity should be tossed by jumppads - if (!other.iscreature) - if (other.classname != "corpse") + if not(other.iscreature) if (other.classname != "body") - if (other.classname != "gib") if (other.classname != "casing") + if (other.classname != "corpse") if (other.classname != "droppedweapon") + if (other.classname != "gib") if (other.classname != "keepawayball") + if (other.classname != "nexball_basketball") + if (other.classname != "nexball_football") if (!other.projectiledeathtype || other.classname == "bullet") return; + if(!isPushable(other)) + return; + if (other.deadflag && other.iscreature) return; diff --git a/qcsrc/server/t_teleporters.qc b/qcsrc/server/t_teleporters.qc index a2836264d..5d87af3e2 100644 --- a/qcsrc/server/t_teleporters.qc +++ b/qcsrc/server/t_teleporters.qc @@ -148,9 +148,14 @@ void Teleport_Touch (void) if (self.active != ACTIVE_ACTIVE) return; - if (other.health < 1) + if not(other.iscreature) return; - if not(other.flags & FL_CLIENT) // FIXME: Make missiles firable through the teleport too + + // for gameplay: vehicles can't teleport + if (other.vehicle_flags & VHF_ISVEHICLE) + return; + + if (other.deadflag != DEAD_NO) return; if(self.team) diff --git a/qcsrc/warpzonelib/server.qc b/qcsrc/warpzonelib/server.qc index 2bcb579cc..861b2e01f 100644 --- a/qcsrc/warpzonelib/server.qc +++ b/qcsrc/warpzonelib/server.qc @@ -156,7 +156,7 @@ void WarpZone_Touch (void) return; // FIXME needs a better check to know what is safe to teleport and what not - if(other.movetype == MOVETYPE_NONE || other.movetype == MOVETYPE_FOLLOW) + if(other.movetype == MOVETYPE_NONE || other.movetype == MOVETYPE_FOLLOW || other.tag_entity) return; if(WarpZoneLib_ExactTrigger_Touch()) -- 2.39.2