Skip to content
Snippets Groups Projects
Commit 3a2e8cff authored by dg's avatar dg
Browse files

Rod of Recall and Orb of Many Ways automatically setup in the hotkeys bar when picked up

git-svn-id: http://svn.net-core.org/repos/t-engine4@5909 51575b47-30f0-44d4-a5cc-537603b46e54
parent ba1f4f53
No related branches found
No related tags found
No related merge requests found
......@@ -1192,6 +1192,39 @@ function _M:onWear(o, bypass_set)
end
end
--- Call when an object is added
function _M:onAddObject(o)
mod.class.Actor.onAddObject(self, o)
if self.hotkey and o:attr("auto_hotkey") then
local position
local name = o:getName{no_count=true, force_id=true, no_add_name=true}
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["talent"] 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
end
end
-- Go through all sustained talents and turn them off if pre_use fails
function _M:playerCheckSustains()
for tid, _ in pairs(self.talents) do
......
......@@ -83,6 +83,8 @@ newEntity{ define_as = "ORB_MANY_WAYS",
desc = [[The orb projects images of distant places, some that seem to be not of this world, switching rapidly.
If used near a portal it could probably activate it.]],
auto_hotkey = 1,
max_power = 30, power_regen = 1,
use_power = { name = "activate a portal", power = 10,
use = function(self, who)
......@@ -312,6 +314,8 @@ newEntity{ base = "BASE_ROD",
You have heard of such items before. They are very useful to adventurers, allowing faster travel.]],
cost = 0, quest=true,
auto_hotkey = 1,
max_power = 400, power_regen = 1,
use_power = { name = "recall the user to the worldmap", power = 202,
use = function(self, who)
......
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