diff --git a/game/modules/tome/class/Player.lua b/game/modules/tome/class/Player.lua index 2d08353224e70ed3be98f6c2135d1ce7a2d46079..1e00a4b1a7fb98607bacaa0e8aafe332f49b54ac 100644 --- a/game/modules/tome/class/Player.lua +++ b/game/modules/tome/class/Player.lua @@ -1196,6 +1196,21 @@ function _M:runStopped() if obj then game.level.map.attrs(x, y, "obj_seen", true) 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) + -- Visual feedback to show whcih key was pressed + if config.settings.tome.visual_hotkeys and game.uiset.hotkeys_display and game.uiset.hotkeys_display.clics and game.uiset.hotkeys_display.clics[id] and self.hotkey[id] then + local zone = game.uiset.hotkeys_display.clics[id] + game.uiset:addParticle( + game.uiset.hotkeys_display.display_x + zone[1] + zone[3] / 2, game.uiset.hotkeys_display.display_y + zone[2] + zone[4] / 2, + "hotkey_feedback", {w=zone[3], h=zone[4]} + ) + end + + return engine.interface.PlayerHotkeys.activateHotkey(self, id) +end + --- Activates a hotkey with a type "inventory" function _M:hotkeyInventory(name) local find = function(name) diff --git a/game/modules/tome/class/uiset/Classic.lua b/game/modules/tome/class/uiset/Classic.lua index 5d249c7c8869f47346f0a77049fb2bb3362c937f..6ac1e6f4f717698553638cce20ff240fd782c8ae 100644 --- a/game/modules/tome/class/uiset/Classic.lua +++ b/game/modules/tome/class/uiset/Classic.lua @@ -329,6 +329,8 @@ function _M:display(nb_keyframes) -- UI self:displayUI() + + UISet.display(self, nb_keyframes) end function _M:setupMouse(mouse) diff --git a/game/modules/tome/class/uiset/Minimalist.lua b/game/modules/tome/class/uiset/Minimalist.lua index 63901096bb89cb8ee1bc2942c2d134b4b23e605b..01fc7149de6df29fc525a53f4269e38e81066c42 100644 --- a/game/modules/tome/class/uiset/Minimalist.lua +++ b/game/modules/tome/class/uiset/Minimalist.lua @@ -2010,6 +2010,8 @@ function _M:display(nb_keyframes) if size.bottom then d.drawQuad(0, Map.viewport.height - 10, Map.viewport.width, 10, 0, 200, 0, 50) end d.glTranslate(-Map.display_x, -Map.display_y, -0) end + + UISet.display(self, nb_keyframes) end function _M:setupMouse(mouse) diff --git a/game/modules/tome/class/uiset/UISet.lua b/game/modules/tome/class/uiset/UISet.lua index 2d4202e1011579664c374f0f38682f357bccf76f..ba0e71c3140eb5b552603be0f98a1c49dca18326 100644 --- a/game/modules/tome/class/uiset/UISet.lua +++ b/game/modules/tome/class/uiset/UISet.lua @@ -18,10 +18,12 @@ -- darkgod@te4.org require "engine.class" +local Particles = require "engine.Particles" module(..., package.seeall, class.make) function _M:init() + self.particles = {} end function _M:activate() @@ -36,8 +38,15 @@ function _M:getMapSize() end function _M:display(nb_keyframes) - -- Now the map, if any - game:displayMap(nb_keyframes) + if next(self.particles) then + for p, pos in pairs(self.particles) do + if p.ps:isAlive() then + p.ps:toScreen(pos.x, pos.y, true, 1) + else + self.particles[p] = nil + end + end + end end function _M:setupMouse(mouse) @@ -62,3 +71,8 @@ end function _M:isLocked() return true end + +function _M:addParticle(x, y, name, args) + local p = Particles.new(name, 1, args) + self.particles[p] = {x=x, y=y} +end diff --git a/game/modules/tome/dialogs/GameOptions.lua b/game/modules/tome/dialogs/GameOptions.lua index d656af6d801cb112392b9e950ec1828f8cf3309f..9ded4b2be71254ad38a709ebd8ffcc9427358e5e 100644 --- a/game/modules/tome/dialogs/GameOptions.lua +++ b/game/modules/tome/dialogs/GameOptions.lua @@ -284,6 +284,15 @@ function _M:generateListUi() end end + local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"When you activate a hotkey, either by keyboard or click a visual feedback will appear over it in the hotkeys bar.#WHITE#"} + list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Visual hotkeys feedback#WHITE##{normal}#", status=function(item) + return tostring(config.settings.tome.visual_hotkeys and "enabled" or "disabled") + end, fct=function(item) + config.settings.tome.visual_hotkeys = not config.settings.tome.visual_hotkeys + game:saveSettings("tome.visual_hotkeys", ("tome.visual_hotkeys = %s\n"):format(tostring(config.settings.tome.visual_hotkeys))) + self.c_list:drawItem(item) + end,} + local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Size of the icons in the hotkeys toolbar.#WHITE#"} list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Icons hotkey toolbar icon size#WHITE##{normal}#", status=function(item) return tostring(config.settings.tome.hotkey_icons_size) diff --git a/game/modules/tome/settings.lua b/game/modules/tome/settings.lua index 018fcacf697fd1e850e429593ebf7817a5134d02..82a3348b89eff03a3d8a75409c642fd42c628ef4 100644 --- a/game/modules/tome/settings.lua +++ b/game/modules/tome/settings.lua @@ -30,9 +30,10 @@ if not config.settings.tome.smooth_move then config.settings.tome.smooth_move = if type(config.settings.tome.twitch_move) == "nil" then config.settings.tome.twitch_move = true end if not config.settings.tome.gfx then local w, h = core.display.size() - if w >= 1000 then config.settings.tome.gfx = {size="64x64", tiles="shockbolt"} - else config.settings.tome.gfx = {size="48x48", tiles="shockbolt"} - end + config.settings.tome.gfx = {size="64x64", tiles="shockbolt"} + -- if w >= 1000 then config.settings.tome.gfx = {size="64x64", tiles="shockbolt"} + -- else config.settings.tome.gfx = {size="48x48", tiles="shockbolt"} + -- end end if config.settings.tome.gfx.tiles == "mushroom" then config.settings.tome.gfx.tiles="shockbolt" end if type(config.settings.tome.weather_effects) == "nil" then config.settings.tome.weather_effects = true end