]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/navigation.qc
Merge master into qc_physics_prehax (blame TimePath if it's completely broken)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / navigation.qc
index 5c60050cf1c674fb4f6e8694b346e87d9122857a..ad0a8d761d4bdfff7a8aca640ebc8c6ddf8b8d51 100644 (file)
@@ -1,3 +1,14 @@
+#include "navigation.qh"
+#include "../_all.qh"
+
+#include "bot.qh"
+#include "waypoints.qh"
+
+#include "../t_items.qh"
+
+#include "../../common/constants.qh"
+#include "../../common/triggers/trigger/jumppads.qh"
+
 void bot_debug(string input)
 {
        switch(autocvar_bot_debug)
@@ -29,25 +40,25 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
        }
 
        move = end - start;
-       move_z = 0;
+       move.z = 0;
        org = start;
        dist = totaldist = vlen(move);
        dir = normalize(move);
        stepdist = 32;
-       ignorehazards = FALSE;
-       swimming = FALSE;
+       ignorehazards = false;
+       swimming = false;
 
        // Analyze starting point
        traceline(start, start, MOVE_NORMAL, e);
        if (trace_dpstartcontents & (DPCONTENTS_SLIME | DPCONTENTS_LAVA))
-               ignorehazards = TRUE;
+               ignorehazards = true;
        else
        {
                traceline( start, start + '0 0 -65536', MOVE_NORMAL, e);
                if (trace_dpstartcontents & (DPCONTENTS_SLIME | DPCONTENTS_LAVA))
                {
-                       ignorehazards = TRUE;
-                       swimming = TRUE;
+                       ignorehazards = true;
+                       swimming = true;
                }
        }
        tracebox(start, m1, m2, start, MOVE_NOMONSTERS, e);
@@ -58,7 +69,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                        debugnodestatus(start, DEBUG_NODE_FAIL);
 
                //print("tracewalk: ", vtos(start), " is a bad start\n");
-               return FALSE;
+               return false;
        }
 
        // Movement loop
@@ -73,7 +84,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                                debugnodestatus(org, DEBUG_NODE_SUCCESS);
 
                        //print("tracewalk: ", vtos(start), " can reach ", vtos(end), "\n");
-                       return TRUE;
+                       return true;
                }
                if(autocvar_bot_debug_tracewalk)
                        debugnode(org);
@@ -93,7 +104,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                                        debugnodestatus(org, DEBUG_NODE_FAIL);
 
                                //print("tracewalk: ", vtos(start), " hits a hazard when trying to reach ", vtos(end), "\n");
-                               return FALSE;
+                               return false;
                        }
                }
                if (trace_dpstartcontents & DPCONTENTS_LIQUIDSMASK)
@@ -106,9 +117,9 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
 
                        if (trace_fraction < 1)
                        {
-                               swimming = TRUE;
+                               swimming = true;
                                org = trace_endpos - normalize(org - trace_endpos) * stepdist;
-                               for(; org_z < end_z + self.maxs_z; org_z += stepdist)
+                               for (; org.z < end.z + self.maxs.z; org.z += stepdist)
                                {
                                                if(autocvar_bot_debug_tracewalk)
                                                        debugnode(org);
@@ -117,12 +128,12 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                                                        break;
                                }
 
-                               if not (pointcontents(org + '0 0 1') == CONTENT_EMPTY)
+                               if(pointcontents(org + '0 0 1') != CONTENT_EMPTY)
                                {
                                        if(autocvar_bot_debug_tracewalk)
                                                debugnodestatus(org, DEBUG_NODE_FAIL);
 
-                                       return FALSE;
+                                       return false;
                                        //print("tracewalk: ", vtos(start), " failed under water\n");
                                }
                                continue;
@@ -173,7 +184,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                                                        //print("tracewalk: ", vtos(start), " hit something when trying to reach ", vtos(end), "\n");
                                                        //te_explosion(trace_endpos);
                                                        //print(ftos(e.dphitcontentsmask), "\n");
-                                                       return FALSE; // failed
+                                                       return false; // failed
                                                }
                                        }
                                        else
@@ -196,8 +207,8 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                        {
                                float c;
                                c = pointcontents(org + '0 0 1');
-                               if not(c == CONTENT_WATER || c == CONTENT_LAVA || c == CONTENT_SLIME)
-                                       swimming = FALSE;
+                               if (!(c == CONTENT_WATER || c == CONTENT_LAVA || c == CONTENT_SLIME))
+                                       swimming = false;
                                else
                                        continue;
                        }
@@ -212,7 +223,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
        if(autocvar_bot_debug_tracewalk)
                debugnodestatus(org, DEBUG_NODE_FAIL);
 
-       return FALSE;
+       return false;
 }
 
 /////////////////////////////////////////////////////////////////////////////
@@ -223,7 +234,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
 void navigation_clearroute()
 {
        //print("bot ", etos(self), " clear\n");
-       self.navigation_hasgoals = FALSE;
+       self.navigation_hasgoals = false;
        self.goalcurrent = world;
        self.goalstack01 = world;
        self.goalstack02 = world;
@@ -347,26 +358,26 @@ float navigation_waypoint_will_link(vector v, vector org, entity ent, float walk
        dist = vlen(v - org);
        if (bestdist > dist)
        {
-               traceline(v, org, TRUE, ent);
+               traceline(v, org, true, ent);
                if (trace_fraction == 1)
                {
                        if (walkfromwp)
                        {
                                if (tracewalk(ent, v, PL_MIN, PL_MAX, org, bot_navigation_movemode))
-                                       return TRUE;
+                                       return true;
                        }
                        else
                        {
                                if (tracewalk(ent, org, PL_MIN, PL_MAX, v, bot_navigation_movemode))
-                                       return TRUE;
+                                       return true;
                        }
                }
        }
-       return FALSE;
+       return false;
 }
 
 // find the spawnfunc_waypoint near a dynamic goal such as a dropped weapon
-entity navigation_findnearestwaypoint_withdist(entity ent, float walkfromwp, float bestdist)
+entity navigation_findnearestwaypoint_withdist_except(entity ent, float walkfromwp, float bestdist, entity except)
 {
        entity waylist, w, best;
        vector v, org, pm1, pm2;
@@ -380,14 +391,14 @@ entity navigation_findnearestwaypoint_withdist(entity ent, float walkfromwp, flo
        while (w)
        {
                // if object is touching spawnfunc_waypoint
-               if(w != ent)
+               if(w != ent && w != except)
                        if (boxesoverlap(pm1, pm2, w.absmin, w.absmax))
                                return w;
                w = w.chain;
        }
 
        org = ent.origin + 0.5 * (ent.mins + ent.maxs);
-       org_z = ent.origin_z + ent.mins_z - PL_MIN_z; // player height
+       org.z = ent.origin.z + ent.mins.z - PL_MIN.z; // player height
        // TODO possibly make other code have the same support for bboxes
        if(ent.tag_entity)
                org = org + ent.tag_entity.origin;
@@ -408,9 +419,9 @@ entity navigation_findnearestwaypoint_withdist(entity ent, float walkfromwp, flo
                                vector wm1, wm2;
                                wm1 = w.origin + w.mins;
                                wm2 = w.origin + w.maxs;
-                               v_x = bound(wm1_x, org_x, wm2_x);
-                               v_y = bound(wm1_y, org_y, wm2_y);
-                               v_z = bound(wm1_z, org_z, wm2_z);
+                               v.x = bound(wm1_x, org.x, wm2_x);
+                               v.y = bound(wm1_y, org.y, wm2_y);
+                               v.z = bound(wm1_z, org.z, wm2_z);
                        }
                        else
                                v = w.origin;
@@ -426,7 +437,14 @@ entity navigation_findnearestwaypoint_withdist(entity ent, float walkfromwp, flo
 }
 entity navigation_findnearestwaypoint(entity ent, float walkfromwp)
 {
-       return navigation_findnearestwaypoint_withdist(ent, walkfromwp, 1050);
+       entity wp = navigation_findnearestwaypoint_withdist_except(ent, walkfromwp, 1050, world);
+       if (autocvar_g_waypointeditor_auto)
+       {
+               entity wp2 = navigation_findnearestwaypoint_withdist_except(ent, walkfromwp, 1050, wp);
+               if (wp && !wp2)
+                       wp.wpflags |= WAYPOINTFLAG_PROTECTED;
+       }
+       return wp;
 }
 
 // finds the waypoints near the bot initiating a navigation query
@@ -435,7 +453,7 @@ float navigation_markroutes_nearestwaypoints(entity waylist, float maxdist)
        entity head;
        vector v, m1, m2, diff;
        float c;
-//     navigation_testtracewalk = TRUE;
+//     navigation_testtracewalk = true;
        c = 0;
        head = waylist;
        while (head)
@@ -447,17 +465,17 @@ float navigation_markroutes_nearestwaypoints(entity waylist, float maxdist)
                                m1 = head.origin + head.mins;
                                m2 = head.origin + head.maxs;
                                v = self.origin;
-                               v_x = bound(m1_x, v_x, m2_x);
-                               v_y = bound(m1_y, v_y, m2_y);
-                               v_z = bound(m1_z, v_z, m2_z);
+                               v.x = bound(m1_x, v.x, m2_x);
+                               v.y = bound(m1_y, v.y, m2_y);
+                               v.z = bound(m1_z, v.z, m2_z);
                        }
                        else
                                v = head.origin;
                        diff = v - self.origin;
-                       diff_z = max(0, diff_z);
+                       diff.z = max(0, diff.z);
                        if (vlen(diff) < maxdist)
                        {
-                               head.wpconsidered = TRUE;
+                               head.wpconsidered = true;
                                if (tracewalk(self, self.origin, self.mins, self.maxs, v, bot_navigation_movemode))
                                {
                                        head.wpnearestpoint = v;
@@ -470,7 +488,7 @@ float navigation_markroutes_nearestwaypoints(entity waylist, float maxdist)
                }
                head = head.chain;
        }
-       //navigation_testtracewalk = FALSE;
+       //navigation_testtracewalk = false;
        return c;
 }
 
@@ -484,9 +502,9 @@ void navigation_markroutes_checkwaypoint(entity w, entity wp, float cost2, vecto
        {
                m1 = wp.absmin;
                m2 = wp.absmax;
-               v_x = bound(m1_x, p_x, m2_x);
-               v_y = bound(m1_y, p_y, m2_y);
-               v_z = bound(m1_z, p_z, m2_z);
+               v.x = bound(m1_x, p.x, m2_x);
+               v.y = bound(m1_y, p.y, m2_y);
+               v.z = bound(m1_z, p.z, m2_z);
        }
        else
                v = wp.origin;
@@ -509,7 +527,7 @@ void navigation_markroutes(entity fixed_source_waypoint)
        w = waylist = findchain(classname, "waypoint");
        while (w)
        {
-               w.wpconsidered = FALSE;
+               w.wpconsidered = false;
                w.wpnearestpoint = '0 0 0';
                w.wpcost = 10000000;
                w.wpfire = 0;
@@ -519,7 +537,7 @@ void navigation_markroutes(entity fixed_source_waypoint)
 
        if(fixed_source_waypoint)
        {
-               fixed_source_waypoint.wpconsidered = TRUE;
+               fixed_source_waypoint.wpconsidered = true;
                fixed_source_waypoint.wpnearestpoint = fixed_source_waypoint.origin + 0.5 * (fixed_source_waypoint.mins + fixed_source_waypoint.maxs);
                fixed_source_waypoint.wpcost = fixed_source_waypoint.dmg;
                fixed_source_waypoint.wpfire = 1;
@@ -544,16 +562,16 @@ void navigation_markroutes(entity fixed_source_waypoint)
                for(i=increment;!navigation_markroutes_nearestwaypoints(waylist, i)&&i<maxdistance;i+=increment);
        }
 
-       searching = TRUE;
+       searching = true;
        while (searching)
        {
-               searching = FALSE;
+               searching = false;
                w = waylist;
                while (w)
                {
                        if (w.wpfire)
                        {
-                               searching = TRUE;
+                               searching = true;
                                w.wpfire = 0;
                                cost = w.wpcost;
                                p = w.wpnearestpoint;
@@ -605,7 +623,7 @@ void navigation_markroutes_inverted(entity fixed_source_waypoint)
        w = waylist = findchain(classname, "waypoint");
        while (w)
        {
-               w.wpconsidered = FALSE;
+               w.wpconsidered = false;
                w.wpnearestpoint = '0 0 0';
                w.wpcost = 10000000;
                w.wpfire = 0;
@@ -615,7 +633,7 @@ void navigation_markroutes_inverted(entity fixed_source_waypoint)
 
        if(fixed_source_waypoint)
        {
-               fixed_source_waypoint.wpconsidered = TRUE;
+               fixed_source_waypoint.wpconsidered = true;
                fixed_source_waypoint.wpnearestpoint = fixed_source_waypoint.origin + 0.5 * (fixed_source_waypoint.mins + fixed_source_waypoint.maxs);
                fixed_source_waypoint.wpcost = fixed_source_waypoint.dmg; // the cost to get from X to fixed_source_waypoint
                fixed_source_waypoint.wpfire = 1;
@@ -626,16 +644,16 @@ void navigation_markroutes_inverted(entity fixed_source_waypoint)
                error("need to start with a waypoint\n");
        }
 
-       searching = TRUE;
+       searching = true;
        while (searching)
        {
-               searching = FALSE;
+               searching = false;
                w = waylist;
                while (w)
                {
                        if (w.wpfire)
                        {
-                               searching = TRUE;
+                               searching = true;
                                w.wpfire = 0;
                                cost = w.wpcost; // cost to walk from w to home
                                p = w.wpnearestpoint;
@@ -703,16 +721,16 @@ void navigation_routerating(entity e, float f, float rangebias)
                        float zdistance, xydistance, cost, t, fuel;
                        vector down, npa, npb;
 
-                       down = '0 0 -1' * (PL_MAX_z - PL_MIN_z) * 10;
+                       down = '0 0 -1' * (PL_MAX.z - PL_MIN.z) * 10;
 
                        do{
                                npa = pointa + down;
                                npb = pointb + down;
 
-                               if(npa_z<=self.absmax_z)
+                               if(npa.z<=self.absmax.z)
                                        break;
 
-                               if(npb_z<=e.absmax_z)
+                               if(npb.z<=e.absmax.z)
                                        break;
 
                                traceline(npa, npb, MOVE_NORMAL, self);
@@ -728,12 +746,12 @@ void navigation_routerating(entity e, float f, float rangebias)
                        // Rough estimation of fuel consumption
                        // (ignores acceleration and current xyz velocity)
                        xydistance = vlen(pointa - pointb);
-                       zdistance = fabs(pointa_z - self.origin_z);
+                       zdistance = fabs(pointa.z - self.origin.z);
 
                        t = zdistance / autocvar_g_jetpack_maxspeed_up;
                        t += xydistance / autocvar_g_jetpack_maxspeed_side;
                        fuel = t * autocvar_g_jetpack_fuel * 0.8;
-                       
+
                        bot_debug(strcat("jetpack ai: required fuel ", ftos(fuel), " self.ammo_fuel ", ftos(self.ammo_fuel), "\n"));
 
                        // enough fuel ?
@@ -775,25 +793,25 @@ void navigation_routerating(entity e, float f, float rangebias)
        {
                float search;
 
-               search = TRUE;
+               search = true;
 
                if(e.flags & FL_ITEM)
                {
-                       if not(e.flags & FL_WEAPON)
+                       if (!(e.flags & FL_WEAPON))
                        if(e.nearestwaypoint)
-                               search = FALSE;
+                               search = false;
                }
                else if (e.flags & FL_WEAPON)
                {
                        if(e.classname != "droppedweapon")
                        if(e.nearestwaypoint)
-                               search = FALSE;
+                               search = false;
                }
 
                if(search)
                if (time > e.nearestwaypointtimeout)
                {
-                       nwp = navigation_findnearestwaypoint(e, TRUE);
+                       nwp = navigation_findnearestwaypoint(e, true);
                        if(nwp)
                                e.nearestwaypoint = nwp;
                        else
@@ -801,11 +819,11 @@ void navigation_routerating(entity e, float f, float rangebias)
                                bot_debug(strcat("FAILED to find a nearest waypoint to '", e.classname, "' #", etos(e), "\n"));
 
                                if(e.flags & FL_ITEM)
-                                       e.blacklisted = TRUE;
+                                       e.blacklisted = true;
                                else if (e.flags & FL_WEAPON)
                                {
                                        if(e.classname != "droppedweapon")
-                                               e.blacklisted = TRUE;
+                                               e.blacklisted = true;
                                }
 
                                if(e.blacklisted)
@@ -848,9 +866,9 @@ float navigation_routetogoal(entity e, vector startposition)
 
        // if there is no goal, just exit
        if (!e)
-               return FALSE;
+               return false;
 
-       self.navigation_hasgoals = TRUE;
+       self.navigation_hasgoals = true;
 
        // put the entity on the goal stack
        //print("routetogoal ", etos(e), "\n");
@@ -858,11 +876,11 @@ float navigation_routetogoal(entity e, vector startposition)
 
        if(g_jetpack)
        if(e==self.navigation_jetpack_goal)
-               return TRUE;
+               return true;
 
        // if it can reach the goal there is nothing more to do
        if (tracewalk(self, startposition, PL_MIN, PL_MAX, (e.absmin + e.absmax) * 0.5, bot_navigation_movemode))
-               return TRUE;
+               return true;
 
        // see if there are waypoints describing a path to the item
        if(e.classname != "waypoint" || (e.wpflags & WAYPOINTFLAG_PERSONAL))
@@ -871,7 +889,7 @@ float navigation_routetogoal(entity e, vector startposition)
                e = e.enemy; // we already have added it, so...
 
        if(e == world)
-               return FALSE;
+               return false;
 
        for (;;)
        {
@@ -883,7 +901,7 @@ float navigation_routetogoal(entity e, vector startposition)
                        break;
        }
 
-       return FALSE;
+       return false;
 }
 
 // removes any currently touching waypoints from the goal stack
@@ -903,7 +921,7 @@ void navigation_poptouchedgoals()
                        if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
                        if(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && self.goalcurrent.owner==self)
                        {
-                               self.aistatus &~= AI_STATUS_WAYPOINT_PERSONAL_GOING;
+                               self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
                                self.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
                        }
                        navigation_poproute();
@@ -943,14 +961,14 @@ void navigation_poptouchedgoals()
        {
                if(vlen(self.origin - self.goalcurrent.origin)<150)
                {
-                       traceline(self.origin + self.view_ofs , self.goalcurrent.origin, TRUE, world);
+                       traceline(self.origin + self.view_ofs , self.goalcurrent.origin, true, world);
                        if(trace_fraction==1)
                        {
                                // Detect personal waypoints
                                if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
                                if(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && self.goalcurrent.owner==self)
                                {
-                                       self.aistatus &~= AI_STATUS_WAYPOINT_PERSONAL_GOING;
+                                       self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
                                        self.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
                                }
 
@@ -965,7 +983,7 @@ void navigation_poptouchedgoals()
                if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
                if(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && self.goalcurrent.owner==self)
                {
-                       self.aistatus &~= AI_STATUS_WAYPOINT_PERSONAL_GOING;
+                       self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
                        self.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
                }
 
@@ -981,7 +999,7 @@ void navigation_goalrating_start()
 
        self.navigation_jetpack_goal = world;
        navigation_bestrating = -1;
-       self.navigation_hasgoals = FALSE;
+       self.navigation_hasgoals = false;
        navigation_clearroute();
        navigation_bestgoal = world;
        navigation_markroutes(world);
@@ -997,16 +1015,16 @@ void navigation_goalrating_end()
        bot_debug(strcat("best goal ", self.goalcurrent.classname , "\n"));
 
        // If the bot got stuck then try to reach the farthest waypoint
-       if not (self.navigation_hasgoals)
+       if (!self.navigation_hasgoals)
        if (autocvar_bot_wander_enable)
        {
-               if not(self.aistatus & AI_STATUS_STUCK)
+               if (!(self.aistatus & AI_STATUS_STUCK))
                {
                        bot_debug(strcat(self.netname, " cannot walk to any goal\n"));
                        self.aistatus |= AI_STATUS_STUCK;
                }
 
-               self.navigation_hasgoals = FALSE; // Reset this value
+               self.navigation_hasgoals = false; // Reset this value
        }
 }
 
@@ -1016,7 +1034,7 @@ void botframe_updatedangerousobjects(float maxupdate)
        vector m1, m2, v, o;
        float c, d, danger;
        c = 0;
-       bot_dodgelist = findchainfloat(bot_dodge, TRUE);
+       bot_dodgelist = findchainfloat(bot_dodge, true);
        botframe_dangerwaypoint = find(botframe_dangerwaypoint, classname, "waypoint");
        while (botframe_dangerwaypoint != world)
        {
@@ -1027,14 +1045,14 @@ void botframe_updatedangerousobjects(float maxupdate)
                while (head)
                {
                        v = head.origin;
-                       v_x = bound(m1_x, v_x, m2_x);
-                       v_y = bound(m1_y, v_y, m2_y);
-                       v_z = bound(m1_z, v_z, m2_z);
+                       v.x = bound(m1_x, v.x, m2_x);
+                       v.y = bound(m1_y, v.y, m2_y);
+                       v.z = bound(m1_z, v.z, m2_z);
                        o = (head.absmin + head.absmax) * 0.5;
                        d = head.bot_dodgerating - vlen(o - v);
                        if (d > 0)
                        {
-                               traceline(o, v, TRUE, world);
+                               traceline(o, v, true, world);
                                if (trace_fraction == 1)
                                        danger = danger + d;
                        }
@@ -1052,10 +1070,10 @@ void navigation_unstuck()
 {
        float search_radius = 1000;
 
-       if not(autocvar_bot_wander_enable)
+       if (!autocvar_bot_wander_enable)
                return;
 
-       if not(bot_waypoint_queue_owner)
+       if (!bot_waypoint_queue_owner)
        {
                bot_debug(strcat(self.netname, " sutck, taking over the waypoints queue\n"));
                bot_waypoint_queue_owner = self;
@@ -1081,14 +1099,14 @@ void navigation_unstuck()
                }
                bot_waypoint_queue_goal = bot_waypoint_queue_goal.bot_waypoint_queue_nextgoal;
 
-               if not(bot_waypoint_queue_goal)
+               if (!bot_waypoint_queue_goal)
                {
                        if (bot_waypoint_queue_bestgoal)
                        {
                                bot_debug(strcat(self.netname, " stuck, reachable waypoint found, heading to it\n"));
                                navigation_routetogoal(bot_waypoint_queue_bestgoal, self.origin);
                                self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-                               self.aistatus &~= AI_STATUS_STUCK;
+                               self.aistatus &= ~AI_STATUS_STUCK;
                        }
                        else
                        {
@@ -1147,7 +1165,7 @@ void debugresetnodes()
 
 void debugnode(vector node)
 {
-       if not(IS_PLAYER(self))
+       if (!IS_PLAYER(self))
                return;
 
        if(debuglastnode=='0 0 0')