]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into mand1nga/bot-navigation-fixes
authormand1nga <mand1nga@xonotic.org>
Sat, 18 Dec 2010 22:17:54 +0000 (19:17 -0300)
committermand1nga <mand1nga@xonotic.org>
Sat, 18 Dec 2010 22:17:54 +0000 (19:17 -0300)
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/bot/havocbot/roles.qc
qcsrc/server/bot/navigation.qc
qcsrc/server/t_jumppads.qc

index c1785a8d2754fc25c57fd527d38db2ecb79867ed..d8287df1696934aa3481f4cfccf2c4240e697c4e 100644 (file)
@@ -21,7 +21,8 @@ void havocbot_ai()
                }
                else
                {
-                       self.havocbot_role();
+                       if not(self.jumppadcount)
+                               self.havocbot_role();
                }
 
                // TODO: tracewalk() should take care of this job (better path finding under water)
@@ -452,14 +453,7 @@ void havocbot_movetogoal()
        // Handling of jump pads
        if(self.jumppadcount)
        {
-               if(self.flags & FL_ONGROUND)
-               {
-                       self.jumppadcount = FALSE;
-                       if(self.aistatus & AI_STATUS_OUT_JUMPPAD)
-                               self.aistatus &~= AI_STATUS_OUT_JUMPPAD;
-               }
-
-               // If got stuck on the jump pad try to reach the farther visible item
+               // If got stuck on the jump pad try to reach the farthest visible item
                if(self.aistatus & AI_STATUS_OUT_JUMPPAD)
                {
                        if(fabs(self.velocity_z)<50)
@@ -507,11 +501,20 @@ void havocbot_movetogoal()
                                local float threshold;
                                threshold = maxspeed * 0.2;
                                if(fabs(self.velocity_x) < threshold  &&  fabs(self.velocity_y) < threshold)
+                               {
+                                       dprint("Warning: ", self.netname, " got stuck on a jumppad, trying to get out of it now\n");
                                        self.aistatus |= AI_STATUS_OUT_JUMPPAD;
+                               }
                                return;
                        }
+
+                       // Don't chase players while using a jump pad
+                       if(self.goalcurrent.classname=="player" || self.goalstack01.classname=="player")
+                               return;
                }
        }
+       else if(self.aistatus & AI_STATUS_OUT_JUMPPAD)
+               self.aistatus &~= AI_STATUS_OUT_JUMPPAD;
 
        // If there is a trigger_hurt right below try to use the jetpack or make a rocketjump
        if(skill>6)
@@ -726,7 +729,7 @@ void havocbot_movetogoal()
                        // (only when the bot is on the ground or jumping intentionally)
                        self.aistatus &~= AI_STATUS_DANGER_AHEAD;
 
-                       if(trace_fraction == 1)
+                       if(trace_fraction == 1 && self.jumppadcount == 0)
                        if(self.flags & FL_ONGROUND || self.aistatus & AI_STATUS_RUNNING || self.BUTTON_JUMP == TRUE)
                        {
                                // Look downwards
index cfd0503985f5d2a39d25ea3dc606f49c9932da42..514c364ac723963e1617e17ee3bc5ac28287bbf6 100644 (file)
@@ -315,7 +315,6 @@ void havocbot_chooserole_ka()
 void havocbot_chooserole()
 {
        dprint("choosing a role...\n");
-       navigation_clearroute();
        self.bot_strategytime = 0;
        if (g_ctf)
                havocbot_chooserole_ctf();
index f3e5c26a8faf412d40aca941a619dddeb0f51e51..9e1a92a22249465776fba51660cd37bc25d96191 100644 (file)
@@ -897,6 +897,7 @@ void navigation_goalrating_start()
        self.navigation_jetpack_goal = world;
        navigation_bestrating = -1;
        self.navigation_hasgoals = FALSE;
+       navigation_clearroute();
        navigation_bestgoal = world;
        navigation_markroutes(world);
 };
index 36048e860129a1d79030939b3d8c2238828a8062..1e72b765a0a0b548de052f9d31accdfc8e906b0c 100644 (file)
@@ -127,9 +127,9 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht)
 
 void trigger_push_touch()
 {
-       if (self.active == ACTIVE_NOT) 
-               return;         
-               
+       if (self.active == ACTIVE_NOT)
+               return;
+
        // FIXME: add a .float for whether an entity should be tossed by jumppads
        if (!other.iscreature)
        if (other.classname != "corpse")
@@ -171,7 +171,7 @@ void trigger_push_touch()
                }
                local float ct;
                ct = clienttype(other);
-               if( ct == CLIENTTYPE_REAL)
+               if( ct == CLIENTTYPE_REAL || ct == CLIENTTYPE_BOT)
                {
                        local float i;
                        local float found;
@@ -185,11 +185,14 @@ void trigger_push_touch()
                                other.jumppadcount = other.jumppadcount + 1;
                        }
 
-                       if(self.message)
-                               centerprint(other, self.message);
+                       if(ct == CLIENTTYPE_REAL)
+                       {
+                               if(self.message)
+                                       centerprint(other, self.message);
+                       }
+                       else
+                               other.lastteleporttime = time;
                }
-               else if(ct == CLIENTTYPE_BOT)
-                       other.lastteleporttime = time;
                else
                        other.jumppadcount = TRUE;
 
@@ -289,8 +292,8 @@ void spawnfunc_trigger_push()
        SetMovedir ();
 
        EXACTTRIGGER_INIT;
-       
-       self.active = ACTIVE_ACTIVE;    
+
+       self.active = ACTIVE_ACTIVE;
        self.use = trigger_push_use;
        self.touch = trigger_push_touch;