Windower / Issues

Windower Public Issue Tracker
31 stars 21 forks source link

When using windower.ffxi.turn() a nan can be unintentionally passed in causing the character model to disappear #1090

Closed eaglejs closed 1 year ago

eaglejs commented 2 years ago

The problem: Whenever windower.ffxi.turn() is passed a nan, the character model will disappear on the screen and one will have to zone, or logout and back in. pressing first-person mode will cause you to fall through the ground.

Windower 4.0 Windows 10

How to reproduce:

TurnPlayer.lua

require('vectors')

function turnPlayer()
  -- local me = windower.ffxi.get_mob_by_target('me')
  -- local t = windower.ffxi.get_mob_by_target('t')
  -- local me_pos = V{me.x, me.y}
  -- local t_pos = V{t.x, t.y}
  -- local angle = (t_pos - me_pos):to_radian() -- The offender! It can produce a nan
  local angle = 0/0

  if tonumber(angle) then
    print('Angle: %s':format(angle))
  end
  windower.ffxi.turn(angle)

end

while (true)
do
  coroutine.sleep(1)
  turnPlayer()
  windower.send_command('input /ma "Koru-Moru" <me>')
end

I provided a small addon script that reproduces the issue above.

eaglejs commented 2 years ago

a temporary fix is to check if there is a nan

if tonumber(angle) and angle == angle then

If it is nan, nan is never equal even to itself. so if it is a correct value, then this should evaluate to true.

Nifim commented 1 year ago

Addressed in #Plugins/4.3/7b83d2