Skip to content
Snippets Groups Projects
Commit 24b6d984 authored by DarkGod's avatar DarkGod
Browse files

Fixed a bug in AI displace code

parent 9d38f7dc
No related branches found
No related tags found
No related merge requests found
......@@ -2008,6 +2008,14 @@ function _M:setupCommands()
print("===============")
end end,
[{"_g","ctrl"}] = function() if config.settings.cheat then
self:changeLevel(1, "tareyal+bamboo-forest")
do return end
if self.zone.short_name ~= "test" then
self:changeLevel(1, "test")
else
self:changeLevel(game.level.level + 1)
end
do return end
local f, err = loadfile("/data/general/events/weird-pedestals.lua")
print(f, err)
setfenv(f, setmetatable({level=self.level, zone=self.zone}, {__index=_G}))
......@@ -2015,12 +2023,6 @@ function _M:setupCommands()
do return end
package.loaded["mod.dialogs.Donation"] = nil
self:registerDialog(require("mod.dialogs.Donation").new())
do return end
if self.zone.short_name ~= "test" then
self:changeLevel(1, "test")
else
self:changeLevel(game.level.level + 1)
end
do return end
local m = game.zone:makeEntity(game.level, "actor", {name="elven mage"}, nil, true)
local x, y = util.findFreeGrid(game.player.x, game.player.y, 20, true, {[Map.ACTOR]=true})
......
......@@ -313,7 +313,7 @@ _M.aiSubstDamtypes = {
-- Still count grids we can potentially shove or swap our way into
function _M:aiPathingBlockCheck(x, y, actor_checking)
return not self:block_move(x, y, actor_checking) or not actor_checking:canBumpDisplace(self)
return not self:block_move(x, y, actor_checking) or not actor_checking.canBumpDisplace or not actor_checking:canBumpDisplace(self)
end
-- Can an NPC shove or swap positions with a space occupied by another NPC?
......@@ -346,7 +346,7 @@ function _M:moveDirection(x, y, force)
-- Find all possible directions to move, including towards friendly targets
local target = game.level.map(lx, ly, engine.Map.ACTOR)
if target and self:reactionToward(target) > 0 and self:canBumpDisplace(target) then l[#l+1] = {lx,ly, core.fov.distance(x,y,lx,ly)/2+rng.float(0, .1), target} end -- Add straight ahead if shoveable
if target and self:reactionToward(target) > 0 and self.canBumpDisplace and self:canBumpDisplace(target) then l[#l+1] = {lx,ly, core.fov.distance(x,y,lx,ly)/2+rng.float(0, .1), target} end -- Add straight ahead if shoveable
local dir = util.getDir(lx, ly, self.x, self.y)
local sides = util.dirSides(dir, self.x, self.y)
for _, dir in pairs(sides) do -- sides
......@@ -356,7 +356,7 @@ function _M:moveDirection(x, y, force)
l[#l+1] = {dx,dy, core.fov.distance(x,y,dx,dy)}
else
target = game.level.map(dx, dy, engine.Map.ACTOR)
if target and self:reactionToward(target) > 0 and self:canBumpDisplace(target) then
if target and self:reactionToward(target) > 0 and self.canBumpDisplace and self:canBumpDisplace(target) then
l[#l+1] = {dx,dy, core.fov.distance(x,y,dx,dy)/2+rng.float(0, .1), target}
end
end
......
......@@ -43,8 +43,8 @@ return {
[';'] = "GRASS", ['T'] = "TREE",
['='] = "DEEP_WATER",
-- mapscript = "!cavernous_forest",
mapscript = "!testroom2",
-- mapscript = "!inner_outer",
-- mapscript = "!testroom2",
mapscript = "!inner_outer",
--]]
--[[
class = "engine.generator.map.Hexacle",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment