Add attached/aiming checks on item usage
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user