From 39a76f758a296570a0cf6bf81f9e5d42d273e2d0 Mon Sep 17 00:00:00 2001 From: justin Date: Sat, 28 Dec 2024 10:20:17 +0000 Subject: [PATCH] Remove unnecessary projectile code --- src/Dodge/Data/Item/Use/Consumption/Ammo.hs | 4 ++-- src/Dodge/Projectile/Create.hs | 2 +- src/Dodge/Projectile/Update.hs | 18 ++++-------------- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/Dodge/Data/Item/Use/Consumption/Ammo.hs b/src/Dodge/Data/Item/Use/Consumption/Ammo.hs index 331ce1741..eb2af4b00 100644 --- a/src/Dodge/Data/Item/Use/Consumption/Ammo.hs +++ b/src/Dodge/Data/Item/Use/Consumption/Ammo.hs @@ -25,8 +25,8 @@ data ProjectileUpdate | DestroyPU {_pjuScreenID :: Maybe (NewInt ItmInt) ,_pjuTimer :: Int} | TimePU - | CollisionEffectPU {_pjuControlID :: Maybe (NewInt ItmInt) - ,_pjuDetonatorID :: Maybe (NewInt ItmInt) + | CollisionEffectPU + {_pjuDetonatorID :: Maybe (NewInt ItmInt) ,_pjuScreenID :: Maybe (NewInt ItmInt) } | ApplyGravityPU diff --git a/src/Dodge/Projectile/Create.hs b/src/Dodge/Projectile/Create.hs index 5645376b7..efd73c260 100644 --- a/src/Dodge/Projectile/Create.hs +++ b/src/Dodge/Projectile/Create.hs @@ -36,7 +36,7 @@ createShell homing mdetonator mscreen pjtype payload muz cr w = w , _prjPayload = payload , _prjTimer = lifespan , _prjUpdates = - [ CollisionEffectPU (homing ^? phRemoteID) mdetonator mscreen + [ CollisionEffectPU mdetonator mscreen , TimePU , StartSpinPU (lifespan - 15) (_crID cr) spinamount , RemoteDirectionPU (lifespan - thrustdelay) 0 diff --git a/src/Dodge/Projectile/Update.hs b/src/Dodge/Projectile/Update.hs index ea5abbec4..ccc9c4d12 100644 --- a/src/Dodge/Projectile/Update.hs +++ b/src/Dodge/Projectile/Update.hs @@ -26,9 +26,8 @@ updateProjectile pj w = foldl' (\w' pu -> upProjectile pu pj w') w (_prjUpdates upProjectile :: ProjectileUpdate -> Projectile -> World -> World upProjectile pu pj = case pu of - CollisionEffectPU mcontrolid mdetonatorid mscreenid -> + CollisionEffectPU mdetonatorid mscreenid -> shellCollisionCheck - mcontrolid mdetonatorid mscreenid pj @@ -82,20 +81,17 @@ applyGravityPU pj w --shellCollisionCheck :: (Projectile -> World -> World) -> Projectile -> World -> World shellCollisionCheck :: - Maybe (NewInt ItmInt) -> Maybe (NewInt ItmInt) -> Maybe (NewInt ItmInt) -> Projectile -> World -> World -shellCollisionCheck controlid detid screenid pj w - -- | time > 330 && circOnSomeWall oldPos 4 w = g - -- | time <= 330 && anythingHitCirc 2 oldPos newPos w = g +shellCollisionCheck detid screenid pj w | anythingHitCirc 2 oldPos newPos w = g | time <= 0 = g | otherwise = w where - g = explodeShell controlid detid screenid pj w + g = explodeShell detid screenid pj w time = _prjTimer pj oldPos = _prjPos pj newPos = oldPos +.+ _prjVel pj @@ -188,27 +184,21 @@ decTimMvVel pj = pjid = _prjID pj explodeShell :: - Maybe (NewInt ItmInt) -> Maybe (NewInt ItmInt) -> Maybe (NewInt ItmInt) -> Projectile -> World -> World -explodeShell controlid mdetid screenid pj w = +explodeShell mdetid screenid pj w = w & cWorld . lWorld . projectiles . ix pjid . prjUpdates .~ [DestroyPU screenid 30] --- & cWorld . lWorld . projectiles . ix pjid . prjDraw .~ DrawBlankProjectile & usePayload (_prjPayload pj) (_prjPos pj) (_prjVel pj) & stopSoundFrom (ShellSound pjid) & updatedetonator - & updatecontroller where updatedetonator = fromMaybe id $ do detid <- mdetid return $ pointerToItemID detid . itUse . uaParams . apProjectiles %~ delete pjid deleteif (Just x) | x == pjid = Nothing deleteif x = x - updatecontroller = fromMaybe id $ do - cid <- controlid - return $ pointerToItemID cid . itUse . uaParams . apLinkedProjectile %~ deleteif pjid = pj ^. prjID