This commit is contained in:
2024-09-27 23:10:01 +01:00
parent 6c3d0d5def
commit d1690ed3ac
10 changed files with 124 additions and 194 deletions
+10 -10
View File
@@ -1,5 +1,5 @@
module Dodge.Projectile.Create (
fireTrackingShell,
createShell,
) where
import Data.Maybe
@@ -9,8 +9,8 @@ import qualified IntMapHelp as IM
import LensHelp
-- assumes the mscreen is in your inventory
fireTrackingShell :: Maybe Item -> AmmoParams -> Muzzle -> Item -> Creature -> World -> World
fireTrackingShell mscreen aparams muz it cr w = w
createShell :: Maybe Item -> AmmoParams -> Muzzle -> Item -> Creature -> World -> World
createShell mscreen aparams muz it cr w = w
& updatescreen
& cWorld . lWorld . projectiles . at i
?~ Shell
@@ -26,12 +26,12 @@ fireTrackingShell mscreen aparams muz it cr w = w
, _prjPayload = _ampPayload aparams
, _prjTimer = 350
, _prjUpdates =
[ PJRemoteShellCollisionCheck (mscreen ^? _Just . itID) --Just screenid)
, PJDecTimMvVel
, PJSpin 335 (_crID cr) (_shellSpinAmount params)
, PJRemoteSetDirection (350 - thrustdelay) 0 (mscreen ^? _Just . itID)
, PJThrust (350 - thrustdelay) 0
, PJReduceSpin (1 - fromIntegral (_shellSpinDrag params) * 2 / 200)
[ CollisionEffectPU (mscreen ^? _Just . itID) --Just screenid)
, TimePU
, StartSpinPU 335 (_crID cr) (_shellSpinAmount params)
, RemoteDirectionPU (350 - thrustdelay) 0 (mscreen ^? _Just . itID)
, ThrustPU (350 - thrustdelay) 0
, ReduceSpinPU (1 - fromIntegral (_shellSpinDrag params) * 2 / 200)
]
}
where
@@ -44,6 +44,6 @@ fireTrackingShell mscreen aparams muz it cr w = w
. itUse
. atLinkedProjectile
?~ i
i = IM.newKey $ w ^. cWorld . lWorld . projectiles -- _props (_cWorld w)
i = IM.newKey $ w ^. cWorld . lWorld . projectiles
dir = _crDir cr + _mzRot muz
pos = _crPos cr +.+ rotateV dir (_mzPos muz)