From: bones_was_here Date: Mon, 22 May 2023 14:05:10 +0000 (+1000) Subject: keepaway: fix bug where on certain maps the ball had no proper bbox X-Git-Tag: xonotic-v0.8.6~72^2~4 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=9e1e7a5a934788e2ed90fc6603ffabb3a9007915;p=xonotic%2Fxonotic-data.pk3dir.git keepaway: fix bug where on certain maps the ball had no proper bbox This made it annoyingly hard to pick up on eg tuhma, and it would land in places it shouldn't fit. --- diff --git a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc index 8b024dbc7..4d432b3e7 100644 --- a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc +++ b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc @@ -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 diff --git a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qh b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qh index 2f1f07643..38dd56197 100644 --- a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qh +++ b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qh @@ -2,7 +2,8 @@ #include #include -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;