]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Use an intrusive list to find ladders in bot AI
authorMario <mario@smbclan.net>
Wed, 17 May 2017 21:12:00 +0000 (07:12 +1000)
committerMario <mario@smbclan.net>
Wed, 17 May 2017 21:12:00 +0000 (07:12 +1000)
qcsrc/common/triggers/func/ladder.qc
qcsrc/server/bot/default/navigation.qc
qcsrc/server/defs.qh

index 5ff2bdcc247133ac99b9c7a95f1ae4da3fe38a82..f4a7ffb02cae0d36338a447950d7fb62c5a69486 100644 (file)
@@ -49,6 +49,8 @@ void func_ladder_init(entity this)
 
 spawnfunc(func_ladder)
 {
+       IL_PUSH(g_ladders, this); // TODO: also func_water? bots currently loop through func_ladder only
+
        func_ladder_init(this);
 }
 
index b4503fa148a61e14164dc832d878fd40371ca615..fc97931541bc3bcdf5d8401ae7612b9e1b6da866 100644 (file)
@@ -181,12 +181,12 @@ bool tracewalk(entity e, vector start, vector m1, vector m2, vector end, float m
                                                if(autocvar_bot_debug_tracewalk)
                                                        debugnodestatus(trace_endpos, DEBUG_NODE_WARNING);
 
-                                               FOREACH_ENTITY_CLASS("func_ladder", true,
+                                               IL_EACH(g_ladders, it.classname == "func_ladder",
                                                        { it.solid = SOLID_BSP; });
 
                                                traceline( org, move, movemode, e);
 
-                                               FOREACH_ENTITY_CLASS("func_ladder", true,
+                                               IL_EACH(g_ladders, it.classname == "func_ladder",
                                                        { it.solid = SOLID_TRIGGER; });
 
                                                if ( trace_ent.classname == "door_rotating" || trace_ent.classname == "door")
index d8747d0b426010a3bb1e4e6034bd67b98b0ef45f..08f1d2016460e0fc7688d74ad620019ead3d47f9 100644 (file)
@@ -470,3 +470,6 @@ STATIC_INIT(g_damagedbycontents) { g_damagedbycontents = IL_NEW(); }
 
 IntrusiveList g_railgunhit;
 STATIC_INIT(g_railgunhit) { g_railgunhit = IL_NEW(); }
+
+IntrusiveList g_ladders;
+STATIC_INIT(g_ladders) { g_ladders = IL_NEW(); }