Skip to content
Snippets Groups Projects
Commit 53c122c4 authored by dg's avatar dg
Browse files

Adding A* pathing to ToME's move_anchor.

Letting A* pathing use simple if it cannot move along the path (blocked by ACTOR for example).
Fixing staff projection throwing errors when disarmed.


git-svn-id: http://svn.net-core.org/repos/t-engine4@6087 51575b47-30f0-44d4-a5cc-537603b46e54
parent 0942fd5e
No related branches found
No related tags found
No related merge requests found
......@@ -125,7 +125,8 @@ newAI("move_astar", function(self, add_check)
if not path then
return self:runAI("move_simple")
else
return self:move(path[1].x, path[1].y)
local moved = self:move(path[1].x, path[1].y)
if not moved then return self:runAI("move_simple") end
end
end
end)
......
......@@ -46,8 +46,14 @@ end)
newAI("move_anchor", function(self)
local anchor = self.ai_state.tactic_leash_anchor
if anchor and anchor.x and anchor.y then
local tx, ty = anchor.x, anchor.y
return self:moveDirection(tx, ty)
local a = engine.Astar.new(game.level.map, self)
local path = a:calc(self.x, self.y, anchor.x, anchor.y)
if not path then
return self:moveDirection(anchor.x, anchor.y)
else
local moved = self:move(path[1].x, path[1].y)
if not moved then return self:moveDirection(anchor.x, anchor.y) end
end
end
end)
......@@ -1682,7 +1682,9 @@ function _M:setupMouse(reset)
if config.settings.cheat and button == "right" and core.key.modState("ctrl") and core.key.modState("shift") and not xrel and not yrel and event == "button" and self.zone and not self.zone.wilderness then
local tmx, tmy = game.level.map:getMouseTile(mx, my)
local target = game.level.map(tmx, tmy, Map.ACTOR)
target:die(game.player)
if target then
target:die(game.player)
end
return
end
......
......@@ -221,6 +221,10 @@ newEntity{
function(self, who)
local tg = {type="bolt", range= 5 + self.material_level, speed=20, display = {particle=particle, trail=trail},}
local weapon = who:hasStaffWeapon()
if not weapon then
game.logPlayer(who, "You have no appropriate weapon.")
return
end
local combat = weapon.combat
local DamageType = require "engine.DamageType"
......@@ -807,4 +811,4 @@ newEntity{
},
}
]]
\ No newline at end of file
]]
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