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 if
nearestBaseDistance < 5 nearestBaseDistance < 5
and runnerIndex ~= nil and runnerIndex ~= nil
and runner ~= self.batter --runner.prevBase and runner ~= self.batter
and runner.nextBase == C.Bases[C.Home] and runner.nextBase == C.Bases[C.Home]
and nearestBase == C.Bases[C.Home] and nearestBase == C.Bases[C.Home]
then then

View File

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

View File

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

View File

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