Add attached/aiming checks on item usage

This commit is contained in:
2025-01-01 11:36:33 +00:00
parent 99114c7351
commit 91111fc89c
10 changed files with 393 additions and 423 deletions
+4 -2
View File
@@ -72,8 +72,10 @@ createShell mdetonator mscreen stab pjtype payload muz cr w = w
updatescreen = fromMaybe id $ do
screenid <- mscreen
return $ pointerToItemID screenid . itUse . uaParams
. apLinkedProjectile
?~ i
. apProjectiles
.:~ i
-- . apLinkedProjectile
-- ?~ i
i = IM.newKey $ w ^. cWorld . lWorld . projectiles
dir = _crDir cr + _mzRot muz
pos = _crPos cr +.+ rotateV dir (_mzPos muz)
+1 -4
View File
@@ -3,7 +3,6 @@ module Dodge.Projectile.Update (
updateProjectile,
) where
import Control.Monad
import Data.Foldable
import Data.List (delete)
import Data.Maybe
@@ -118,9 +117,7 @@ destroyProjectile mitid pjid w =
removelink = fromMaybe id $ do
itid <- fmap _unNInt mitid
loc <- w ^? cWorld . lWorld . itemLocations . ix itid
itm <- w ^? pointerToItemLocation loc . itUse . uaParams . apLinkedProjectile . _Just
guard $ itm == pjid
return $ pointerToItemLocation loc . itUse . uaParams . apLinkedProjectile .~ Nothing
return $ pointerToItemLocation loc . itUse . uaParams . apProjectiles %~ delete pjid
doThrust :: Projectile -> Maybe RocketSmoke -> World -> World
doThrust pj smoke w =