Implement remote screen for launcher projectiles

This commit is contained in:
2024-09-27 10:39:21 +01:00
parent fb6fcff61c
commit 5f9fb183a9
35 changed files with 238 additions and 170 deletions
+14 -11
View File
@@ -16,9 +16,9 @@ import LensHelp
fireShell :: Item -> Muzzle -> Item -> Creature -> World -> World
fireShell ammoitem muz it cr =
makeShell
Nothing
ammoitem
muz
it
cr
[ PJShellCollisionCheck
, PJDecTimMvVel
@@ -32,8 +32,8 @@ fireShell ammoitem muz it cr =
spinamount = _shellSpinAmount params
thrustdelay = _shellThrustDelay params
makeShell :: Item -> Muzzle -> Item -> Creature -> [ProjectileUpdate] -> World -> World
makeShell ammoitem muz it cr theupdate w = fromMaybe w $ do
makeShell :: Maybe Int -> Item -> Muzzle -> Creature -> [ProjectileUpdate] -> World -> World
makeShell mscreeninvid ammoitem muz cr theupdate w = fromMaybe w $ do
aparams <- ammoitem ^? itUse . amagParams
return $
w & cWorld . lWorld . projectiles . at i
@@ -50,27 +50,30 @@ makeShell ammoitem muz it cr theupdate w = fromMaybe w $ do
, _prjPayload = _ampPayload aparams
, _prjTimer = 350
, _prjUpdates = theupdate
, _prjMITID = Just $ _itID it
-- , _prjMITID = Just $ _itID it
}
& updatescreen
where
updatescreen = fromMaybe id $ do
screeninvid <- mscreeninvid
return $ cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix screeninvid
. itUse . atLinkedProjectile ?~ i
i = IM.newKey $ w ^. cWorld . lWorld . projectiles -- _props (_cWorld w)
dir = _crDir cr + _mzRot muz
pos = _crPos cr +.+ rotateV dir (_mzPos muz)
--am = _heldConsumption $ _itUse it
fireTrackingShell :: Item -> Muzzle -> Item -> Creature -> World -> World
fireTrackingShell ammoitem muz it cr = fromMaybe id $ do
return $
makeShell
fireTrackingShell :: Int -> Int -> Item -> Muzzle -> Item -> Creature -> World -> World
fireTrackingShell screenid screeninvid ammoitem muz it cr = makeShell
(Just screeninvid)
ammoitem
muz
it
cr
[ PJRemoteShellCollisionCheck
[ PJRemoteShellCollisionCheck screenid
, PJDecTimMvVel
, PJSpin 335 (_crID cr) spinamount
, PJTrack (350 - thrustdelay) 0 (_itID it)
, PJRemoteSetDirection (350 - thrustdelay) 0 screenid
, PJThrust (350 - thrustdelay) 0
, PJReduceSpin (1 - fromIntegral spindrag * 2 / 200)
]