Fix inverted dance animation

Switch XyPair and Point3d to @class, over @alias
Seems to work better with autocomplete
This commit is contained in:
Sage Vaillancourt 2025-03-01 09:54:05 -05:00
parent 04d25127fc
commit decd1f7080
4 changed files with 10 additions and 11 deletions

View File

@ -201,7 +201,7 @@ function Baserunning:updateRunner(runner, runnerIndex, appliedSpeed, isAutoRun,
if
nearestBaseDistance < 5
and runnerIndex ~= nil
and runner ~= self.batter --runner.prevBase
and runner ~= self.batter
and runner.nextBase == C.Bases[C.Home]
and nearestBase == C.Bases[C.Home]
then

View File

@ -31,6 +31,7 @@ end
-- and letting the user find a crank position and direction that works for them
--- Assumes the bat is being held by self.baserunning.batter
--- Mutates self.state for later rendering.
---@param batDeg number
---@param batSpeed number
---@param ball Point3d

View File

@ -46,7 +46,7 @@ function drawFielder(fieldingTeamSprites, fielder, ball, flip)
local danceOffset = FielderDanceAnimator:currentValue()
local x = fielder.x
local y = fielder.y + danceOffset
local y = fielder.y - danceOffset
fieldingTeamSprites[fielder.spriteIndex].smiling:draw(fielder.x, y - 20, flip)
return drawFielderGlove(ball, x, y)
end

View File

@ -1,16 +1,14 @@
-- luacheck no new globals
utils = {}
--- @alias XyPair {
--- x: number,
--- y: number,
--- }
---@class XyPair
---@field x: number,
---@field y: number,
--- @alias Point3d {
--- x: number,
--- y: number,
--- z: number,
--- }
---@class Point3d
---@field x number,
---@field y number,
---@field z number,
local sqrt <const> = math.sqrt