]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
keepaway: fix bug where on certain maps the ball had no proper bbox
authorbones_was_here <bones_was_here@xonotic.au>
Mon, 22 May 2023 14:05:10 +0000 (00:05 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Thu, 25 May 2023 07:11:21 +0000 (17:11 +1000)
This made it annoyingly hard to pick up on eg tuhma, and it would land
in places it shouldn't fit.

qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc
qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qh

index 8b024dbc7bd025bb13175d0ffb814f790c8e8c1b..4d432b3e7be0de8d11c9f319522956f273ff32b3 100644 (file)
@@ -265,7 +265,7 @@ void ka_SpawnBall()
        IL_PUSH(g_kaballs, e);
        navigation_dynamicgoal_init(e, false);
 
-       InitializeEntity(e, ka_RespawnBall, INITPRIO_SETLOCATION); // is this the right priority? Neh, I have no idea.. Well-- it works! So.
+       ka_RespawnBall(e);
 }
 
 void ka_SpawnBalls(int ballcount)
@@ -293,14 +293,6 @@ void ka_Handler_CheckBall(entity this)
        this.nextthink = time;
 }
 
-void ka_Initialize() // run at the start of a match, initiates game mode
-{
-       g_kaballs = IL_NEW();
-       ka_Handler = new_pure(ka_Handler);
-       setthink(ka_Handler, ka_Handler_CheckBall);
-       ka_Handler.nextthink = time;
-}
-
 
 // ================
 // Bot player logic
index 2f1f0764397fe9308810a148e0f36ab5ee4a7559..38dd56197fc14028a50dee2241f2ed18707f3f36 100644 (file)
@@ -2,7 +2,8 @@
 
 #include <common/mutators/base.qh>
 #include <common/scores.qh>
-void ka_Initialize();
+
+void ka_Handler_CheckBall(entity this);
 
 IntrusiveList g_kaballs;
 REGISTER_MUTATOR(ka, false)
@@ -16,15 +17,16 @@ REGISTER_MUTATOR(ka, false)
             field(SP_KEEPAWAY_BCTIME, "bctime", SFL_SORT_PRIO_SECONDARY);
         });
 
-               ka_Initialize();
+               g_kaballs = IL_NEW();
+               entity ka_Handler = new_pure(ka_Handler);
+               setthink(ka_Handler, ka_Handler_CheckBall);
+               InitializeEntity(ka_Handler, ka_Handler_CheckBall, INITPRIO_SETLOCATION);
        }
        return false;
 }
 
 const int KA_BALL_COUNT = 1;
 
-entity ka_Handler;
-
 void(entity this) havocbot_role_ka_carrier;
 void(entity this) havocbot_role_ka_collector;