diff --git a/src/k_botitem.cpp b/src/k_botitem.cpp index db9cd35f7..9aa7e39d7 100644 --- a/src/k_botitem.cpp +++ b/src/k_botitem.cpp @@ -1560,6 +1560,40 @@ static void K_BotItemInstashield(const player_t *player, ticcmd_t *cmd) } +/*-------------------------------------------------- + static void K_BotItemIceCube(player_t *player, ticcmd_t *cmd) + + Item usage for ice cubes. + + Input Arguments:- + player - Bot to do this for. + cmd - Bot's ticcmd to edit. + + Return:- + None +--------------------------------------------------*/ +static void K_BotItemIceCube(const player_t *player, ticcmd_t *cmd) +{ + ZoneScoped; + + if (leveltime % 7) + { + return; + } + + if (player->sneakertimer) + { + return; + } + + if (!P_IsObjectOnGround(player->mo)) + { + return; + } + + cmd->buttons |= BT_DRIFT; +} + /*-------------------------------------------------- static tic_t K_BotItemRouletteMashConfirm(const player_t *player) @@ -1617,6 +1651,12 @@ void K_BotItemUsage(const player_t *player, ticcmd_t *cmd, INT16 turnamt) { ZoneScoped; + if (player->icecube.frozen) + { + K_BotItemIceCube(player, cmd); + return; + } + if (player->itemflags & IF_USERINGS) { if (player->rings > 0) diff --git a/src/objects/frost-thrower.cpp b/src/objects/frost-thrower.cpp index bd200a64d..4158dd2b2 100644 --- a/src/objects/frost-thrower.cpp +++ b/src/objects/frost-thrower.cpp @@ -357,35 +357,9 @@ boolean Obj_IceCubeThink(mobj_t* mo) void Obj_IceCubeInput(player_t* player) { - // FIXME: this should be in the bot ticcmd code - auto bot_hack = [player] - { - if (!K_PlayerUsesBotMovement(player)) - { - return false; - } - - if (leveltime % 7) - { - return false; - } - - if (player->sneakertimer) - { - return false; - } - - if (!P_IsObjectOnGround(player->mo)) - { - return false; - } - - return true; - }; - // Must be mashing some buttons auto press = [player](buttoncode_t bt) { return (player->cmd.buttons & ~player->oldcmd.buttons) & bt; }; - if (!(press(BT_ACCELERATE) || press(BT_ATTACK) || press(BT_DRIFT) || bot_hack())) + if (!(press(BT_ACCELERATE) || press(BT_ATTACK) || press(BT_DRIFT))) { return; }