Skip to content
Snippets Groups Projects
Commit 90427a02 authored by DarkGod's avatar DarkGod
Browse files

When using a hotkey to trigger a talent/item that requires a target, pressing...

When using a hotkey to trigger a talent/item that requires a target, pressing the hotkey again will validate the target just like enter and space
parent b2952c74
No related branches found
No related tags found
No related merge requests found
......@@ -95,6 +95,7 @@ function _M:targetMode(v, msg, co, typ)
Map:setViewerFaction(self.always_target == true and self.player.faction or nil)
if msg then self.log(type(msg) == "string" and msg or "Tactical display disabled. Press shift+'t' to enable.") end
self.level.map.changed = true
self.targetmode_trigger_hotkey = nil
self.target:setActive(false)
if tostring(old) == "exclusive" then
......@@ -171,20 +172,27 @@ function _M:targetMode(v, msg, co, typ)
end
end
function _M:targetTriggerHotkey(i)
self.targetmode_trigger_hotkey = i
end
--- This setups the default keybindings for targeting
function _M:targetSetupKey()
local accept = function() self:targetMode(false, false) self.tooltip_x, self.tooltip_y = nil, nil end
self.targetmode_key = engine.KeyBind.new()
self.targetmode_key:addCommands{ _SPACE=function() self:targetMode(false, false) self.tooltip_x, self.tooltip_y = nil, nil end, }
self.targetmode_key:addCommands{ _SPACE=accept, }
if engine.interface and engine.interface.PlayerHotkeys then
engine.interface.PlayerHotkeys:bindAllHotkeys(self.targetmode_key, function(i)
if self.targetmode_trigger_hotkey == i then accept() end
end)
end
self.targetmode_key:addBinds
{
TACTICAL_DISPLAY = function()
self:targetMode(false, false)
self.tooltip_x, self.tooltip_y = nil, nil
end,
ACCEPT = function()
self:targetMode(false, false)
self.tooltip_x, self.tooltip_y = nil, nil
end,
TACTICAL_DISPLAY = accept,
ACCEPT = accept,
EXIT = function()
self.target.target.entity = nil
self.target.target.x = nil
......
......@@ -1488,8 +1488,6 @@ function _M:setupCommands()
print("===============")
end end,
[{"_g","ctrl"}] = function() if config.settings.cheat then
self.player:addParticles(engine.Particles.new("meleestorm", 1, {}))
do return end
local f, err = loadfile("/data/general/events/fearscape-portal.lua")
print(f, err)
......@@ -1871,7 +1869,10 @@ do return end
end
end
}
engine.interface.PlayerHotkeys:bindAllHotkeys(self.key, not_wild(function(i) self.player:activateHotkey(i) end, function() return self.player.allow_talents_worldmap end))
engine.interface.PlayerHotkeys:bindAllHotkeys(self.key, not_wild(function(i)
self:targetTriggerHotkey(i)
self.player:activateHotkey(i)
end, function() return self.player.allow_talents_worldmap end))
self.key:setCurrent()
end
......
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