Untitled

 avatar
unknown
plain_text
a year ago
922 B
4
Indexable
UI.Separator()

local ganharMwallHotkey = 'PageDown'
local ganharMwallTxt = 'Ganhar'
local ganharMwallColor = 'yellow'
local ganharMwallIsOn = true

function clearPiso()
  if piso then
    piso:setText('')
    piso = false
  end
end

onKeyPress(function(keys)
  if keys == ganharMwallHotkey and ganharMwallIsOn then
    local pis = getTileUnderCursor()
    if pis == piso then
      clearPiso()
    else
      clearPiso()
      piso = pis
      piso:setText(ganharMwallTxt, ganharMwallColor)
    end
  end
end)

addSwitch('holdMwall', 'GanharWall', function(widget)
  widget:setOn(not widget:isOn())
  if not widget:isOn() then
    clearPiso()
  end
  ganharMwallIsOn = widget:isOn()
end)

macro(1, function()
  if not ganharMwallIsOn or not piso then return end
  if piso:getTopThing():getId() ~= 2129 and autoWalk(piso:getPosition(), 1) then
    clearPiso()
    return
  end
end)