Work on tweak datatypes

This commit is contained in:
2021-11-29 23:05:51 +00:00
parent 02dc7c29e0
commit e75cbdf6cb
5 changed files with 32 additions and 45 deletions
+1
View File
@@ -83,6 +83,7 @@ lasGun = defaultAutoGun
, _itAttachment = ItCharMode $ Seq.fromList "/VZ"
, _itScroll = scrollCharMode
, _itInvDisplay = basicWeaponDisplay
, _itParams = Refracting {_phaseVel = 1}
}
lasGunPic :: Item -> SPic
lasGunPic it =
+14 -20
View File
@@ -82,34 +82,34 @@ launcherPic _ =
, mempty
)
basicAmPjMoves :: [TweakParam]
basicAmPjMoves =
basicAmPjMoves :: IM.IntMap TweakParam
basicAmPjMoves = IM.fromList . zip [0..] $
[spinDrag
,spinStart
,thrustParam
]
spinDrag :: TweakParam
spinDrag = PjExtraUpdate
{ _pjMoveParam = \i _ _ -> reduceSpinBy (1 - fromIntegral i*2 / 200)
spinDrag = TweakParam
{ _doTweak = \i -> itParams . shellSpinDrag .~ i
, _curTweak = 1
, _pjDisplayParam = pjPadText "SPIN SLOWDOWN" . show
, _pjMaxParam = 5
, _showTweak = pjPadText "SPIN SLOWDOWN" . show
, _maxTweak = 5
}
pjPadText :: String -> String -> String
pjPadText s = (rightPad 12 ' ' s ++ ) . (' ':)
spinStart :: TweakParam
spinStart = PjExtraUpdate
{ _pjMoveParam = \i _ cr -> pjEffAtTime 35 $ trySpinByCID (_crID cr) i
spinStart = TweakParam
{ _doTweak = \i -> itParams . shellSpinAmount .~ i
, _curTweak = 2
, _pjDisplayParam = pjPadText "SPIN AMOUNT" . show
, _pjMaxParam = 5
, _showTweak = pjPadText "SPIN AMOUNT" . show
, _maxTweak = 5
}
thrustParam :: TweakParam
thrustParam = PjExtraUpdate
{ _pjMoveParam = \i _ _ -> pjThrust i
thrustParam = TweakParam
{ _doTweak = \i -> itParams . shellThrustDelay .~ i
, _curTweak = 1
, _pjDisplayParam = pjPadText "THRUST DELAY" . show
, _pjMaxParam = 5
, _showTweak = pjPadText "THRUST DELAY" . show
, _maxTweak = 5
}
pjThrust :: Int -> Prop -> World -> World
@@ -151,12 +151,6 @@ aRocketWithItemParams it cr w = over props (IM.insert i theShell) w
spindrag = _shellSpinDrag params
spinamount = _shellSpinAmount params
thrustdelay = _shellThrustDelay params
ammoMvs pj w' =
foldr (\pjP -> _pjMoveParam pjP (_curTweak pjP) it cr pj) w'
(filter ispjupdate $ _tweakParams $ _itParams it)
ispjupdate PjExtraUpdate {} = True
ispjupdate _ = False
-- I feel like this might leak...
theShell = defaultShell
{ _pjPos = pos
, _pjStartPos = pos