X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Ft_teleporters.qc;h=2e64eadd77f6517e29b5ea873067082962c8ecab;hb=4aabbcbfcb5d689c7553db92012b7db84b867afa;hp=26b79c551cc96ec581836131dfcfd1b926bb91bf;hpb=18fcbe90782fb21a1163193f0e878a87ab3f4400;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/t_teleporters.qc b/qcsrc/server/t_teleporters.qc index 26b79c551..2e64eadd7 100644 --- a/qcsrc/server/t_teleporters.qc +++ b/qcsrc/server/t_teleporters.qc @@ -29,13 +29,14 @@ void trigger_teleport_use() float check_tdeath(entity player, vector org, vector telefragmin, vector telefragmax) { - TDEATHLOOP(org) + if (player.classname == "player" && player.health >= 1) { - if ((player.classname == "player") && (player.health >= 1)) + TDEATHLOOP(org) { - if(head.classname == "player") - if(head.health >= 1) - return 1; + if not(teams_matter && autocvar_g_telefrags_teamplay && head.team == player.team) + if(head.classname == "player") + if(head.health >= 1) + return 1; } } return 0; @@ -45,15 +46,16 @@ void tdeath(entity player, entity teleporter, entity telefragger, vector telefra { TDEATHLOOP(player.origin) { - if ((player.classname == "player") && (player.health >= 1)) + if (player.classname == "player" && player.health >= 1) { - if(head.classname == "player") - if(head.health >= 1) - ++tdeath_hit; - Damage (head, teleporter, telefragger, 10000, DEATH_TELEFRAG, head.origin, '0 0 0'); + if not(teams_matter && autocvar_g_telefrags_teamplay && head.team == player.team) + { + if(head.classname == "player") + if(head.health >= 1) + ++tdeath_hit; + Damage (head, teleporter, telefragger, 10000, DEATH_TELEFRAG, head.origin, '0 0 0'); + } } - else if (telefragger.health < 1) // corpses gib - Damage (head, teleporter, telefragger, 10000, DEATH_TELEFRAG, head.origin, '0 0 0'); else // dead bodies and monsters gib themselves instead of telefragging Damage (telefragger, teleporter, telefragger, 10000, DEATH_TELEFRAG, telefragger.origin, '0 0 0'); } @@ -68,13 +70,13 @@ void spawn_tdeath(vector v0, entity e, vector v) #define TELEPORT_FLAG_SOUND 1 #define TELEPORT_FLAG_PARTICLES 2 #define TELEPORT_FLAG_TDEATH 4 +#define TELEPORT_FLAG_FORCE_TDEATH 8 #define TELEPORT_FLAGS_WARPZONE 0 -#define TELEPORT_FLAGS_PORTAL (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES) +#define TELEPORT_FLAGS_PORTAL (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH | TELEPORT_FLAG_FORCE_TDEATH) #define TELEPORT_FLAGS_TELEPORTER (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH) void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags) { - entity oldself; entity telefragger; vector from; @@ -112,7 +114,7 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle if(player.classname == "player") { if(tflags & TELEPORT_FLAG_TDEATH) - if(player.takedamage && player.deadflag == DEAD_NO && !g_race && !g_cts && cvar("g_telefrags")) + if(player.takedamage && player.deadflag == DEAD_NO && !g_race && !g_cts && (autocvar_g_telefrags || (tflags & TELEPORT_FLAG_FORCE_TDEATH))) tdeath(player, teleporter, telefragger, telefragmin, telefragmax); // player no longer is on ground @@ -125,7 +127,7 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle if(teleporter.owner) { player.pusher = teleporter.owner; - player.pushltime = time + cvar("g_maxpushtime"); + player.pushltime = time + autocvar_g_maxpushtime; } else { @@ -133,14 +135,6 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle } player.lastteleporttime = time; - - // stop player name display - { - oldself = self; - self = player; - ClearSelectedPlayer(); - self = oldself; - } } } @@ -149,7 +143,11 @@ void Teleport_Touch (void) entity oldself, e; vector o; float p; + string s; + if (self.active != ACTIVE_ACTIVE) + return; + if (other.health < 1) return; if not(other.flags & FL_CLIENT) // FIXME: Make missiles firable through the teleport too @@ -176,7 +174,7 @@ void Teleport_Touch (void) for(e = world; (e = find(e, targetname, self.target)); ) { p = 1; - if(cvar("g_telefrags_avoid")) + if(autocvar_g_telefrags_avoid) { o = e.origin + '0 0 1' * (1 - other.mins_z - 24); if(check_tdeath(other, o, '0 0 0', '0 0 0')) @@ -198,21 +196,22 @@ void Teleport_Touch (void) if(e.speed) if(vlen(other.velocity) > e.speed) other.velocity = normalize(other.velocity) * max(0, e.speed); - if(cvar("g_teleport_maxspeed")) - if(vlen(other.velocity) > cvar("g_teleport_maxspeed")) - other.velocity = normalize(other.velocity) * max(0, cvar("g_teleport_maxspeed")); + if(autocvar_g_teleport_maxspeed) + if(vlen(other.velocity) > autocvar_g_teleport_maxspeed) + other.velocity = normalize(other.velocity) * max(0, autocvar_g_teleport_maxspeed); o = e.origin + '0 0 1' * (1 - other.mins_z - 24); TeleportPlayer(self, other, o, e.mangle, v_forward * vlen(other.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER); - if(e.target) - { - oldself = self; - activator = other; - self = e; - SUB_UseTargets(); - self = oldself; - } + activator = other; + s = self.target; self.target = string_null; + SUB_UseTargets(); + if not(self.target) self.target = s; + + oldself = self; + self = e; + SUB_UseTargets(); + self = oldself; } void spawnfunc_info_teleport_destination (void) @@ -287,7 +286,9 @@ void spawnfunc_trigger_teleport (void) self.angles = '0 0 0'; EXACTTRIGGER_INIT; - + + self.active = ACTIVE_ACTIVE; + self.use = trigger_teleport_use; // this must be called to spawn the teleport waypoints for bots @@ -307,5 +308,7 @@ void WarpZone_PostTeleportPlayer_Callback(entity pl) { // reset tracking of oldvelocity for impact damage (sudden velocity changes) pl.oldvelocity = pl.velocity; + // reset teleport time tracking too (or multijump can cause insane speeds) + pl.lastteleporttime = time; } }