game-source/fbxa/bot_way.qc

883 lines
18 KiB
C++
Raw Normal View History

/***********************************************
* *
* FrikBot Waypoints *
* "The better than roaming AI" *
* *
***********************************************/
/*
This program is in the Public Domain. My crack legal
team would like to add:
RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS"
AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE
ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR
FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN
NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY
GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL,
EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC"
SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES.
You accept this software on the condition that you
indemnify and hold harmless Ryan "FrikaC" Smith from
any and all liability or damages to third parties,
including attorney fees, court costs, and other
related costs and expenses, arising out of your use
of this software irrespective of the cause of said
liability.
The export from the United States or the subsequent
reexport of this software is subject to compliance
with United States export control and munitions
control restrictions. You agree that in the event you
seek to export this software, you assume full
responsibility for obtaining all necessary export
licenses and approvals and for assuring compliance
with applicable reexport restrictions.
Any reproduction of this software must contain
this notice in its entirety.
*/
#include "libfrikbot.h"
// Waypoint Linking code ======================================================
float (entity e1, entity e2)
CheckLinked =
{
if ((e1 == e2) || (e2 == NIL) || (e1 == NIL))
return FALSE;
if (e1.target1 == e2) {
if (e1.b_aiflags & AI_TELELINK_1)
return 2;
2003-03-04 18:26:17 +00:00
else
return TRUE;
} else if (e1.target2 == e2) {
if (e1.b_aiflags & AI_TELELINK_2)
return 2;
2003-03-04 18:26:17 +00:00
else
return TRUE;
} else if (e1.target3 == e2) {
if (e1.b_aiflags & AI_TELELINK_3)
return 2;
2003-03-04 18:26:17 +00:00
else
return TRUE;
} else if (e1.target4 == e2) {
if (e1.b_aiflags & AI_TELELINK_4)
return 2;
2003-03-04 18:26:17 +00:00
else
return TRUE;
} else
return FALSE;
};
float (entity e1, entity e2)
LinkWays =
{
if ((e1 == e2) || (e2 == NIL) || (e1 == NIL))
return FALSE;
else if (CheckLinked (e1, e2))
return FALSE; // already linked!!!
2003-03-04 18:26:17 +00:00
if (e1.target1 == NIL) {
e1.target1 = e2;
return TRUE;
2003-03-04 18:26:17 +00:00
} else if (e1.target2 == NIL) {
e1.target2 = e2;
return TRUE;
2003-03-04 18:26:17 +00:00
} else if (e1.target3 == NIL) {
e1.target3 = e2;
return TRUE;
2003-03-04 18:26:17 +00:00
} else if (e1.target4 == NIL) {
e1.target4 = e2;
return TRUE;
} else return FALSE;
};
// Link Ways part 2, used only for teleporters
float (entity e1, entity e2)
TeleLinkWays =
{
if ((e1 == e2) || (e2 == NIL) || (e1 == NIL))
return FALSE;
else if (CheckLinked (e1, e2))
return FALSE; // already linked!!!
2003-03-04 18:26:17 +00:00
if (e1.target1 == NIL) {
e1.target1 = e2;
e1.b_aiflags |= AI_TELELINK_1;
return TRUE;
2003-03-04 18:26:17 +00:00
} else if (e1.target2 == NIL) {
e1.target2 = e2;
e1.b_aiflags |= AI_TELELINK_2;
return TRUE;
2003-03-04 18:26:17 +00:00
} else if (e1.target3 == NIL) {
e1.target3 = e2;
e1.b_aiflags |= AI_TELELINK_3;
return TRUE;
2003-03-04 18:26:17 +00:00
} else if (e1.target4 == NIL) {
e1.target4 = e2;
e1.b_aiflags |= AI_TELELINK_4;
return TRUE;
} else
return FALSE;
};
void (entity e1, entity e2)
UnlinkWays =
{
if ((e1 == e2) || (e2 == NIL) || (e1 == NIL))
return;
else if (!CheckLinked(e1, e2))
return;
2003-03-04 18:26:17 +00:00
if (e1.target1 == e2) {
e1.b_aiflags &= ~AI_TELELINK_1;
e1.target1 = NIL;
}
2003-03-04 18:26:17 +00:00
if (e1.target2 == e2) {
e1.b_aiflags &= ~AI_TELELINK_2;
e1.target2 = NIL;
}
2003-03-04 18:26:17 +00:00
if (e1.target3 == e2) {
e1.b_aiflags &= ~AI_TELELINK_3;
e1.target3 = NIL;
}
2003-03-04 18:26:17 +00:00
if (e1.target4 == e2) {
e1.b_aiflags &= ~AI_TELELINK_4;
e1.target4 = NIL;
}
};
/*
FindWaypoint
This is used quite a bit, by many different
functions big lag causer
Finds the closest, fisible, waypoint to e
*/
entity (entity start)
FindWayPoint =
{
local entity best, t;
local float dst, tdst;
local vector org;
org = realorigin (self);
t = way_head;
2003-03-04 18:26:17 +00:00
if (start != NIL) {
dst = vlen (start.origin - org);
best = start;
2003-03-04 18:26:17 +00:00
} else {
dst = 100000;
best = NIL;
}
while (t) {
// real players cut through ignore types
if (dst < 20)
return best;
2003-03-04 18:26:17 +00:00
if (!(t.b_aiflags & AI_IGNORE_TYPES) || self.ishuman) {
tdst = vlen (t.origin - org);
2003-03-04 18:26:17 +00:00
if (tdst < dst) {
if (sisible (t)) {
dst = tdst;
best = t;
}
}
}
t = t._next;
}
return best;
};
// Waypoint Spawning Code =====================================================
entity way_foot; // Ugh. Do I need a foot for this or not?
entity (vector org)
make_waypoint =
{
local entity point;
point = spawn ();
point.classname = "waypoint";
point.search_time = time; // don't double back for me;
point.solid = SOLID_TRIGGER;
point.movetype = MOVETYPE_NONE;
point.items = -1;
setorigin (point, org);
setsize (point, VEC_HULL_MIN, VEC_HULL_MAX);
waypoints++;
2003-03-04 18:26:17 +00:00
if (!way_head) {
way_head = point;
way_foot = point;
2003-03-04 18:26:17 +00:00
} else {
way_foot._next = point;
point._last = way_foot;
way_foot = point;
}
point.count = waypoints;
if (waypoint_mode > WM_LOADED) // editor modes
setmodel (point, "progs/s_bubble.spr");
return point;
};
/*
Dynamic Waypoint spawning and linking. Not
very good all things considered.
*/
void ()
DynamicWaypoint =
{
local entity t;
2003-02-18 23:12:03 +00:00
local float dist, dynlink = 0, dynpoint = 0, editor = 0;
2003-03-04 18:26:17 +00:00
if (self.teleport_time > self.portal_time) {
if (!(self.flags & FL_WATERJUMP)) {
self.dyn_flags = 2;
2003-03-04 18:26:17 +00:00
if (!self.ishuman) {
bot_lost (self.target1, TRUE);
self.enemy = NIL;
}
}
self.portal_time = self.teleport_time;
}
// stacking everything on waypoint_mode might've been good for the editor,
// but it sucks to beat hell for this code.
// convert waypoint_mode to something more usable..
2003-03-04 18:26:17 +00:00
if (waypoint_mode > WM_LOADED) {
if (self.ishuman) {
if (waypoint_mode == WM_EDITOR_DYNLINK)
dynlink = 1;
else if (waypoint_mode == WM_EDITOR_DYNAMIC)
dynlink = dynpoint = 1;
editor = 1;
}
2003-03-04 18:26:17 +00:00
} else if (waypoint_mode == WM_DYNAMIC)
dynlink = dynpoint = 1;
// if there's nothing for dynamic to do..
2003-03-04 18:26:17 +00:00
if (!dynpoint) {
if (!editor)
return;
}
// for speed sake, I won't have bots dynamic waypoint in coop
if (!self.ishuman)
if (coop)
return;
// don't waypoint in single player
if (max_clients < 2)
return;
// if you're dead
2003-03-04 18:26:17 +00:00
else if (self.health <= 0) {
if (dynpoint) {
if (self.current_way) {
if (pointcontents(self.origin) < -4) {
if (self.current_way.b_aiflags & AI_BLIND)
self.current_way.b_aiflags |= AI_PRECISION;
else
self.current_way.b_aiflags |= AI_BLIND;
}
}
}
self.dyn_dest = '0 0 0';
self.current_way = NIL;
self.dyn_flags = 0;
return;
}
// you shouldn't be making waypoints mid air
2003-03-04 18:26:17 +00:00
if (dynpoint) {
if (!((self.flags & FL_ONGROUND) || self.waterlevel == 3)) {
if (self.dyn_flags != 2) {
self.dyn_flags = 1;
}
return;
}
}
// keep from doing the rest of this every frame
if (self.dyn_time > time)
return;
self.dyn_time = time + 0.2;
// display the links for editor mode
2003-03-04 18:26:17 +00:00
if (editor) {
if (self.current_way) {
if (self.current_way.target1)
DeveloperLightning (self.current_way, self.current_way.target1,
self.current_way.b_aiflags & AI_TELELINK_1);
if (self.current_way.target2)
DeveloperLightning (self.current_way, self.current_way.target2,
self.current_way.b_aiflags & AI_TELELINK_2);
if (self.current_way.target3)
DeveloperLightning (self.current_way, self.current_way.target3,
self.current_way.b_aiflags & AI_TELELINK_3);
if (self.current_way.target4)
DeveloperLightning (self.current_way, self.current_way.target4,
self.current_way.b_aiflags & AI_TELELINK_4);
}
if (self.b_aiflags & AI_HOLD_SELECT)
return;
}
t = FindWayPoint (self.current_way);
2003-03-04 18:26:17 +00:00
if (t) {
dist = vlen (self.origin - t.origin);
2003-03-04 18:26:17 +00:00
if (dist < 192) {
if (dist < 64) {
if (t != self.current_way) {
if (dynlink) {
if (!self.dyn_flags) {
if (wisible (t, self.current_way))
LinkWays (t, self.current_way);
}
if (self.dyn_flags == 2)
TeleLinkWays (self.current_way, t);
else if (wisible (t, self.current_way))
LinkWays(self.current_way, t);
}
2003-03-04 18:26:17 +00:00
if (editor) {
setmodel(t, "progs/s_light.spr");
if (self.current_way)
setmodel(self.current_way, "progs/s_bubble.spr");
}
}
self.current_way = t;
self.dyn_flags = 0;
}
self.dyn_dest = self.origin + self.view_ofs;
return;
}
}
2003-03-04 18:26:17 +00:00
if (frik_recognize_plat(FALSE)) {
if (vlen(trace_ent.velocity) > 0) {
if (self.dyn_plat)
return;
self.dyn_plat = TRUE;
if (!self.dyn_flags)
self.dyn_flags = 1;
//bprint("on a plat!!!!!\n");
2003-03-04 18:26:17 +00:00
} else
self.dyn_plat = FALSE;
2003-03-04 18:26:17 +00:00
} else
self.dyn_plat = FALSE;
if (self.dyn_flags == 2)
self.dyn_dest = self.origin + self.view_ofs;
else if (self.dyn_dest == '0 0 0')
self.dyn_dest = self.origin + self.view_ofs;
if (!dynpoint)
return;
t = make_waypoint(self.dyn_dest);
2003-03-04 18:26:17 +00:00
if (!self.dyn_flags) {
if (wisible(t, self.current_way))
LinkWays(t, self.current_way);
}
if (self.dyn_flags == 2)
TeleLinkWays(self.current_way, t);
else if (wisible(t, self.current_way))
LinkWays(self.current_way, t);
2003-03-04 18:26:17 +00:00
if (editor) {
setmodel(t, "progs/s_light.spr");
if (self.current_way)
setmodel(self.current_way, "progs/s_bubble.spr");
}
self.current_way = t;
self.dyn_flags = 0;
self.dyn_dest = self.origin + self.view_ofs;
2003-03-04 18:26:17 +00:00
if (frik_recognize_plat(FALSE)) {
if (trace_ent.classname == "door")
t.b_aiflags = t.b_aiflags | AI_DOORFLAG;
}
};
/*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Waypoint Loading from file
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/
void() ClearAllWays =
{
local entity t, n;
t = way_head;
2003-03-04 18:26:17 +00:00
while(t) {
n = t._next;
remove(t);
t = n;
}
way_head = NIL;
way_foot = NIL;
waypoints = 0;
};
entity(float num) WaypointForNum =
{
local entity t;
if (!num)
return NIL;
t = way_head;
2003-03-04 18:26:17 +00:00
while (t) {
if (t.count == num)
return t;
t = t._next;
}
return NIL;
};
void() FixThisWaypoint =
{
self.enemy.target1 = WaypointForNum(self.enemy.b_pants);
2003-03-05 03:57:55 +00:00
self.enemy.target2 = WaypointForNum((float)self.enemy.b_skill);
self.enemy.target3 = WaypointForNum(self.enemy.b_shirt);
self.enemy.target4 = WaypointForNum(self.enemy.b_frags);
self.enemy = self.enemy._next;
self.nextthink = time;
2003-03-04 18:26:17 +00:00
if (self.enemy == NIL) {
remove(self);
fixer = NIL;
}
};
void() FixWaypoints =
{
if (!fixer)
fixer = spawn();
fixer.nextthink = time;
fixer.think = FixThisWaypoint;
fixer.enemy = way_head;
};
void(entity what) delete_waypoint =
{
local entity t;
if (way_head == what)
way_head = what._next;
if (way_foot == what)
way_foot = what._last;
if (what._last)
what._last._next = what._next;
if (what._next)
what._next._last = what._last;
waypoints = 0;
t = way_head;
2003-03-04 18:26:17 +00:00
while(t) {
t.count = waypoints = waypoints + 1;
if (CheckLinked(t, what))
UnlinkWays(t, what);
t = t._next;
}
if (self.current_way == what)
self.current_way = NIL;
remove(what);
};
/*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
FindRoute & FindThing used by the pathing code
in bot_ai.qc
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/
entity(string s) FindThing =
{
local entity t;
local float tdst, dst;
local entity best;
dst = 100000;
best = NIL;
t = find (NIL, classname, s);
2003-03-04 18:26:17 +00:00
while (t != NIL) {
tdst = vlen(((t.absmin + t.absmax) * 0.5) - self.origin);
2003-03-04 18:26:17 +00:00
if (tdst < dst) {
dst = tdst;
best = t;
}
t = find(t, classname, s);
}
return best;
};
/*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
FindRoute, this is a key function in the
pathing. The name is a bit misleading, this
code finds the closest waypoint that is part
of a route calculated by the begin_route and
end_route routines This is a definite path to
an object.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/
entity(entity lastone) FindRoute =
{
// kinda like FindWaypoint, only of this bots route though
local entity t, best;
local float dst, tdst, flag;
flag = ClientBitFlag(self.b_clientno);
t = way_head;
dst = 100000;
best = NIL;
2003-03-04 18:26:17 +00:00
while(t) {
tdst = vlen(t.origin - self.origin);
2003-03-04 18:26:17 +00:00
if ((tdst < dst) && (t.b_sound & flag)) {
if ((lastone == NIL) || (CheckLinked(lastone, t))) {
dst = tdst;
best = t;
}
}
t = t._next;
}
return best;
};
/*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Route & path table management
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/
void() ClearRouteTable =
{
// cleans up route table
local entity t;
t = way_head;
2003-03-04 18:26:17 +00:00
while (t) {
t. keys = FALSE;
t.enemy = NIL;
t.items = -1; // not in table
t = t._next;
}
};
void() ClearMyRoute =
{
local float flag;
local entity t;
flag = ClientBitFlag(self.b_clientno);
t = way_head;
2003-03-04 18:26:17 +00:00
while (t) {
t.b_sound = t.b_sound - (t.b_sound & flag);
t = t._next;
}
};
/*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Mark_path
After the route has been found, mark it with
bitflags so the table can be used for a
different bot.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/
void(entity this) mark_path =
{
local entity t, oself;
local float flag;
ClearMyRoute();
oself = self;
self = this;
t = FindWayPoint(this.current_way);
self = oself;
// FIXME
// ugh, better way to find players please!!!
if (this.classname != "player")
this.current_way = t;
2003-03-04 18:26:17 +00:00
if (t.enemy == NIL) {
bot_lost(this, FALSE);
if (waypoint_mode == WM_DYNAMIC)
self.route_failed = TRUE;
return;
}
flag = ClientBitFlag(self.b_clientno);
2003-03-04 18:26:17 +00:00
while(t) {
if (t.b_sound & flag)
return;
if (t == self.last_way)
return;
t.b_sound = t.b_sound | flag;
t = t.enemy;
}
};
/*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
WaypointThink
Calculates the routes. We use thinks to avoid
tripping the runaway loop counter
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/
void(entity e2, float b_bit) FollowLink =
{
local float dist;
if (self.b_aiflags & b_bit)
dist = self.items;
else
dist = vlen(self.origin - e2.origin) + self.items;
// check if this is an RJ link
2003-03-04 18:26:17 +00:00
if (e2.b_aiflags & AI_SUPER_JUMP) {
if (!bot_can_rj(route_table))
return;
}
if (e2.b_aiflags & AI_DIFFICULT)
dist = dist + 1000;
dist = dist + random() * 100; // add a little chaos
2003-03-04 18:26:17 +00:00
if ((dist < e2.items) || (e2.items == -1)) {
if (!e2.keys)
busy_waypoints = busy_waypoints + 1;
e2.keys = TRUE;
e2.items = dist;
e2.think = WaypointThink;
e2.nextthink = time;
e2.enemy = self;
}
};
void() WaypointThink =
{
local entity oself;
if (self.items == -1)
return;
// can you say ugly?
2003-03-04 18:26:17 +00:00
if (self.b_aiflags & AI_TRACE_TEST) {
if (self.target1) {
traceline(self.origin, self.target1.origin, TRUE, self);
if (trace_fraction == 1)
FollowLink(self.target1, AI_TELELINK_1);
}
2003-03-04 18:26:17 +00:00
if (self.target2) {
traceline(self.origin, self.target2.origin, TRUE, self);
if (trace_fraction == 1)
FollowLink(self.target2, AI_TELELINK_2);
}
2003-03-04 18:26:17 +00:00
if (self.target3) {
traceline(self.origin, self.target3.origin, TRUE, self);
if (trace_fraction == 1)
2003-03-04 18:26:17 +00:00
FollowLink(self.target3, AI_TELELINK_3);
}
2003-03-04 18:26:17 +00:00
if (self.target4) {
traceline(self.origin, self.target4.origin, TRUE, self);
if (trace_fraction == 1)
FollowLink(self.target4, AI_TELELINK_4);
}
2003-03-04 18:26:17 +00:00
} else {
if (self.target1)
FollowLink(self.target1, AI_TELELINK_1);
if (self.target2)
FollowLink(self.target2, AI_TELELINK_2);
if (self.target3)
FollowLink(self.target3, AI_TELELINK_3);
if (self.target4)
FollowLink(self.target4, AI_TELELINK_4);
}
busy_waypoints = busy_waypoints - 1;
self.keys = FALSE;
2003-03-04 18:26:17 +00:00
if (busy_waypoints <= 0) {
if (direct_route) {
oself = self;
self = route_table;
bot_get_path(self.target1, FALSE);
self = oself;
direct_route = FALSE;
}
}
};
/*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
begin_route and bot_get_path
PLEASE NOTE: bot_get_path replaces the old
calls to begin_route.
Routing isn't done all at once now, but in two
stages, the bot will calc a route *THEN*
choose a target, *THEN* mark a path.
Boy it's confusing.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/
float() begin_route =
{
if (busy_waypoints > 0)
return FALSE;
2003-03-04 18:26:17 +00:00
if (route_table != NIL) {
if (!route_table.ishuman) {
if (route_table.b_clientno != -1)
return FALSE;
}
}
route_table = self;
ClearRouteTable();
self.last_way = FindWayPoint(self.current_way);
2003-03-04 18:26:17 +00:00
if (self.last_way != NIL) {
self.last_way.items = vlen(self.last_way.origin - self.origin);
self.last_way.nextthink = time;
self.last_way.think = WaypointThink;
self.last_way.keys = TRUE;
busy_waypoints = 1;
return TRUE;
2003-03-04 18:26:17 +00:00
} else {
route_table = NIL;
busy_waypoints = 0;
return FALSE;
}
};
void(entity this, float direct) bot_get_path =
{
if (this == NIL)
return;
2003-03-04 18:26:17 +00:00
if (route_table == self) {
if (busy_waypoints <= 0) {
route_table = NIL;
mark_path(this);
}
return;
}
2003-03-04 18:26:17 +00:00
if (direct) {
if(begin_route())
direct_route = TRUE;
else
bot_lost(this, FALSE);
return;
}
};
/*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
BSP/QC Waypoint loading
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/
void() waypoint =
{
self.search_time = time;
self.solid = SOLID_TRIGGER;
self.movetype = MOVETYPE_NONE;
setorigin(self, self.origin);
setsize(self, VEC_HULL_MIN, VEC_HULL_MAX);
waypoints = waypoints + 1;
2003-03-04 18:26:17 +00:00
if (!way_head) {
way_head = self;
way_foot = self;
2003-03-04 18:26:17 +00:00
} else {
way_foot._next = self;
self._last = way_foot;
way_foot = self;
}
self.count = waypoints;
waypoint_mode = WM_LOADED;
2003-03-04 18:26:17 +00:00
if (self.count == 1) {
self.think = FixWaypoints; // wait until all bsp loaded points are spawned
self.nextthink = time;
}
};
void(vector org, vector bit1, float bit4, float flargs) make_way =
{
local entity y;
waypoint_mode = WM_LOADED;
y = make_waypoint(org);
y.b_aiflags = flargs;
y.b_pants = bit1_x;
2003-03-05 03:57:55 +00:00
y.b_skill = (integer)bit1_y;
y.b_shirt = bit1_z;
y.b_frags = bit4;
2003-03-04 18:26:17 +00:00
if (y.count == 1) {
y.think = FixWaypoints; // wait until all qc loaded points are spawned
y.nextthink = time;
}
};
/*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Temporary Marker code
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/
void(vector org) SpawnTempWaypoint =
{
local entity tep;
if (!self.temp_way)
self.temp_way = tep = spawn();
else
tep = self.temp_way;
tep.classname = "temp_waypoint";
tep.search_time = 0;
tep.solid = SOLID_TRIGGER;
tep.movetype = MOVETYPE_NOCLIP;
setorigin(tep, org);
target_add(tep);
setsize(tep, VEC_HULL_MIN, VEC_HULL_MAX); // FIXME: convert these to numerical
2003-02-18 23:12:03 +00:00
};