From 089097e353a7a6bb27a50e8f2a2113c8a8750700 Mon Sep 17 00:00:00 2001 From: div0 Date: Thu, 26 Mar 2009 08:42:11 +0000 Subject: [PATCH] Add a team check to trigger_teleport and trigger_push, for team-owned teleporters and jumppads (e.g. for onslaught). Team-owned jumppads can also be used as force fields that only one team can pass (use the INVERT_TEAM spawnflag for that). git-svn-id: svn://svn.icculus.org/nexuiz/trunk@6297 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/t_jumppads.qc | 11 +++++++++++ data/qcsrc/server/t_teleporters.qc | 12 ++++++++++++ data/scripts/entities.def | 12 ++++++++++-- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/data/qcsrc/server/t_jumppads.qc b/data/qcsrc/server/t_jumppads.qc index 421187b36..ad94051fb 100644 --- a/data/qcsrc/server/t_jumppads.qc +++ b/data/qcsrc/server/t_jumppads.qc @@ -8,6 +8,12 @@ void() SUB_UseTargets; float trigger_push_calculatevelocity_flighttime; +void trigger_push_use() +{ + if(teams_matter) + self.team = activator.team; +} + /* trigger_push_calculatevelocity @@ -134,6 +140,10 @@ void trigger_push_touch() if (other.deadflag && other.iscreature) return; + if(self.team) + if(!(self.spawnflags & 4) == !(self.team == other.team)) + return; + EXACTTRIGGER_TOUCH; if(self.target) @@ -259,6 +269,7 @@ void spawnfunc_trigger_push() EXACTTRIGGER_INIT; + self.use = trigger_push_use; self.touch = trigger_push_touch; // normal push setup diff --git a/data/qcsrc/server/t_teleporters.qc b/data/qcsrc/server/t_teleporters.qc index c1719b4d4..08d13a493 100644 --- a/data/qcsrc/server/t_teleporters.qc +++ b/data/qcsrc/server/t_teleporters.qc @@ -1,3 +1,9 @@ +void trigger_teleport_use() +{ + if(teams_matter) + self.team = activator.team; +} + void tdeath(entity player, entity teleporter, entity telefragger, vector telefragmin, vector telefragmax) { entity head; @@ -109,6 +115,10 @@ void Teleport_Touch (void) if (!other.flags & FL_CLIENT) // FIXME: Make missiles firable through the teleport too return; + if(self.team) + if(!(self.spawnflags & 4) == !(self.team == other.team)) + return; + EXACTTRIGGER_TOUCH; makevectors(self.enemy.mangle); @@ -220,6 +230,8 @@ void spawnfunc_trigger_teleport (void) EXACTTRIGGER_INIT; + self.use = trigger_teleport_use; + // this must be called to spawn the teleport waypoints for bots InitializeEntity(self, teleport_findtarget, INITPRIO_FINDTARGET); diff --git a/data/scripts/entities.def b/data/scripts/entities.def index 9ad88fa1d..150e6bb66 100644 --- a/data/scripts/entities.def +++ b/data/scripts/entities.def @@ -908,7 +908,7 @@ killtarget: remove all entities with this targetname when triggered NOTOUCH: the trigger can only be triggered by other entities, not by touching or firing (you should probably use trigger_relay or trigger_delay instead) */ -/*QUAKED trigger_push (1 .5 0) ? +/*QUAKED trigger_push (1 .5 0) ? - - INVERT_TEAM Jump pad. What else? Can be used in three ways: Nexuiz "target/height" way: put the target_position where the player should land, and tune height to get a nice jump path. A good starting value for height is 100. @@ -920,6 +920,10 @@ height: if height is 0, the (player's origin at the) apex of the jump will be at movedir: when target is not set, direction vector to push to speed: speed of jump pad (default: 1000) noise: sound to play when jump pad is used; default is misc/jumppad.wav; you can set it to "" to make the pad silent +team: team that owns this jump pad (5 = red, 14 = blue, etc) (when set, only this team can teleport) +targetname: when targeted by a func_button, pressing the button will reassign the teleporter to the team of the activator. +-------- SPAWNFLAGS -------- +INVERT_TEAM: the team that owns the teleporter will NOT jump when touching this */ /*QUAKED trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8) @@ -945,11 +949,15 @@ swamp_interval: interval of damage when in swamp (default is 1) swamp_slowdown: amount of slowdown caused by the swamp (default is 0.5) */ -/*QUAKED trigger_teleport (.5 .5 .5) ? +/*QUAKED trigger_teleport (.5 .5 .5) ? - - INVERT_TEAM Touching this will teleport players to the location of the targeted misc_teleporter_dest entity. Note that in Nexuiz, teleporters preserve momentum of the player using them. -------- KEYS -------- target: this must point to a misc_teleporter_dest entity. If it points to more than one, a destination is randomly selected on teleport. +team: team that owns this teleporter (5 = red, 14 = blue, etc) (when set, only this team can teleport) +targetname: when targeted by a func_button, pressing the button will reassign the teleporter to the team of the activator. +-------- SPAWNFLAGS -------- +INVERT_TEAM: the team that owns the teleporter will NOT teleport when touching this */ /*QUAKED weapon_crylink (1 0 .5) (-30 -30 0) (30 30 32) FLOATING -- 2.39.2