Skip to content
Snippets Groups Projects
Commit 797daba7 authored by dg's avatar dg
Browse files

group up

git-svn-id: http://svn.net-core.org/repos/t-engine4@6825 51575b47-30f0-44d4-a5cc-537603b46e54
parent 552f3f71
No related branches found
No related tags found
No related merge requests found
......@@ -101,6 +101,59 @@ function _M:sortHotkeys()
self.changed = true
end
-- Adds a new hotkey
function _M:addNewHotkey(kind, name)
if kind == "inventory" then
if self.player then
if self == game:getPlayer(true) then
position = self:findQuickHotkey("Player: Specific", "inventory", name)
if not position then
local global_hotkeys = engine.interface.PlayerHotkeys.quickhotkeys["Player: Global"]
if global_hotkeys and global_hotkeys["inventory"] then position = global_hotkeys["inventory"][name] end
end
else
position = self:findQuickHotkey(self.name, "inventory", name)
end
end
if position and not self.hotkey[position] then
self.hotkey[position] = {"inventory", name}
else
for i = 1, 12 * (self.nb_hotkey_pages or 5) do
if not self.hotkey[i] then
self.hotkey[i] = {"inventory", name}
break
end
end
end
elseif kind == "talent" then
if self.player then
if self == game:getPlayer(true) then
position = self:findQuickHotkey("Player: Specific", "talent", name)
if not position then
local global_hotkeys = engine.interface.PlayerHotkeys.quickhotkeys["Player: Global"]
if global_hotkeys and global_hotkeys["talent"] then position = global_hotkeys["talent"][name] end
end
else
position = self:findQuickHotkey(self.name, "talent", name)
end
end
if position and not self.hotkey[position] then
self.hotkey[position] = {"talent", name}
else
for i = 1, 12 * (self.nb_hotkey_pages or 5) do
if not self.hotkey[i] then
self.hotkey[i] = {"talent", name}
break
end
end
end
end
end
--- Uses an hotkeyed talent
-- This requires the ActorTalents interface to use talents and a method player:playerUseItem(o, item, inven) to use inventory objects
function _M:activateHotkey(id)
......
......@@ -1307,29 +1307,7 @@ function _M:onWear(o, bypass_set)
local name = o:getName{no_count=true, force_id=true, no_add_name=true}
if not self:isHotkeyBound("inventory", name) then
if self.player then
if self == game:getPlayer(true) then
position = self:findQuickHotkey("Player: Specific", "inventory", name)
if not position then
local global_hotkeys = engine.interface.PlayerHotkeys.quickhotkeys["Player: Global"]
if global_hotkeys and global_hotkeys["inventory"] then position = global_hotkeys["inventory"][name] end
end
else
position = self:findQuickHotkey(self.name, "inventory", name)
end
end
if position and not self.hotkey[position] then
self.hotkey[position] = {"inventory", name}
else
for i = 1, 12 * (self.nb_hotkey_pages or 5) do
if not self.hotkey[i] then
self.hotkey[i] = {"inventory", name}
break
end
end
end
self:addNewHotkey("inventory", name)
end
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