From 5c1328b4afec5e8afbb3e2d6e66c89138c197ea3 Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Sat, 3 Jan 2026 02:38:14 -0300 Subject: [PATCH] fix(vbot): typo in method name: 'hasCreature' to 'hasCreatures' Replaces all occurrences of tile:hasCreature() with tile:hasCreatures() across multiple cavebot and targetbot modules for consistency and to match the updated API. ERROR: command failed: :1: attempt to call method 'hasCreature' (a nil value) --- mods/game_bot/default_configs/vBot_4.8/cavebot/actions.lua | 4 ++-- .../default_configs/vBot_4.8/cavebot/clear_tile.lua | 6 +++--- .../default_configs/vBot_4.8/cavebot/stand_lure.lua | 2 +- .../default_configs/vBot_4.8/targetbot/creature_attack.lua | 4 ++-- .../default_configs/vBot_4.8/vBot/new_cavebot_lib.lua | 2 +- mods/game_bot/default_configs/vBot_4.8/vBot/pushmax.lua | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mods/game_bot/default_configs/vBot_4.8/cavebot/actions.lua b/mods/game_bot/default_configs/vBot_4.8/cavebot/actions.lua index eca03e9378..23a8808409 100644 --- a/mods/game_bot/default_configs/vBot_4.8/cavebot/actions.lua +++ b/mods/game_bot/default_configs/vBot_4.8/cavebot/actions.lua @@ -45,7 +45,7 @@ onTextMessage(function(mode, text) local tiles = getNearTiles(pos()) for i, tile in ipairs(tiles) do - if not tile:hasCreature() and tile:isWalkable() and #tile:getItems() > 9 then + if not tile:hasCreatures() and tile:isWalkable() and #tile:getItems() > 9 then local topThing = tile:getTopThing() if not isInPz() then return useWith(3197, tile:getTopThing()) -- disintegrate @@ -359,7 +359,7 @@ CaveBot.registerAction("goto", "green", function(value, retries, prev) local tile = g_map.getTile(nextPos) if tile then - if tile:hasCreature() then + if tile:hasCreatures() then local creature = tile:getCreatures()[1] local hppc = creature:getHealthPercent() if creature:isMonster() and (hppc and hppc > 0) and (oldTibia or creature:getType() < 3) then diff --git a/mods/game_bot/default_configs/vBot_4.8/cavebot/clear_tile.lua b/mods/game_bot/default_configs/vBot_4.8/cavebot/clear_tile.lua index 2a46f84b9a..7938b2810e 100644 --- a/mods/game_bot/default_configs/vBot_4.8/cavebot/clear_tile.lua +++ b/mods/game_bot/default_configs/vBot_4.8/cavebot/clear_tile.lua @@ -39,7 +39,7 @@ CaveBot.Extensions.ClearTile.setup = function() local tPos = tile:getPosition() -- no items on tile and walkability means we are done - if tile:isWalkable() and tile:getTopUseThing():isNotMoveable() and not tile:hasCreature() and not doors then + if tile:isWalkable() and tile:getTopUseThing():isNotMoveable() and not tile:hasCreatures() and not doors then if stand then if not CaveBot.MatchPosition(tPos, 0) then CaveBot.GoTo(tPos, 0) @@ -60,7 +60,7 @@ CaveBot.Extensions.ClearTile.setup = function() end -- monster - if tile:hasCreature() then + if tile:hasCreatures() then local c = tile:getCreatures()[1] if c:isMonster() then attack(c) @@ -81,7 +81,7 @@ CaveBot.Extensions.ClearTile.setup = function() -- player -- push creature - if tile:hasCreature() then + if tile:hasCreatures() then local c = tile:getCreatures()[1] if c and c:isPlayer() then diff --git a/mods/game_bot/default_configs/vBot_4.8/cavebot/stand_lure.lua b/mods/game_bot/default_configs/vBot_4.8/cavebot/stand_lure.lua index 9b0c1db872..114d03ec61 100644 --- a/mods/game_bot/default_configs/vBot_4.8/cavebot/stand_lure.lua +++ b/mods/game_bot/default_configs/vBot_4.8/cavebot/stand_lure.lua @@ -104,7 +104,7 @@ CaveBot.Extensions.StandLure.setup = function() local tile = g_map.getTile(nextPos) if tile then - if tile:hasCreature() then + if tile:hasCreatures() then local creature = tile:getCreatures()[1] local hppc = creature:getHealthPercent() if creature:isMonster() and (hppc and hppc > 0) and (oldTibia or creature:getType() < 3) then diff --git a/mods/game_bot/default_configs/vBot_4.8/targetbot/creature_attack.lua b/mods/game_bot/default_configs/vBot_4.8/targetbot/creature_attack.lua index 636e9429fc..f4232bf2d7 100644 --- a/mods/game_bot/default_configs/vBot_4.8/targetbot/creature_attack.lua +++ b/mods/game_bot/default_configs/vBot_4.8/targetbot/creature_attack.lua @@ -11,7 +11,7 @@ function getWalkableTilesCount(position) local count = 0 for i, tile in pairs(getNearTiles(position)) do - if tile:isWalkable() or tile:hasCreature() then + if tile:isWalkable() or tile:hasCreatures() then count = count + 1 end end @@ -29,7 +29,7 @@ function rePosition(minTiles) if playerTilesCount > minTiles then return end for i, tile in ipairs(tiles) do - tilesTable[tile] = not tile:hasCreature() and tile:isWalkable() and getWalkableTilesCount(tile:getPosition()) or nil + tilesTable[tile] = not tile:hasCreatures() and tile:isWalkable() and getWalkableTilesCount(tile:getPosition()) or nil end local best = 0 diff --git a/mods/game_bot/default_configs/vBot_4.8/vBot/new_cavebot_lib.lua b/mods/game_bot/default_configs/vBot_4.8/vBot/new_cavebot_lib.lua index a1a23dcfd3..d1cf03182d 100644 --- a/mods/game_bot/default_configs/vBot_4.8/vBot/new_cavebot_lib.lua +++ b/mods/game_bot/default_configs/vBot_4.8/vBot/new_cavebot_lib.lua @@ -287,7 +287,7 @@ function CaveBot.ReachDepot() lockerTilePos.x = lockerTilePos.x + LOCKER_ACCESSTILE_MODIFIERS[item:getId()][1] lockerTilePos.y = lockerTilePos.y + LOCKER_ACCESSTILE_MODIFIERS[item:getId()][2] local lockerTile = g_map.getTile(lockerTilePos) - if not lockerTile:hasCreature() then + if not lockerTile:hasCreatures() then if findPath(pos(), tPos, 20, {ignoreNonPathable = false, precision = 1, ignoreCreatures = true}) then local distance = getDistanceBetween(tPos, pPos) table.insert(candidates, {pos=tPos, dist=distance}) diff --git a/mods/game_bot/default_configs/vBot_4.8/vBot/pushmax.lua b/mods/game_bot/default_configs/vBot_4.8/vBot/pushmax.lua index 2e269fac11..d5cec4df23 100644 --- a/mods/game_bot/default_configs/vBot_4.8/vBot/pushmax.lua +++ b/mods/game_bot/default_configs/vBot_4.8/vBot/pushmax.lua @@ -205,7 +205,7 @@ macro(50, function() return end - if not cleanTile:hasCreature() then return end + if not cleanTile:hasCreatures() then return end local tiles = getNearTiles(tilePos) local destTile local forbidden = {} @@ -220,7 +220,7 @@ macro(50, function() for i, tile in pairs(tiles) do local minimapColor = g_map.getMinimapColor(tile:getPosition()) local stairs = (minimapColor >= 210 and minimapColor <= 213) - if tile:isWalkable() and not isNotOk(fieldTable, tile) and not tile:hasCreature() and not stairs then + if tile:isWalkable() and not isNotOk(fieldTable, tile) and not tile:hasCreatures() and not stairs then local tooClose = false if #forbidden ~= 0 then for i=1,#forbidden do