- fix the "teleporter causes 'sprint to non-client'" bug

- prevent building when a teleporter is too close to a wall
This commit is contained in:
Adam Olsen 2001-08-13 13:02:54 +00:00
parent 162a1e4caa
commit c662c418fe
4 changed files with 38 additions and 18 deletions

1
BUGS
View file

@ -4,7 +4,6 @@
- "has_sentry" should be a counter, not a flag (allows a second build if you hack and it gets roasted) - "has_sentry" should be a counter, not a flag (allows a second build if you hack and it gets roasted)
- there appears to be a window between when a teamkill curse respawn is disabled and when they're killed. it should be removed. - there appears to be a window between when a teamkill curse respawn is disabled and when they're killed. it should be removed.
- through some combination of respawning, respawn guard, and teleporters (not necesarily needed), it's possible to get stuck on another person - through some combination of respawning, respawn guard, and teleporters (not necesarily needed), it's possible to get stuck on another person
- if you build your teleporter too close to a wall, and it blows up, you get "tried to sprint to a non-client"
- hacked forcefields get you teamkills - hacked forcefields get you teamkills
- the "speed cheat" checker needs to be ripped out, it's kinda useless - the "speed cheat" checker needs to be ripped out, it's kinda useless
- sometimes rockets go through armor.. - sometimes rockets go through armor..

1
TODO
View file

@ -19,3 +19,4 @@ o "slave teslas"
o instead of not allowing two fastest legs when upgraded, restrict the health/armor you're allowed when you have fast legs o instead of not allowing two fastest legs when upgraded, restrict the health/armor you're allowed when you have fast legs
o make a seperate menu for detonating engineer buildings o make a seperate menu for detonating engineer buildings
o remove RPrint, since it's really kinda pointless and just makes the code ugliero change the color defines (eg DARKBLUE) to be the exact number, not number + 1 o remove RPrint, since it's really kinda pointless and just makes the code ugliero change the color defines (eg DARKBLUE) to be the exact number, not number + 1
o remove the old method for teleports checking if blocked, after confirming it's not needed. (moving platforms block it?)

View file

@ -527,8 +527,6 @@ float(entity obj, entity builder) CheckArea =
return TRUE; return TRUE;
}; };
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// rehashed version of TF_Build // rehashed version of TF_Build
void(float objtobuild) TeamFortress_Build = void(float objtobuild) TeamFortress_Build =
@ -697,6 +695,15 @@ void(float objtobuild) TeamFortress_Build =
obj.flags = obj.flags | FL_ONGROUND; obj.flags = obj.flags | FL_ONGROUND;
obj.movetype = MOVETYPE_TOSS; obj.movetype = MOVETYPE_TOSS;
if (objtobuild == BUILD_TELEPORTER) {
checkmove (obj.origin, '-32 -32 8', '32 32 72', obj.origin - '0 0 128', 0, self);
if (trace_fraction == 1 || trace_allsolid) {
sprint (self, PRINT_HIGH, "Not enough room for teleportation\n");
dremove (obj);
return;
}
}
obj.owner = self; obj.owner = self;
obj.classname = "timer"; obj.classname = "timer";
obj.netname = "build_timer"; obj.netname = "build_timer";
@ -711,6 +718,13 @@ void(float objtobuild) TeamFortress_Build =
setsize (obj, mins, maxs); setsize (obj, mins, maxs);
setorigin (obj, obj.origin); setorigin (obj, obj.origin);
if (objtobuild == BUILD_TELEPORTER)
if (Teleporter_CheckBlocked (obj)) {
sprint (self, PRINT_HIGH, "Not enough room for teleportation.\n");
dremove (obj);
return;
}
if (objtobuild==BUILD_TESLA) if (objtobuild==BUILD_TESLA)
{ {
obj.skin = self.team_no; obj.skin = self.team_no;

View file

@ -10,6 +10,7 @@ Functions for the teleporters
void() Teleporter_touch; void() Teleporter_touch;
void() Teleporter_Die; void() Teleporter_Die;
void() Teleporter_heat_think; void() Teleporter_heat_think;
integer (entity ent) Teleporter_CheckBlocked;
float(entity targ) Teleporter_check_person; float(entity targ) Teleporter_check_person;
#define TELEPORTER_CELLS 8 //How many cells to use on teleport #define TELEPORTER_CELLS 8 //How many cells to use on teleport
@ -145,9 +146,6 @@ float(entity targ) Teleporter_check_person =
void() Teleporter_heat_think = void() Teleporter_heat_think =
{ {
//CH used to reduce the heat and check pos //CH used to reduce the heat and check pos
local float pos, num;
local vector loc;
if (self.heat <= 0) if (self.heat <= 0)
self.heat = 0; self.heat = 0;
else else
@ -155,33 +153,41 @@ void() Teleporter_heat_think =
self.think = Teleporter_heat_think; //keep in loop self.think = Teleporter_heat_think; //keep in loop
self.nextthink = time + 1; self.nextthink = time + 1;
if (Teleporter_CheckBlocked(self)) {
sprint (self.real_owner, PRINT_HIGH, "Not enough space for teleportation.\n");
TF_T_Damage (self, world, world, self.health + 1, 0, 0);
}
};
integer (entity ent) Teleporter_CheckBlocked =
{
local float pos, num;
local vector loc;
//CH if spawnflags is >0 do extensive height checks b/c the pad just spawned. //CH if spawnflags is >0 do extensive height checks b/c the pad just spawned.
if (self.spawnflags > 0) { if (ent.spawnflags > 0) {
self.spawnflags = self.spawnflags - 1; ent.spawnflags = ent.spawnflags - 1;
num = 0; //16 checks num = 0; //16 checks
} }
else else
num = 15; //1 check num = 15; //1 check
while (num < 16) while (num < 16)
{ {
//sprint (self.real_owner, PRINT_HIGH, "Checking space!\n"); //sprint (ent.real_owner, PRINT_HIGH, "Checking space!\n");
loc = self.origin; loc = ent.origin;
loc_z = loc_z + (rint(random() * 8 + 1) * 8); //1-8 * 8 x+8 -> x+64
loc_x = loc_x + ((rint(random() * 3 + 1) * 16) - 32); loc_x = loc_x + ((rint(random() * 3 + 1) * 16) - 32);
loc_y = loc_y + ((rint(random() * 3 + 1) * 16) - 32); loc_y = loc_y + ((rint(random() * 3 + 1) * 16) - 32);
loc_z = loc_z + (rint(random() * 8 + 1) * 8); //1-8 * 8 x+8 -> x+64
pos = pointcontents(loc); pos = pointcontents(loc);
if (pos == CONTENTS_SOLID || pos == CONTENTS_SKY) if (pos == CONTENTS_SOLID || pos == CONTENTS_SKY)
{ return TRUE;
TF_T_Damage(self, world, world, self.health+1, 0, 0);
sprint (self.real_owner, PRINT_HIGH, "Not enough space for teleportation.\n");
num = 100; //Get out of loop
}
num = num + 1; num = num + 1;
} }
return FALSE;
}; };
//================ //================
void() Teleporter_Die = void() Teleporter_Die =
{ {