Cleanup
This commit is contained in:
@@ -120,8 +120,7 @@ moduleCombinations =
|
|||||||
]
|
]
|
||||||
where
|
where
|
||||||
makeDirectedTele it = it
|
makeDirectedTele it = it
|
||||||
-- & itEffect .~ rbSetTarget
|
& itTargeting .~ targetRBPress
|
||||||
& itTargeting' .~ targetRBPress
|
|
||||||
& itUse . useMods .:~ withPosDirWallCheck directedTelPos
|
& itUse . useMods .:~ withPosDirWallCheck directedTelPos
|
||||||
-- for the camera: the simplest option is to remove all zoom/offset
|
-- for the camera: the simplest option is to remove all zoom/offset
|
||||||
& itUse . useAim . aimZoom . itZoomFac .~ 1
|
& itUse . useAim . aimZoom . itZoomFac .~ 1
|
||||||
@@ -130,7 +129,7 @@ moduleCombinations =
|
|||||||
-- position
|
-- position
|
||||||
directedTelPos it cr w = (p,a)
|
directedTelPos it cr w = (p,a)
|
||||||
where
|
where
|
||||||
p = fromMaybe (_crPos cr) $ it ^? itTargeting' . tgPos . _Just
|
p = fromMaybe (_crPos cr) $ it ^? itTargeting . tgPos . _Just
|
||||||
a = argV (mouseWorldPos w -.- p)
|
a = argV (mouseWorldPos w -.- p)
|
||||||
f ameff = itConsumption . aoType . amBulEff .~ ameff
|
f ameff = itConsumption . aoType . amBulEff .~ ameff
|
||||||
amod cts str func = (cts,ItemModule [str] 1 func)
|
amod cts str func = (cts,ItemModule [str] 1 func)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ basicCrPict col cr cfig w =
|
|||||||
)
|
)
|
||||||
where
|
where
|
||||||
targetingPic = IM.elems $ IM.mapMaybeWithKey f $ _crInv cr
|
targetingPic = IM.elems $ IM.mapMaybeWithKey f $ _crInv cr
|
||||||
f invid it = fmap (\g -> g invid it cr w) (it ^? itTargeting' . tgDraw)
|
f invid it = fmap (\g -> g invid it cr w) (it ^? itTargeting . tgDraw)
|
||||||
|
|
||||||
drawCrEquipment :: Creature -> SPic
|
drawCrEquipment :: Creature -> SPic
|
||||||
drawCrEquipment cr = uncurryV translateSPf (_crPos cr) (rotateSP (_crDir cr) $ drawEquipment cr)
|
drawCrEquipment cr = uncurryV translateSPf (_crPos cr) (rotateSP (_crDir cr) $ drawEquipment cr)
|
||||||
|
|||||||
@@ -150,9 +150,9 @@ invSideEff cr w = weaponReloadSounds cr
|
|||||||
itpointer = creatures . ix (_crID cr) . crInv . ix i
|
itpointer = creatures . ix (_crID cr) . crInv . ix i
|
||||||
|
|
||||||
doHeldItemTargeting :: Creature -> World -> World
|
doHeldItemTargeting :: Creature -> World -> World
|
||||||
doHeldItemTargeting cr w = case cr ^? crInv . ix (_crInvSel cr) . itTargeting' . tgHeldUpdate of
|
doHeldItemTargeting cr w = case cr ^? crInv . ix (_crInvSel cr) . itTargeting . tgHeldUpdate of
|
||||||
Nothing -> w
|
Nothing -> w
|
||||||
Just f -> w & creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itTargeting'
|
Just f -> w & creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itTargeting
|
||||||
%~ f (_crInv cr IM.! _crInvSel cr) cr w
|
%~ f (_crInv cr IM.! _crInvSel cr) cr w
|
||||||
|
|
||||||
weaponReloadSounds :: Creature -> World -> World
|
weaponReloadSounds :: Creature -> World -> World
|
||||||
|
|||||||
+1
-1
@@ -369,7 +369,7 @@ data Item = Item
|
|||||||
, _itInvSize :: Float
|
, _itInvSize :: Float
|
||||||
, _itInvDisplay :: Item -> [String]
|
, _itInvDisplay :: Item -> [String]
|
||||||
, _itInvColor :: Color
|
, _itInvColor :: Color
|
||||||
, _itTargeting' :: Targeting
|
, _itTargeting :: Targeting
|
||||||
, _itDimension :: ItemDimension
|
, _itDimension :: ItemDimension
|
||||||
, _itCurseStatus :: CurseStatus
|
, _itCurseStatus :: CurseStatus
|
||||||
, _itParams :: ItemParams
|
, _itParams :: ItemParams
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ defaultEquipment = Item
|
|||||||
, _itTweaks = NoTweaks
|
, _itTweaks = NoTweaks
|
||||||
, _itModules = M.empty
|
, _itModules = M.empty
|
||||||
, _itScope = NoScope
|
, _itScope = NoScope
|
||||||
, _itTargeting' = NoTargeting
|
, _itTargeting = NoTargeting
|
||||||
}
|
}
|
||||||
defaultItZoom :: ItZoom
|
defaultItZoom :: ItZoom
|
||||||
defaultItZoom = ItZoom 20 0.2 1
|
defaultItZoom = ItZoom 20 0.2 1
|
||||||
@@ -181,7 +181,7 @@ defaultConsumable = Item
|
|||||||
, _itTweaks = NoTweaks
|
, _itTweaks = NoTweaks
|
||||||
, _itModules = M.empty
|
, _itModules = M.empty
|
||||||
, _itScope = NoScope
|
, _itScope = NoScope
|
||||||
, _itTargeting' = NoTargeting
|
, _itTargeting = NoTargeting
|
||||||
}
|
}
|
||||||
defaultApplyDamage :: [DamageType] -> Creature -> (World -> World, Creature)
|
defaultApplyDamage :: [DamageType] -> Creature -> (World -> World, Creature)
|
||||||
defaultApplyDamage ds cr = (id, doPoisonDam $ foldl' (flip $ \d c -> snd $ applyIndividualDamage d c) cr ds')
|
defaultApplyDamage ds cr = (id, doPoisonDam $ foldl' (flip $ \d c -> snd $ applyIndividualDamage d c) cr ds')
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ defaultGun = Item
|
|||||||
,(ModBulletTarget,DefaultModule)
|
,(ModBulletTarget,DefaultModule)
|
||||||
]
|
]
|
||||||
, _itScope = NoScope
|
, _itScope = NoScope
|
||||||
, _itTargeting' = NoTargeting
|
, _itTargeting = NoTargeting
|
||||||
}
|
}
|
||||||
defaultCraftable :: Item
|
defaultCraftable :: Item
|
||||||
defaultCraftable = Item
|
defaultCraftable = Item
|
||||||
@@ -125,7 +125,7 @@ defaultCraftable = Item
|
|||||||
, _itTweaks = NoTweaks
|
, _itTweaks = NoTweaks
|
||||||
, _itModules = M.empty
|
, _itModules = M.empty
|
||||||
, _itScope = NoScope
|
, _itScope = NoScope
|
||||||
, _itTargeting' = NoTargeting
|
, _itTargeting = NoTargeting
|
||||||
}
|
}
|
||||||
defItDim :: ItemDimension
|
defItDim :: ItemDimension
|
||||||
defItDim = ItemDimension
|
defItDim = ItemDimension
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ bezierGun = defaultGun
|
|||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoBaseMax = 15
|
{ _ammoBaseMax = 15
|
||||||
}
|
}
|
||||||
, _itTargeting' = targetRBPress
|
, _itTargeting = targetRBPress
|
||||||
}
|
}
|
||||||
shootBezier :: Point2 -> Creature -> World -> World
|
shootBezier :: Point2 -> Creature -> World -> World
|
||||||
shootBezier targetp cr w = w & particles .:~ aCurveBulAt
|
shootBezier targetp cr w = w & particles .:~ aCurveBulAt
|
||||||
|
|||||||
@@ -89,49 +89,19 @@ targetRBPress = TargetingOnHeld
|
|||||||
, _tgDraw = targetRBPressDraw
|
, _tgDraw = targetRBPressDraw
|
||||||
}
|
}
|
||||||
targetRBPressDraw :: Int -> Item -> Creature -> World -> Picture
|
targetRBPressDraw :: Int -> Item -> Creature -> World -> Picture
|
||||||
targetRBPressDraw _ it _ w' = fromMaybe mempty $ do
|
targetRBPressDraw _ it _ w = fromMaybe mempty $ do
|
||||||
mwp <- it ^? itTargeting' . tgPos . _Just
|
mwp <- it ^? itTargeting . tgPos . _Just
|
||||||
return $ setLayer 1 $ color red $ onLayer InvLayer $ uncurryV translate mwp
|
return $ setLayer 1 $ color red $ onLayer InvLayer $ uncurryV translate mwp
|
||||||
$ rotate (_cameraRot w')
|
$ rotate (_cameraRot w)
|
||||||
$ pictures
|
$ pictures
|
||||||
[line [V2 x x, V2 (-x) (-x)]
|
[line [V2 x x, V2 (-x) (-x)]
|
||||||
,line [V2 (-x) x, V2 x (-x)]
|
,line [V2 (-x) x, V2 x (-x)]
|
||||||
]
|
]
|
||||||
where
|
where
|
||||||
x = 5 / _cameraZoom w'
|
x = 5 / _cameraZoom w
|
||||||
|
|
||||||
targetRBPressUpdate :: Item -> Creature -> World -> Targeting -> Targeting
|
targetRBPressUpdate :: Item -> Creature -> World -> Targeting -> Targeting
|
||||||
targetRBPressUpdate _ _ w t
|
targetRBPressUpdate _ _ w t
|
||||||
| SDL.ButtonRight `S.member` _mouseButtons w = t
|
| SDL.ButtonRight `S.member` _mouseButtons w = t
|
||||||
& tgPos %~ maybe (Just $ mouseWorldPos w) Just
|
& tgPos %~ maybe (Just $ mouseWorldPos w) Just
|
||||||
| otherwise = t & tgPos %~ const Nothing
|
| otherwise = t & tgPos %~ const Nothing
|
||||||
|
|
||||||
--rbSetTarget :: ItEffect
|
|
||||||
--rbSetTarget = ItInvEffect
|
|
||||||
-- {_itInvEffect = setTarg
|
|
||||||
-- ,_itEffectCounter = 0
|
|
||||||
-- }
|
|
||||||
-- where
|
|
||||||
-- setTarg :: ItEffect -> Creature -> Int -> World -> World
|
|
||||||
-- setTarg _ cr invid w
|
|
||||||
-- | _crInvSel cr /= invid = w
|
|
||||||
-- | SDL.ButtonRight `S.member` _mouseButtons w = w
|
|
||||||
-- & creatures . ix (_crID cr) . crInv . ix invid . itTargeting
|
|
||||||
-- %~ maybe (Just $ targetRBMousePos w) Just
|
|
||||||
-- | otherwise = w & creatures . ix (_crID cr) . crInv . ix invid . itTargeting .~ Nothing
|
|
||||||
|
|
||||||
targetRBMousePos
|
|
||||||
:: World
|
|
||||||
-> (World -> Maybe Point2, Int -> Item -> Creature -> World -> Picture)
|
|
||||||
targetRBMousePos w = (f, \_ _ _ w' -> cursorPic w')
|
|
||||||
where
|
|
||||||
f _ = Just mwp
|
|
||||||
mwp = mouseWorldPos w
|
|
||||||
cursorPic w' = setLayer 1 $ color red $ onLayer InvLayer $ uncurryV translate mwp
|
|
||||||
$ rotate (_cameraRot w')
|
|
||||||
$ pictures
|
|
||||||
[line [V2 x x, V2 (-x) (-x)]
|
|
||||||
,line [V2 (-x) x, V2 x (-x)]
|
|
||||||
]
|
|
||||||
where
|
|
||||||
x = 5 / _cameraZoom w'
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
module Dodge.Item.Weapon.Targeting
|
module Dodge.Item.Weapon.Targeting
|
||||||
where
|
( useTargetPos
|
||||||
|
, removeItTarget
|
||||||
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Geometry.Data
|
import Geometry.Data
|
||||||
|
|
||||||
@@ -10,9 +12,9 @@ useTargetPos
|
|||||||
-> Creature
|
-> Creature
|
||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
useTargetPos f cr w = case cr ^? crInv . ix (_crInvSel cr) . itTargeting' . tgPos of
|
useTargetPos f cr w = case cr ^? crInv . ix (_crInvSel cr) . itTargeting . tgPos of
|
||||||
Nothing -> w
|
Nothing -> w
|
||||||
Just p -> f p cr w
|
Just p -> f p cr w
|
||||||
|
|
||||||
removeItTarget :: Item -> Item
|
removeItTarget :: Item -> Item
|
||||||
removeItTarget = itTargeting' . tgPos .~ Nothing
|
removeItTarget = itTargeting . tgPos .~ Nothing
|
||||||
|
|||||||
Reference in New Issue
Block a user