Unify launcher projectiles

This commit is contained in:
2024-09-27 13:55:34 +01:00
parent 5f9fb183a9
commit 21e49ddefc
9 changed files with 159 additions and 202 deletions
+9 -6
View File
@@ -20,9 +20,10 @@ fireShell ammoitem muz it cr =
ammoitem
muz
cr
[ PJShellCollisionCheck
[ PJRemoteShellCollisionCheck Nothing
, PJDecTimMvVel
, PJSpin 335 (_crID cr) spinamount
, PJRemoteSetDirection (350 - thrustdelay) 0 Nothing
, PJThrust (350 - thrustdelay) 0
, PJReduceSpin (1 - fromIntegral spindrag * 2 / 200)
]
@@ -32,6 +33,7 @@ fireShell ammoitem muz it cr =
spinamount = _shellSpinAmount params
thrustdelay = _shellThrustDelay params
-- rather than screen invid why not use an item location?
makeShell :: Maybe Int -> Item -> Muzzle -> Creature -> [ProjectileUpdate] -> World -> World
makeShell mscreeninvid ammoitem muz cr theupdate w = fromMaybe w $ do
aparams <- ammoitem ^? itUse . amagParams
@@ -64,16 +66,17 @@ makeShell mscreeninvid ammoitem muz cr theupdate w = fromMaybe w $ do
--am = _heldConsumption $ _itUse it
fireTrackingShell :: Int -> Int -> Item -> Muzzle -> Item -> Creature -> World -> World
fireTrackingShell screenid screeninvid ammoitem muz it cr = makeShell
(Just screeninvid)
-- assumes the mscreen is in your inventory
fireTrackingShell :: Maybe Item -> Item -> Muzzle -> Item -> Creature -> World -> World
fireTrackingShell mscreen ammoitem muz it cr = makeShell
(mscreen ^? _Just . itLocation . ilInvID) -- Just screeninvid)
ammoitem
muz
cr
[ PJRemoteShellCollisionCheck screenid
[ PJRemoteShellCollisionCheck (mscreen ^? _Just . itID) --Just screenid)
, PJDecTimMvVel
, PJSpin 335 (_crID cr) spinamount
, PJRemoteSetDirection (350 - thrustdelay) 0 screenid
, PJRemoteSetDirection (350 - thrustdelay) 0 (mscreen ^? _Just . itID)
, PJThrust (350 - thrustdelay) 0
, PJReduceSpin (1 - fromIntegral spindrag * 2 / 200)
]