Refactor inventory management, add tweak, combine and inspect modes

This commit is contained in:
jgk
2021-05-26 17:25:46 +02:00
parent f05381be47
commit 0187ae6001
13 changed files with 323 additions and 233 deletions
+18 -6
View File
@@ -42,7 +42,7 @@ launcher = defaultGun
, _itEquipPict = pictureWeaponOnAim $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
, _itHammer = NoHammer
, _itEffect = NoItEffect
, _wpAmmo = ShellAmmo
, _wpAmmo = defaultShellAmmo
{ _amPayload = makeExplosionAt
, _amString = ""
, _amPjMove = basicAmPjMoves
@@ -50,11 +50,23 @@ launcher = defaultGun
}
}
basicAmPjMoves :: Item -> Creature -> [Projectile -> World -> World]
basicAmPjMoves _ cr =
[reduceSpinBy 0.995
,pjEffAtTime 35 $ trySpinByCID (_crID cr)
basicAmPjMoves :: [PjParam]
basicAmPjMoves =
[spinDrag
,spinStart
]
spinDrag :: PjParam
spinDrag = PjParam
{ _pjMoveParam = \_ _ _ -> reduceSpinBy 0.995
, _pjIntParam = 0
, _pjDisplayParam = ("SPIN DRAG:" ++ ) . show
}
spinStart :: PjParam
spinStart = PjParam
{ _pjMoveParam = \_ _ cr -> pjEffAtTime 35 $ trySpinByCID (_crID cr)
, _pjIntParam = 0
, _pjDisplayParam = ("SPIN START:" ++ ) . show
}
flameLauncher :: Item
flameLauncher = launcher & wpAmmo . amPayload .~ makeFlameExplosionAt
@@ -74,7 +86,7 @@ aRocketWithItemParams it cr w = over projectiles (IM.insert i theShell) w
i = IM.newKey $ _projectiles w
pos = _crPos cr +.+ ((_crRad cr +1) *.* unitVectorAtAngle dir)
dir = _crDir cr
ammoMvs pj w' = foldr ($ pj) w' (_amPjMove am it cr)
ammoMvs pj w' = foldr (\pjP -> (_pjMoveParam pjP) (_pjIntParam pjP) it cr pj) w' (_amPjMove am)
theShell = defaultShell
{ _pjPos = pos
, _pjStartPos = pos