From 5091709f707be5386f2949c9d85f77849a63e187 Mon Sep 17 00:00:00 2001 From: justin Date: Tue, 1 Oct 2024 01:43:51 +0100 Subject: [PATCH] Cleanup launcher code --- ghcidOutput | 2 +- src/Dodge/Data/Item/Params.hs | 6 ------ src/Dodge/HeldUse.hs | 9 ++------- src/Dodge/Item/Held/Launcher.hs | 6 ------ src/Dodge/Projectile/Create.hs | 15 ++++++++------- 5 files changed, 11 insertions(+), 27 deletions(-) diff --git a/ghcidOutput b/ghcidOutput index 87e88579c..11eeed8fc 100644 --- a/ghcidOutput +++ b/ghcidOutput @@ -1 +1 @@ -All good (605 modules, at 01:05:43) +All good (605 modules, at 01:43:48) diff --git a/src/Dodge/Data/Item/Params.hs b/src/Dodge/Data/Item/Params.hs index fe296d017..b9dd7bc2b 100644 --- a/src/Dodge/Data/Item/Params.hs +++ b/src/Dodge/Data/Item/Params.hs @@ -21,11 +21,6 @@ data ItemParams {_shrinkGunStatus :: ShrinkGunStatus} | FlatShieldParams {_flatShieldWlMIX :: Maybe Int} - | ShellLauncher - { _shellSpinDrag :: Int - , _shellSpinAmount :: Int - , _shellThrustDelay :: Int - } | Refracting { _phaseV :: Float , _lasColor :: Color @@ -53,7 +48,6 @@ data ItemParams } | ParamMID {_paramMID :: Maybe Int} | BoostPropIX {_boostPropIX :: Maybe Int} - --deriving (Eq, Ord, Show, Read) --Generic, Flat) data ShrinkGunStatus = FullSize | Shrunk --deriving (Eq, Ord, Show, Read) --Generic, Flat) diff --git a/src/Dodge/HeldUse.hs b/src/Dodge/HeldUse.hs index 9ede34518..09482c51d 100644 --- a/src/Dodge/HeldUse.hs +++ b/src/Dodge/HeldUse.hs @@ -457,15 +457,10 @@ createProjectile magtree muz itmtree cr = fromMaybe failsound $ do magid <- magtree ^? ldtValue . itLocation . ilInvID ammoitem <- cr ^? crInv . ix magid let homing = determineProjectileTracking magtree itmtree - j <- ammoitem ^? itLocation . ilInvID - aparams <- ammoitem ^? itUse . amagParams - return $ createShell homing aparams muz itm cr + aparams <- ammoitem ^? itUse . amagParams . ampPayload + return $ createShell homing aparams muz cr . startthesound - . useammo j where - itm = itmtree ^. ldtValue - useammo j = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix j . itUse . amagLoadStatus . iaLoaded -~ 1 - -- the sound should be moved to the projectile firing startthesound = soundMultiFrom [CrWeaponSound (_crID cr) j | j <- [0..3]] (_crPos cr) tap4S Nothing -- failsound = soundContinue (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing diff --git a/src/Dodge/Item/Held/Launcher.hs b/src/Dodge/Item/Held/Launcher.hs index 11d30d820..b2a74d78f 100644 --- a/src/Dodge/Item/Held/Launcher.hs +++ b/src/Dodge/Item/Held/Launcher.hs @@ -12,12 +12,6 @@ import Geometry.Data launcher :: Item launcher = defaultHeldItem - & itParams - .~ ShellLauncher - { _shellSpinDrag = 1 - , _shellSpinAmount = 2 - , _shellThrustDelay = 20 - } & itInvSize .~ 3 & itDimension . dimRad .~ 9 & itDimension . dimCenter .~ V3 10 0 0 diff --git a/src/Dodge/Projectile/Create.hs b/src/Dodge/Projectile/Create.hs index 95c584ea5..660b4ba11 100644 --- a/src/Dodge/Projectile/Create.hs +++ b/src/Dodge/Projectile/Create.hs @@ -16,8 +16,8 @@ homingDrawType ht = case ht of HomeUsingTargeting {} -> DrawRemoteShell -- assumes the mscreen is in your inventory -createShell :: ProjectileHoming -> AmmoParams -> Muzzle -> Item -> Creature -> World -> World -createShell homing aparams muz it cr w = w +createShell :: ProjectileHoming -> Payload -> Muzzle -> Creature -> World -> World +createShell homing payload muz cr w = w & updatescreen & cWorld . lWorld . projectiles . at i ?~ Shell @@ -30,20 +30,21 @@ createShell homing aparams muz it cr w = w , _prjAcc = rotateV dir (V2 3 0) , _prjDir = dir , _prjSpin = 0 - , _prjPayload = _ampPayload aparams + , _prjPayload = payload , _prjTimer = 350 , _prjUpdates = [ CollisionEffectPU (homing ^? phRemoteID) --Just screenid) , TimePU - , StartSpinPU 335 (_crID cr) (_shellSpinAmount params) + , StartSpinPU 335 (_crID cr) spinamount , RemoteDirectionPU (350 - thrustdelay) 0 homing , ThrustPU (350 - thrustdelay) 0 - , ReduceSpinPU (1 - fromIntegral (_shellSpinDrag params) * 2 / 200) + , ReduceSpinPU (1 - spindrag * 2 / 200) ] } where - thrustdelay = _shellThrustDelay params - params = _itParams it + spindrag = 1 + spinamount = 2 + thrustdelay = 20 updatescreen = fromMaybe id $ do screenid <- homing ^? phRemoteID return $ pointerToItemID screenid . itUse