Skip to content
Snippets Groups Projects
Commit 96b7cc5c authored by dg's avatar dg
Browse files

plop

git-svn-id: http://svn.net-core.org/repos/t-engine4@2445 51575b47-30f0-44d4-a5cc-537603b46e54
parent 3a6a935f
No related branches found
No related tags found
No related merge requests found
......@@ -1003,6 +1003,9 @@ function _M:setupMouse(reset)
-- Handle Use menu
if button == "right" and not xrel and not yrel and event == "button" then self:mouseRightClick(mx, my) return end
-- Default left button action
if button == "left" and not xrel and not yrel and event == "button" then if self:mouseLeftClick(mx, my) then return end end
-- Handle the mouse movement/scrolling
self.player:mouseHandleDefault(self.key, self.key == self.normal_key, button, mx, my, xrel, yrel, event)
end)
......@@ -1028,6 +1031,24 @@ function _M:setupMouse(reset)
if not reset then self.mouse:setCurrent() end
end
--- Left mouse click on the map
function _M:mouseLeftClick(mx, my)
local tmx, tmy = self.level.map:getMouseTile(mx, my)
local p = self.player
local a = game.level.map(tmx, tmy, Map.ACTOR)
if not a then return end
if not p.auto_shoot_talent then return end
local t = p:getTalentFromId(p.auto_shoot_talent)
if not t then return end
local target_dist = math.floor(core.fov.distance(p.x, p.y, a.x, a.y))
if p:enoughEnergy() and p:reactionToward(a) < 0 and not p:isTalentCoolingDown(t) and p:preUseTalent(t, true, true) and target_dist <= p:getTalentRange(t) and p:canProject({type="hit"}, a.x, a.y) then
p:useTalent(t.id, nil, nil, nil, a)
return true
end
end
--- Right mouse click on the map
function _M:mouseRightClick(mx, my)
local tmx, tmy = self.level.map:getMouseTile(mx, my)
......
......@@ -347,7 +347,7 @@ end
function _M:toScreen()
self:display()
self.bg.tex[1]:toScreenFull(self.display_x, self.display_y, self.w, self.h, self.bg.tex[2], self.bg[3] / self.bg.tex[3])
self.bg.tex[1]:toScreen(self.display_x, self.display_y, self.w, self.h)
for i = 1, #self.items do
local item = self.items[i]
if type(item) == "table" then
......
......@@ -69,9 +69,12 @@ newBirthDescriptor{
[ActorTalents.T_WEAPON_COMBAT] = 1,
},
copy = {
equipment = resolvers.equip{ id=true,
resolvers.equip{ id=true,
{type="weapon", subtype="longbow", name="elm longbow", autoreq=true},
},
resolvers.generic(function(e)
e.auto_shoot_talent = e.T_SHOOT
end),
},
}
......
game/modules/tome/data/gfx/ui/player-display.png

4.9 KiB | W: | H:

game/modules/tome/data/gfx/ui/player-display.png

9.05 KiB | W: | H:

game/modules/tome/data/gfx/ui/player-display.png
game/modules/tome/data/gfx/ui/player-display.png
game/modules/tome/data/gfx/ui/player-display.png
game/modules/tome/data/gfx/ui/player-display.png
  • 2-up
  • Swipe
  • Onion skin
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