Implement targeting launcher shells using separate item

This commit is contained in:
2024-09-29 16:24:26 +01:00
parent 7d72fa3c5d
commit 88c3e02459
36 changed files with 747 additions and 610 deletions
+1 -12
View File
@@ -1,12 +1 @@
/home/justin/Haskell/loop/src/Dodge/Creature/Impulse/UseItem.hs:(36,22)-(46,19): warning: [-Wincomplete-patterns] All good (616 modules, at 16:22:03)
Pattern match(es) are non-exhaustive
In a case alternative: Patterns not matched: TargetingUse _ _ _
|
36 | itemEffect cr it w = case it ^. ldtValue . itUse of
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
/home/justin/Haskell/loop/src/Dodge/Item/Display.hs:(109,28)-(121,21): warning: [-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In a case alternative: Patterns not matched: TargetingUse _ _ _
|
109 | itemNumberDisplay cr itm = case iu of
| ^^^^^^^^^^...
+1 -1
View File
File diff suppressed because one or more lines are too long
+9 -1
View File
@@ -246,6 +246,14 @@ inventoryX c = case c of
, megaShellMag , megaShellMag
, homingModule , homingModule
] ]
'V' ->
[targetingScope tt | tt <- [minBound .. maxBound]]
<>
[launcher
, megaShellMag
, homingModule
, remoteScreen
]
_ -> [] _ -> []
testInventory :: [Item] testInventory :: [Item]
@@ -278,7 +286,6 @@ stackedInventory =
, remoteScreen , remoteScreen
, megaShellMag , megaShellMag
, targetingScope TARGETLASER , targetingScope TARGETLASER
, zoomScope
, burstRifle , burstRifle
, megaTinMag , megaTinMag
, teslaGun , teslaGun
@@ -286,6 +293,7 @@ stackedInventory =
, flameThrower , flameThrower
, chemFuelPouch , chemFuelPouch
, bulletSynthesizer , bulletSynthesizer
, zoomScope
, drumMag , drumMag
, launcherX 3 , launcherX 3
, megaShellMag , megaShellMag
+6 -5
View File
@@ -1,7 +1,7 @@
module Dodge.Creature.Impulse.UseItem ( module Dodge.Creature.Impulse.UseItem (
useRootItem, useRootItem,
useItemLeftClick, useItemLeftClick,
itemEffect, itemUseEffect,
useItemHotkey, useItemHotkey,
) where ) where
@@ -29,11 +29,11 @@ useRootItem crid w = fromMaybe w $ do
itRef <- cr ^? crManipulation . manObject . imRootItem itRef <- cr ^? crManipulation . manObject . imRootItem
it <- invTrees (_crInv cr) ^? ix itRef it <- invTrees (_crInv cr) ^? ix itRef
return $ return $
itemEffect cr it w itemUseEffect cr it w
& worldEventFlags . at InventoryChange ?~ () & worldEventFlags . at InventoryChange ?~ ()
itemEffect :: Creature -> LabelDoubleTree ComposeLinkType Item -> World -> World itemUseEffect :: Creature -> LabelDoubleTree ComposeLinkType Item -> World -> World
itemEffect cr it w = case it ^. ldtValue . itUse of itemUseEffect cr it w = case it ^. ldtValue . itUse of
HeldUse{ _heldMods = usemods} -> HeldUse{ _heldMods = usemods} ->
heldEffect usemods it cr w heldEffect usemods it cr w
& pointerToItem itm . itUse . heldHammer .~ HammerDown & pointerToItem itm . itUse . heldHammer .~ HammerDown
@@ -42,6 +42,7 @@ itemEffect cr it w = case it ^. ldtValue . itUse of
(ConsumeUse eff) -> useC eff (_ldtValue it) cr w (ConsumeUse eff) -> useC eff (_ldtValue it) cr w
CraftUse{} -> w CraftUse{} -> w
AttachUse{} -> selectUse it cr w AttachUse{} -> selectUse it cr w
TargetingUse {} -> w
AmmoMagUse{} -> w AmmoMagUse{} -> w
ScopeUse{} -> w ScopeUse{} -> w
where where
@@ -118,7 +119,7 @@ useItemLeftClick' cr' w = fromMaybe w $ do
itRef <- cr ^? crManipulation . manObject . imSelectedItem itRef <- cr ^? crManipulation . manObject . imSelectedItem
it <- invTrees (_crInv cr) ^? ix itRef it <- invTrees (_crInv cr) ^? ix itRef
return $ return $
itemEffect cr it w itemUseEffect cr it w
& worldEventFlags . at InventoryChange ?~ () & worldEventFlags . at InventoryChange ?~ ()
-- & f -- & f
-- where -- where
+86 -20
View File
@@ -3,9 +3,15 @@ module Dodge.Creature.State (
doDamage, doDamage,
) where ) where
import Dodge.Item.Display -- this should not really be imported... TODO move canAttachTargetingBelow import Dodge.Zoning.Creature
import Control.Applicative import FoldableHelp
import Data.Foldable import Data.Maybe
import qualified Data.Map.Strict as M
import qualified SDL
import Dodge.Creature.Test
--import Dodge.Item.Display -- this should not really be imported... TODO move canAttachTargetingBelow
--import Control.Applicative
--import Data.Foldable
--import Data.Maybe --import Data.Maybe
import Dodge.Base import Dodge.Base
import Dodge.Corpse.Make import Dodge.Corpse.Make
@@ -24,7 +30,7 @@ import Dodge.ItEffect
--import Dodge.LightSource.Torch --import Dodge.LightSource.Torch
import Dodge.Prop.Gib import Dodge.Prop.Gib
import Dodge.SoundLogic import Dodge.SoundLogic
import Dodge.Targeting --import Dodge.Targeting
import Geometry import Geometry
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
import LensHelp import LensHelp
@@ -235,19 +241,20 @@ equipmentEffects cr = flip (foldl' $ flip $ useEquipment cr) (IM.keys $ _crInvEq
-- a loop going over all inventory items -- a loop going over all inventory items
invSideEff :: Creature -> World -> World invSideEff :: Creature -> World -> World
invSideEff cr w = invSideEff cr w =
updateTargeting (crGetTargeting cr) cr $ -- updateTargeting (crGetTargeting cr) cr $
-- weaponReloadSounds cr $ -- weaponReloadSounds cr $
IM.foldl' f w (_crInv cr) IM.foldl' f w (_crInv cr)
where where
-- be careful with side effects that affect creature targeting -- be careful with side effects that affect creature targeting
f w' it = f w' it =
itemInvSideEffect cr it $ itemInvSideEffect cr it $
--doItemTargeting i cr w' & maybe id (\g -> doInvEffect g it cr) (it ^? itEffect . ieInv) --doItemTargeting i cr w' & maybe id (\g -> doInvEffect g it cr) (it ^? itEffect . ieInv)
w' & maybe id (\g -> doInvEffect g it cr) (it ^? itEffect . ieInv) w' & maybe id (\g -> doInvEffect g it cr) (it ^? itEffect . ieInv)
itemInvSideEffect :: Creature -> Item -> World -> World itemInvSideEffect :: Creature -> Item -> World -> World
itemInvSideEffect _ _ = id itemInvSideEffect cr itm = case _iyBase $ _itType itm of
TARGETING tt -> updateItemTargeting tt cr itm
_ -> id
--itemInvSideEffect cr it --itemInvSideEffect cr it
-- | hastorchattach = createAttachLight cr it -- | hastorchattach = createAttachLight cr it
-- | otherwise = id -- | otherwise = id
@@ -259,6 +266,65 @@ itemInvSideEffect _ _ = id
-- where -- where
-- attachoff = it ^?! itDimension . dimAttachPos -- attachoff = it ^?! itDimension . dimAttachPos
updateItemTargeting :: TargetingType -> Creature -> Item -> World -> World
updateItemTargeting tt cr itm w = w & case tt of
_ | not isattached
-> cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (_ilInvID $ _itLocation itm) . itUse %~
( (tgPos .~ Nothing)
. (tgActive .~ False)
)
TARGETLASER | crIsAiming cr -> cWorld . lWorld . lasers
.:~ LaserStart
{ _lpPhaseV = 1
, _lpDir = _crDir cr
, _lpPos = sp
, _lpColor = col
, _lpType = TargetingLaser (_itID itm)
}
TARGETLASER -> cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (_ilInvID $ _itLocation itm)
. itUse . tgPos .~ Nothing
TargetRBPress | rbpressed
-> cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (_ilInvID $ _itLocation itm) . itUse %~
( (tgPos %~ maybe (Just $ mouseWorldPos (w ^. input) (w ^. wCam)) Just)
. (tgActive .~ True)
)
TargetRBPress
-> cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (_ilInvID $ _itLocation itm) . itUse %~
( (tgPos .~ Nothing)
. (tgActive .~ False)
)
TargetRBCreature -> cWorld . lWorld . creatures . ix (_crID cr)
. crInv . ix (_ilInvID $ _itLocation itm) . itUse %~ setRBCreatureTargeting cr w
TargetCursor -> cWorld . lWorld . creatures . ix (_crID cr)
. crInv . ix (_ilInvID $ _itLocation itm) . itUse .~ TargetingUse
(Just (mouseWorldPos (w ^. input) (w ^. wCam))) Nothing True
_ -> id
where
isattached = itm ^?! itLocation . ilIsAttached
rbpressed = SDL.ButtonRight `M.member` _mouseButtons (_input w)
sp = _crPos cr +.+ 15 *.* unitVectorAtAngle (_crDir cr)
col = blue -- mixColors reloadFrac (1-reloadFrac) blue red
setRBCreatureTargeting :: Creature -> World -> ItemUse -> ItemUse
setRBCreatureTargeting cr w ituse
| SDL.ButtonRight `M.member` _mouseButtons (_input w) && isJust (ituse ^? tgID . _Just)
&& canSeeTarget = ituse & updatePos & tgActive .~ True
| otherwise = ituse & tgID .~ fmap _crID newtarg & updatePos & tgActive .~ False
where
newtarg =
safeMinimumOn (dist mwp . _crPos)
. filter (canseepos . _crPos)
$ crsNearCirc mwp 40 w
canseepos p = hasLOS (_crPos cr) p w
mwp = mouseWorldPos (w ^. input) (w ^. wCam)
updatePos t' = t' & tgPos .~ posFromMaybeID (_tgID t')
posFromMaybeID Nothing = Nothing
posFromMaybeID (Just i) = w ^? cWorld . lWorld . creatures . ix i . crPos
canSeeTarget = fromMaybe False $ do
cid <- ituse ^? tgID . _Just
cpos <- w ^? cWorld . lWorld . creatures . ix cid . crPos
Just $ hasLOS cpos (_crPos cr) w
itemUpdate :: Item -> Item itemUpdate :: Item -> Item
itemUpdate = itemUpdate =
updateAutoRecharge updateAutoRecharge
@@ -280,19 +346,19 @@ updateAutoRecharge it = case it ^? itUse . leftConsumption of
-- I feel like there should be a centralised function that supersumes this -- I feel like there should be a centralised function that supersumes this
-- i.e. a function that deals with all states that depend upon item positioning -- i.e. a function that deals with all states that depend upon item positioning
-- in the inventory -- in the inventory
crGetTargeting :: Creature -> Maybe TargetType --crGetTargeting :: Creature -> Maybe TargetingType
crGetTargeting cr = do --crGetTargeting cr = do
i <- cr ^? crManipulation . manObject . imRootItem -- i <- cr ^? crManipulation . manObject . imRootItem
itm <- cr ^? crInv . ix i -- itm <- cr ^? crInv . ix i
itm ^? itType . iyModules . ix ModTarget . imtTargetType -- itm ^? itType . iyModules . ix ModTarget . imtTargetType
<|> do -- <|> do
tt <- cr ^? crInv . ix (i-1) . itType . iyBase . ibtAttach . ibtAttachTarget -- tt <- cr ^? crInv . ix (i-1) . itType . iyBase . ibtTargeting
guard (canAttachTargeting tt itm) -- guard (canAttachTargeting tt itm)
return tt -- return tt
<|> do -- <|> do
tt <- cr ^? crInv . ix (i+1) . itUse . equipTargeting . _Just -- tt <- cr ^? crInv . ix (i+1) . itUse . equipTargeting . _Just
guard (canAttachTargeting tt itm) -- guard (canAttachTargeting tt itm)
return tt -- return tt
--weaponReloadSounds :: Creature -> World -> World --weaponReloadSounds :: Creature -> World -> World
--weaponReloadSounds cr w = case cr ^? crManipulation . manObject . inInventory . iselAction of --weaponReloadSounds cr w = case cr ^? crManipulation . manObject . inInventory . iselAction of
+2 -2
View File
@@ -77,14 +77,14 @@ data Creature = Creature
, _crName :: String , _crName :: String
, _crStatistics :: CreatureStatistics , _crStatistics :: CreatureStatistics
, _crCamouflage :: CamouflageStatus , _crCamouflage :: CamouflageStatus
, _crTargeting :: CreatureTargeting -- , _crTargeting :: CreatureTargeting
} }
--deriving (Eq, Show, Read) --Generic, Flat) --deriving (Eq, Show, Read) --Generic, Flat)
data CreatureTargeting = CreatureTargeting data CreatureTargeting = CreatureTargeting
{ _ctPos :: Maybe Point2 { _ctPos :: Maybe Point2
, _ctType :: Maybe TargetType , _ctType :: Maybe TargetingType
, _ctID :: Maybe Int , _ctID :: Maybe Int
, _ctActive :: Bool , _ctActive :: Bool
} }
+4 -4
View File
@@ -77,7 +77,7 @@ data CraftType
| TIMEMODULE | TIMEMODULE
| SIZEMODULE | SIZEMODULE
| GRAVITYMODULE | GRAVITYMODULE
| TARGETMODULE TargetType | TARGETMODULE TargetingType
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read)
--deriving (Eq, Ord, Show, Enum, Read) --Generic, Flat) --deriving (Eq, Ord, Show, Enum, Read) --Generic, Flat)
@@ -90,13 +90,13 @@ data ItemBaseType
| CRAFT CraftType | CRAFT CraftType
| ATTACH {_ibtAttach :: AttachType} | ATTACH {_ibtAttach :: AttachType}
| AMMOMAG {_ibtAmmoMag :: AmmoMagType} | AMMOMAG {_ibtAmmoMag :: AmmoMagType}
| TARGETING {_ibtTargeting :: TargetingType}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read)
--deriving (Eq, Ord, Show, Read) --Generic, Flat) --deriving (Eq, Ord, Show, Read) --Generic, Flat)
data AttachType data AttachType
= ZOOMSCOPE = ZOOMSCOPE
| TARGETATTACH {_ibtAttachTarget :: TargetType}
| BULLETSYNTHESIZER | BULLETSYNTHESIZER
| REMOTESCREEN | REMOTESCREEN
| HOMINGMODULE | HOMINGMODULE
@@ -130,7 +130,7 @@ data EquipItemType
| INVISIBILITYEQUIPMENT EquipSite | INVISIBILITYEQUIPMENT EquipSite
| BRAINHAT | BRAINHAT
| HAT | HAT
| TARGETINGHAT TargetType | TARGETINGHAT TargetingType
| HEADLAMP | HEADLAMP
| POWERLEGS | POWERLEGS
| SPEEDLEGS | SPEEDLEGS
@@ -208,7 +208,7 @@ data ItemModuleType
| BULPAY BulletSpawn | BULPAY BulletSpawn
| BULBODY BulletEffect | BULBODY BulletEffect
| BULTRAJ {_imtBulletTrajectoryType :: BulletTrajectoryType} | BULTRAJ {_imtBulletTrajectoryType :: BulletTrajectoryType}
| TARGET {_imtTargetType :: TargetType} | TARGET {_imtTargetType :: TargetingType}
| INCENDLAS | INCENDLAS
| SPLITLAS | SPLITLAS
| STATICLAS | STATICLAS
+2 -2
View File
@@ -8,7 +8,7 @@ module Dodge.Data.Item.Targeting where
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
data TargetType data TargetingType
= TARGETLASER = TARGETLASER
| TargetRBPress | TargetRBPress
| TargetRBLine | TargetRBLine
@@ -16,4 +16,4 @@ data TargetType
| TargetCursor | TargetCursor
deriving (Eq, Ord, Show, Read, Enum, Bounded) --Generic, Flat) deriving (Eq, Ord, Show, Read, Enum, Bounded) --Generic, Flat)
deriveJSON defaultOptions ''TargetType deriveJSON defaultOptions ''TargetingType
+1 -1
View File
@@ -57,7 +57,7 @@ data ItemUse
} }
| EquipUse | EquipUse
{ _equipEffect :: EquipEffect { _equipEffect :: EquipEffect
, _equipTargeting :: Maybe TargetType , _equipTargeting :: Maybe TargetingType
} }
| CraftUse | CraftUse
| -- {_useAmount :: ItAmount} | -- {_useAmount :: ItAmount}
+9 -1
View File
@@ -20,10 +20,16 @@ import Dodge.Data.Payload
data ProjectileDraw = DrawShell | DrawRemoteShell | DrawDrone | DrawBlankProjectile data ProjectileDraw = DrawShell | DrawRemoteShell | DrawDrone | DrawBlankProjectile
deriving (Show, Eq, Ord, Enum, Bounded, Read) --Generic, Flat) deriving (Show, Eq, Ord, Enum, Bounded, Read) --Generic, Flat)
data ProjectileHoming
= NoHoming
| HomeUsingRemoteScreen {_phRemoteID :: NewInt ItmInt}
| HomeUsingTargeting {_phTargetingID :: NewInt ItmInt}
deriving (Show, Eq, Ord, Read) --Generic, Flat)
data ProjectileUpdate data ProjectileUpdate
= ThrustPU {_pjuStart :: Int, _pjuEnd :: Int} = ThrustPU {_pjuStart :: Int, _pjuEnd :: Int}
| StartSpinPU {_pjuTime :: Int, _pjuCID :: Int, _pjuSpinAmound :: Int} | StartSpinPU {_pjuTime :: Int, _pjuCID :: Int, _pjuSpinAmound :: Int}
| RemoteDirectionPU {_pjuStart :: Int, _pjuEnd :: Int, _pjuControllerID :: Maybe (NewInt ItmInt)} | RemoteDirectionPU {_pjuStart :: Int, _pjuEnd :: Int, _pjuControllerID :: ProjectileHoming}
| ReduceSpinPU {_pjuReduceSpin :: Float} | ReduceSpinPU {_pjuReduceSpin :: Float}
| DestroyPU {_pjuScreenID :: Maybe (NewInt ItmInt), _pjuTimer :: Int} | DestroyPU {_pjuScreenID :: Maybe (NewInt ItmInt), _pjuTimer :: Int}
| TimePU | TimePU
@@ -50,7 +56,9 @@ data GasCreate = CreatePoisonGas | CreateFlame
makeLenses ''ProjectileUpdate makeLenses ''ProjectileUpdate
makeLenses ''AmmoType makeLenses ''AmmoType
makeLenses ''ProjectileHoming
deriveJSON defaultOptions ''GasFuel deriveJSON defaultOptions ''GasFuel
deriveJSON defaultOptions ''ProjectileHoming
deriveJSON defaultOptions ''ProjectileDraw deriveJSON defaultOptions ''ProjectileDraw
deriveJSON defaultOptions ''ProjectileUpdate deriveJSON defaultOptions ''ProjectileUpdate
deriveJSON defaultOptions ''GasCreate deriveJSON defaultOptions ''GasCreate
+2 -2
View File
@@ -31,7 +31,7 @@ module Dodge.Data.LWorld (
module Dodge.Data.Machine, module Dodge.Data.Machine,
module Dodge.Data.Magnet, module Dodge.Data.Magnet,
module Dodge.Data.Modification, module Dodge.Data.Modification,
module Dodge.Data.PathGraph, -- module Dodge.Data.PathGraph,
module Dodge.Data.PosEvent, module Dodge.Data.PosEvent,
module Dodge.Data.PressPlate, module Dodge.Data.PressPlate,
module Dodge.Data.Projectile, module Dodge.Data.Projectile,
@@ -77,7 +77,7 @@ import Dodge.Data.LinearShockwave
import Dodge.Data.Machine import Dodge.Data.Machine
import Dodge.Data.Magnet import Dodge.Data.Magnet
import Dodge.Data.Modification import Dodge.Data.Modification
import Dodge.Data.PathGraph --import Dodge.Data.PathGraph
import Dodge.Data.PosEvent import Dodge.Data.PosEvent
import Dodge.Data.PressPlate import Dodge.Data.PressPlate
import Dodge.Data.Projectile import Dodge.Data.Projectile
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Laser where module Dodge.Data.Laser where
import NewInt
import Dodge.Data.Item.Location
import Color import Color
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -13,7 +15,7 @@ import Geometry.Data
data LaserType data LaserType
= DamageLaser {_laserTypeDamage :: Int} = DamageLaser {_laserTypeDamage :: Int}
| TargetingLaser | TargetingLaser {_laserEmmiter :: NewInt ItmInt}
deriving (Eq, Ord, Show, Read) --Generic, Flat) deriving (Eq, Ord, Show, Read) --Generic, Flat)
data LaserStart = LaserStart data LaserStart = LaserStart
+10 -10
View File
@@ -18,17 +18,17 @@ import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import Data.Graph.Inductive import Data.Graph.Inductive
import Data.Map.Strict (Map) --import Data.Map.Strict (Map)
import qualified Data.Set as Set import qualified Data.Set as Set
import Geometry.Data import Geometry.Data
data PathGraph = PathGraph --data PathGraph = PathGraph
{ _pgGraph :: Gr Point2 PathEdge -- { _pgGraph :: Gr Point2 PathEdge
, _pgNodeMap :: Map Point2 Int -- , _pgNodeMap :: Map Point2 Int
, _pgNodeCount :: Int -- , _pgNodeCount :: Int
, _pgEdgeMap :: Map (V2 Point2) PathEdgeNodes -- , _pgEdgeMap :: Map (V2 Point2) PathEdgeNodes
} -- }
deriving (Eq, Show, Read) --, Generic) -- deriving (Eq, Show, Read) --, Generic)
data PathEdgeNodes = PathEdgeNodes data PathEdgeNodes = PathEdgeNodes
{ _penStart :: Int { _penStart :: Int
@@ -59,11 +59,11 @@ data EdgeObstacle
--deriving instance (Flat (Gr Point2 PathEdge)) --deriving instance (Flat (Gr Point2 PathEdge))
makeLenses ''PathGraph --makeLenses ''PathGraph
makeLenses ''PathEdge makeLenses ''PathEdge
makeLenses ''PathEdgeNodes makeLenses ''PathEdgeNodes
deriveJSON defaultOptions ''EdgeObstacle deriveJSON defaultOptions ''EdgeObstacle
deriveJSON defaultOptions ''PathEdge deriveJSON defaultOptions ''PathEdge
deriveJSON defaultOptions ''PathEdgeNodes deriveJSON defaultOptions ''PathEdgeNodes
deriveJSON defaultOptions ''Gr deriveJSON defaultOptions ''Gr
deriveJSON defaultOptions ''PathGraph --deriveJSON defaultOptions ''PathGraph
+1 -1
View File
@@ -57,7 +57,7 @@ defaultCreature =
, _crName = "DEFAULTCRNAME" , _crName = "DEFAULTCRNAME"
, _crStatistics = CreatureStatistics 50 50 50 , _crStatistics = CreatureStatistics 50 50 50
, _crCamouflage = FullyVisible , _crCamouflage = FullyVisible
, _crTargeting = defaultCreatureTargeting -- , _crTargeting = defaultCreatureTargeting
} }
defaultCreatureTargeting :: CreatureTargeting defaultCreatureTargeting :: CreatureTargeting
+41 -24
View File
@@ -18,7 +18,7 @@ import Dodge.Data.DoubleTree
--import Color --import Color
import Data.Maybe import Data.Maybe
--import Data.Traversable --import Data.Traversable
import Dodge.Base.Coordinate --import Dodge.Base.Coordinate
--import Dodge.Bullet --import Dodge.Bullet
import Dodge.Creature.HandPos import Dodge.Creature.HandPos
import Dodge.Data.World import Dodge.Data.World
@@ -31,11 +31,11 @@ import Dodge.Item.Weapon.TriggerType
import Dodge.Projectile.Create import Dodge.Projectile.Create
import Dodge.SoundLogic import Dodge.SoundLogic
import Dodge.Tesla.Arc import Dodge.Tesla.Arc
import Dodge.Wall.ForceField --import Dodge.Wall.ForceField
import Dodge.Wall.Move --import Dodge.Wall.Move
import Dodge.WorldEvent.Flash import Dodge.WorldEvent.Flash
import Geometry import Geometry
import qualified IntMapHelp as IM --import qualified IntMapHelp as IM
import LensHelp import LensHelp
import RandomHelp import RandomHelp
import Sound.Data import Sound.Data
@@ -55,7 +55,7 @@ bulGunEffect' :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> Wo
bulGunEffect' t cr w = fromMaybe (error "error in bulGunEffect") $ do bulGunEffect' t cr w = fromMaybe (error "error in bulGunEffect") $ do
muzzles <- t ^? ldtValue . itUse . heldAim . aimMuzzles muzzles <- t ^? ldtValue . itUse . heldAim . aimMuzzles
let (upitm,loadedmuzzles) = mapAccumR loadMuzzle t muzzles let (upitm,loadedmuzzles) = mapAccumR loadMuzzle t muzzles
cmew = foldl' (useLoadedAmmo (_ldtValue t) cr) (CME 0 0 False,w) $ zip [0..] loadedmuzzles cmew = foldl' (useLoadedAmmo t cr) (CME 0 0 False,w) $ zip [0..] loadedmuzzles
return $ uncurry (applyCME (_ldtValue t) cr) cmew return $ uncurry (applyCME (_ldtValue t) cr) cmew
& cWorld . lWorld . lTestString .~ map (show . _mzAmmoSlot) muzzles & cWorld . lWorld . lTestString .~ map (show . _mzAmmoSlot) muzzles
& doWeaponRepetitions upitm cr & doWeaponRepetitions upitm cr
@@ -184,23 +184,26 @@ isAmmoIntLink :: Int -> ComposeLinkType -> Bool
isAmmoIntLink i (AmmoInLink j _) = i == j isAmmoIntLink i (AmmoInLink j _) = i == j
isAmmoIntLink _ _ = False isAmmoIntLink _ _ = False
useLoadedAmmo :: Item -> Creature -> (CumulativeMuzzleEffect,World) useLoadedAmmo :: LabelDoubleTree ComposeLinkType Item
-> Creature
-> (CumulativeMuzzleEffect,World)
-> (Int,Maybe (Muzzle,Int,LabelDoubleTree ComposeLinkType Item)) -> (Int,Maybe (Muzzle,Int,LabelDoubleTree ComposeLinkType Item))
-> (CumulativeMuzzleEffect,World) -> (CumulativeMuzzleEffect,World)
useLoadedAmmo _ _ (cme,w) (_,Nothing) = (cme, w) useLoadedAmmo _ _ (cme,w) (_,Nothing) = (cme, w)
useLoadedAmmo itm cr (cme,w) (mzid,Just (mz,x,magtree)) = (,) (cme & cmeSound .~ True) $ useLoadedAmmo itmtree cr (cme,w) (mzid,Just (mz,x,magtree)) = (,) (cme & cmeSound .~ True) $
removeAmmoFromMag x mid cr . makeMuzzleFlare mz itm cr $ case _mzEffect mz of removeAmmoFromMag x mid cr . makeMuzzleFlare mz itm cr $ case _mzEffect mz of
MuzzleShootBullet -> shootBullet itm cr w (mz,x,mid) MuzzleShootBullet -> shootBullet itm cr w (mz,x,mid)
MuzzleLaser -> shootLaser' itm cr mz w MuzzleLaser -> shootLaser' itm cr mz w
MuzzleTesla -> shootTeslaArc itm cr mz w MuzzleTesla -> shootTeslaArc itm cr mz w
MuzzleTractor -> shootTractorBeam itm cr w MuzzleTractor -> shootTractorBeam itm cr w
MuzzleLauncher -> createProjectile magtree mz itm cr w MuzzleLauncher -> createProjectile magtree mz itmtree cr w
MuzzleNozzle {} -> useGasParams mid mz itm cr $ walkNozzle mzid mz itm cr w MuzzleNozzle {} -> useGasParams mid mz itm cr $ walkNozzle mzid mz itm cr w
MuzzleShatter -> shootShatter itm cr w MuzzleShatter -> shootShatter itm cr w
MuzzleForceField -> useForceFieldGun itm cr w MuzzleForceField -> useForceFieldGun itm cr w
MuzzleDetector -> itemDetectorEffect itm cr w MuzzleDetector -> itemDetectorEffect itm cr w
where where
mid = magtree ^? ldtValue . itLocation . ilInvID mid = magtree ^? ldtValue . itLocation . ilInvID
itm = itmtree ^. ldtValue
itemDetectorEffect :: Item -> Creature -> World -> World itemDetectorEffect :: Item -> Creature -> World -> World
itemDetectorEffect itm cr w = fromMaybe w $ do itemDetectorEffect itm cr w = fromMaybe w $ do
@@ -485,32 +488,46 @@ shootTeslaArc itm cr mz w =
-- the rmb, it is possible for this to do nothing -- the rmb, it is possible for this to do nothing
-- TODO investigate more and fix -- TODO investigate more and fix
useForceFieldGun :: Item -> Creature -> World -> World useForceFieldGun :: Item -> Creature -> World -> World
useForceFieldGun itm cr w = fromMaybe w $ do useForceFieldGun _ _ = id
a <- cr ^? crTargeting . ctPos . _Just --useForceFieldGun itm cr w = fromMaybe w $ do
let mwp = mouseWorldPos (w ^. input) (w ^. wCam) -- a <- cr ^? crTargeting . ctPos . _Just
b = if dist a mwp < 100 then mwp else a +.+ 100 *.* normalizeV (mwp -.- a) -- let mwp = mouseWorldPos (w ^. input) (w ^. wCam)
wlline = (a, b) -- b = if dist a mwp < 100 then mwp else a +.+ 100 *.* normalizeV (mwp -.- a)
return $ -- wlline = (a, b)
w -- return $
& cWorld . lWorld . walls %~ IM.insertWith (\_ x -> x) i forceField{_wlID = i} -- w
& cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (_ilInvID (_itLocation itm)) . itParams . paramMID ?~ i -- & cWorld . lWorld . walls %~ IM.insertWith (\_ x -> x) i forceField{_wlID = i}
& moveWallIDUnsafe i wlline -- & cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (_ilInvID (_itLocation itm)) . itParams . paramMID ?~ i
where -- & moveWallIDUnsafe i wlline
i = fromMaybe (IM.newKey (_walls (_lWorld (_cWorld w)))) $ itm ^? itParams . paramMID . _Just -- where
-- i = fromMaybe (IM.newKey (_walls (_lWorld (_cWorld w)))) $ itm ^? itParams . paramMID . _Just
determineProjectileTracking :: LabelDoubleTree ComposeLinkType Item
-> LabelDoubleTree ComposeLinkType Item
-> ProjectileHoming
determineProjectileTracking magtree itmtree = case lookup RemoteScreenLink (magtree ^. ldtLeft) of
Just screen -> HomeUsingRemoteScreen (screen ^. ldtValue . itID)
Nothing -> fromMaybe NoHoming $ do
_ <- lookup AmmoTargetingLink (magtree ^. ldtLeft) -- should not have to give a direction
targetingtree <- lookup WeaponTargetingLink (itmtree ^. ldtRight) -- left or right for these
return $ HomeUsingTargeting (targetingtree ^. ldtValue . itID)
createProjectile createProjectile
:: LabelDoubleTree ComposeLinkType Item :: LabelDoubleTree ComposeLinkType Item
-> Muzzle -> Item -> Creature -> World -> World -> Muzzle
createProjectile magtree muz itm cr = fromMaybe failsound $ do -> LabelDoubleTree ComposeLinkType Item
-> Creature -> World -> World
createProjectile magtree muz itmtree cr = fromMaybe failsound $ do
magid <- magtree ^? ldtValue . itLocation . ilInvID magid <- magtree ^? ldtValue . itLocation . ilInvID
ammoitem <- cr ^? crInv . ix magid ammoitem <- cr ^? crInv . ix magid
let mscreen = lookup RemoteScreenLink (magtree ^. ldtLeft) let homing = determineProjectileTracking magtree itmtree
j <- ammoitem ^? itLocation . ilInvID j <- ammoitem ^? itLocation . ilInvID
aparams <- ammoitem ^? itUse . amagParams aparams <- ammoitem ^? itUse . amagParams
return $ createShell (mscreen ^? _Just . ldtValue) aparams muz itm cr return $ createShell homing aparams muz itm cr
. startthesound . startthesound
. useammo j . useammo j
where where
itm = itmtree ^. ldtValue
useammo j = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix j . itUse . amagLoadStatus . iaLoaded -~ 1 useammo j = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix j . itUse . amagLoadStatus . iaLoaded -~ 1
-- the sound should be moved to the projectile firing -- the sound should be moved to the projectile firing
+1 -1
View File
@@ -25,6 +25,7 @@ itemFromBase ibt = case ibt of
CRAFT cr -> makeTypeCraft cr CRAFT cr -> makeTypeCraft cr
ATTACH at -> itemFromAttachType at ATTACH at -> itemFromAttachType at
AMMOMAG t -> itemFromAmmoMag t AMMOMAG t -> itemFromAmmoMag t
TARGETING tt -> targetingScope tt
itemFromAmmoMag :: AmmoMagType -> Item itemFromAmmoMag :: AmmoMagType -> Item
itemFromAmmoMag at = case at of itemFromAmmoMag at = case at of
@@ -39,7 +40,6 @@ itemFromAmmoMag at = case at of
itemFromAttachType :: AttachType -> Item itemFromAttachType :: AttachType -> Item
itemFromAttachType at = case at of itemFromAttachType at = case at of
ZOOMSCOPE -> zoomScope ZOOMSCOPE -> zoomScope
TARGETATTACH tt -> targetingScope tt
BULLETSYNTHESIZER -> bulletSynthesizer BULLETSYNTHESIZER -> bulletSynthesizer
REMOTESCREEN -> remoteScreen REMOTESCREEN -> remoteScreen
-- ROCKETHOMER -> rocketHomer -- ROCKETHOMER -> rocketHomer
+4 -2
View File
@@ -16,7 +16,7 @@ import Dodge.Module
import LensHelp import LensHelp
import Padding import Padding
canAttachTargeting :: TargetType -> Item -> Bool canAttachTargeting :: TargetingType -> Item -> Bool
canAttachTargeting TARGETLASER _ = True canAttachTargeting TARGETLASER _ = True
canAttachTargeting _ itm = canAttachTargeting _ itm =
isJust (itm ^? itType . iyModules . ix ModBulletTrajectory . imtBulletTrajectoryType) isJust (itm ^? itType . iyModules . ix ModBulletTrajectory . imtBulletTrajectoryType)
@@ -70,11 +70,12 @@ itemBaseName itm = case _iyBase $ _itType itm of
CONSUMABLE cit -> show cit CONSUMABLE cit -> show cit
ATTACH ait -> showAttachItem ait itm ATTACH ait -> showAttachItem ait itm
AMMOMAG ait -> show ait AMMOMAG ait -> show ait
TARGETING tt -> show tt
showAttachItem :: AttachType -> Item -> String showAttachItem :: AttachType -> Item -> String
showAttachItem t itm = case t of showAttachItem t itm = case t of
ZOOMSCOPE -> "ZOOMSCOPE" ZOOMSCOPE -> "ZOOMSCOPE"
TARGETATTACH x -> show x -- TARGETATTACH x -> show x
BULLETSYNTHESIZER -> "BSYNTH" BULLETSYNTHESIZER -> "BSYNTH"
REMOTESCREEN -> "REMOTE SCREEN " ++ show (itm ^? itUse . atLinkedProjectile . _Just) REMOTESCREEN -> "REMOTE SCREEN " ++ show (itm ^? itUse . atLinkedProjectile . _Just)
HOMINGMODULE -> "HOMING MOD" HOMINGMODULE -> "HOMING MOD"
@@ -119,6 +120,7 @@ itemNumberDisplay cr itm = case iu of
AmmoMagUse {} -> [showLoadedAmount itm] AmmoMagUse {} -> [showLoadedAmount itm]
ScopeUse OpticScope {_opticZoom = x} -> [show x] ScopeUse OpticScope {_opticZoom = x} -> [show x]
ScopeUse {} -> [] ScopeUse {} -> []
TargetingUse {_tgPos = mp} -> [maybe "" show mp]
-- this could be cleaner here... -- this could be cleaner here...
where where
iu = itm ^?! itUse iu = itm ^?! itUse
+1
View File
@@ -34,6 +34,7 @@ itemSPic it =
CONSUMABLE{} -> defSPic CONSUMABLE{} -> defSPic
ATTACH {} -> defSPic ATTACH {} -> defSPic
AMMOMAG {} -> defSPic AMMOMAG {} -> defSPic
TARGETING {} -> defSPic
equipItemSPic :: EquipItemType -> Item -> SPic equipItemSPic :: EquipItemType -> Item -> SPic
equipItemSPic et _ = case et of equipItemSPic et _ = case et of
+1 -1
View File
@@ -108,7 +108,7 @@ hat =
& itUse . equipEffect . eeSite .~ GoesOnHead & itUse . equipEffect . eeSite .~ GoesOnHead
& itType . iyBase .~ EQUIP HAT & itType . iyBase .~ EQUIP HAT
targetingHat :: TargetType -> Item targetingHat :: TargetingType -> Item
targetingHat tt = targetingHat tt =
defaultEquipment defaultEquipment
& itUse . equipEffect . eeSite .~ GoesOnHead & itUse . equipEffect . eeSite .~ GoesOnHead
+1 -1
View File
@@ -38,7 +38,7 @@ basePartiallyComposedItem itm = case itm ^. itType . iyBase of
[(WeaponTargetingSF,WeaponTargetingLink), (WeaponScopeSF,WeaponScopeLink)] [(WeaponTargetingSF,WeaponTargetingLink), (WeaponScopeSF,WeaponScopeLink)]
) )
AMMOMAG _ -> ammoComposedItem itm AMMOMAG _ -> ammoComposedItem itm
ATTACH TARGETATTACH{} -> (itm,WeaponTargetingSF, LinkTest (const Nothing) (const Nothing)) TARGETING {} -> (itm,WeaponTargetingSF, LinkTest (const Nothing) (const Nothing))
ATTACH ZOOMSCOPE -> (itm,WeaponScopeSF, LinkTest (const Nothing) (const Nothing)) ATTACH ZOOMSCOPE -> (itm,WeaponScopeSF, LinkTest (const Nothing) (const Nothing))
ATTACH HOMINGMODULE -> (itm,AmmoTargetingSF ProjectileAmmo, LinkTest (const Nothing) (const Nothing)) ATTACH HOMINGMODULE -> (itm,AmmoTargetingSF ProjectileAmmo, LinkTest (const Nothing) (const Nothing))
ATTACH REMOTESCREEN -> (itm,RemoteScreenSF, LinkTest (const Nothing) (const Nothing)) ATTACH REMOTESCREEN -> (itm,RemoteScreenSF, LinkTest (const Nothing) (const Nothing))
+1 -1
View File
@@ -138,7 +138,7 @@ equipInfo eit = case eit of
BATTERYPACK -> "A collection of batteries with a universal adapter." BATTERYPACK -> "A collection of batteries with a universal adapter."
AUTODETECTOR d -> "A device that detects " ++ detectorInfo d ++ " in an expanding radius. Pulses automatically. " AUTODETECTOR d -> "A device that detects " ++ detectorInfo d ++ " in an expanding radius. Pulses automatically. "
targetingInfo :: TargetType -> String targetingInfo :: TargetingType -> String
targetingInfo tt = case tt of targetingInfo tt = case tt of
TARGETLASER -> "creates a laser, the end of which becomes the target." TARGETLASER -> "creates a laser, the end of which becomes the target."
TargetRBPress -> "creates a fixed target." TargetRBPress -> "creates a fixed target."
+1
View File
@@ -12,4 +12,5 @@ itemInvColor itm = case itm ^. itType . iyBase of
CONSUMABLE {} -> blue CONSUMABLE {} -> blue
CRAFT {} -> green CRAFT {} -> green
ATTACH {} -> orange ATTACH {} -> orange
TARGETING {} -> chartreuse
AMMOMAG {} -> greyN 0.8 AMMOMAG {} -> greyN 0.8
+11
View File
@@ -1,4 +1,5 @@
module Dodge.Item.Location ( module Dodge.Item.Location (
pointerToItemID,
pointerToItemLocation, pointerToItemLocation,
getItem, getItem,
pointerToItem, pointerToItem,
@@ -50,3 +51,13 @@ pointerToItem ::
World -> World ->
f World f World
pointerToItem = pointerToItemLocation . _itLocation pointerToItem = pointerToItemLocation . _itLocation
pointerToItemID ::
Applicative f =>
NewInt ItmInt ->
(Item -> f Item) ->
World ->
f World
pointerToItemID itid f w = fromMaybe (pure w) $ do
itloc <- w ^? cWorld . lWorld . itemLocations . ix (_unNInt itid)
return $ pointerToItemLocation itloc f w
+3 -3
View File
@@ -16,11 +16,11 @@ zoomScope =
-- & itUse .~ AttachUse (ScrollAttachParams (ZoomScrollParams{_opticPos = 0, _opticZoom = 1, _opticDefaultZoom = 0.5})) -- & itUse .~ AttachUse (ScrollAttachParams (ZoomScrollParams{_opticPos = 0, _opticZoom = 1, _opticDefaultZoom = 0.5}))
& itUse .~ ScopeUse OpticScope{_opticPos = 0, _opticZoom = 1, _opticDefaultZoom = 0.5} & itUse .~ ScopeUse OpticScope{_opticPos = 0, _opticZoom = 1, _opticDefaultZoom = 0.5}
targetingScope :: TargetType -> Item targetingScope :: TargetingType -> Item
targetingScope tt = targetingScope tt =
defaultHeldItem defaultHeldItem
& itType . iyBase .~ ATTACH (TARGETATTACH tt) & itType . iyBase .~ TARGETING tt
& itUse .~ AttachUse Nothing & itUse .~ TargetingUse Nothing Nothing False
homingModule :: Item homingModule :: Item
homingModule = homingModule =
+12 -12
View File
@@ -1,16 +1,16 @@
module Dodge.Item.Weapon.Targeting ( module Dodge.Item.Weapon.Targeting (
useTargetPos, -- useTargetPos,
) where ) where
import Control.Lens --import Control.Lens
import Dodge.Data.World --import Dodge.Data.World
import Geometry.Data --import Geometry.Data
useTargetPos :: --useTargetPos ::
(Maybe Point2 -> Creature -> World -> World) -> -- (Maybe Point2 -> Creature -> World -> World) ->
Creature -> -- Creature ->
World -> -- World ->
World -- World
useTargetPos f cr w = case cr ^? crTargeting . ctPos of --useTargetPos f cr w = case cr ^? crTargeting . ctPos of
Nothing -> w -- Nothing -> w
Just p -> f p cr w -- Just p -> f p cr w
+9 -6
View File
@@ -1,7 +1,10 @@
module Dodge.Laser.Update where module Dodge.Laser.Update
( updateLaser
) where
import Dodge.Item.Location
import Control.Lens import Control.Lens
import Data.Maybe --import Data.Maybe
import Dodge.Data.World import Dodge.Data.World
import Dodge.Item.Weapon.LaserPath import Dodge.Item.Weapon.LaserPath
import Dodge.WorldEvent.Damage import Dodge.WorldEvent.Damage
@@ -9,13 +12,13 @@ import Geometry
updateLaser :: World -> LaserStart -> (World, Laser) updateLaser :: World -> LaserStart -> (World, Laser)
updateLaser w pt = updateLaser w pt =
( w' ( case _lpType pt of
DamageLaser dam -> damThingHitWith
(\p1 p2 p3 -> Damage LASERING dam p1 p2 p3 NoDamageEffect) sp xp thHit w
TargetingLaser itid -> w & pointerToItemID itid . itUse . tgPos ?~ last ps
, Laser{_lzPoints = sp : ps, _lzColor = _lpColor pt, _lzType = _lpType pt} , Laser{_lzPoints = sp : ps, _lzColor = _lpColor pt, _lzType = _lpType pt}
) )
where where
w' = fromMaybe w $ do
dam <- pt ^? lpType . laserTypeDamage
return $ damThingHitWith (\p1 p2 p3 -> Damage LASERING dam p1 p2 p3 NoDamageEffect) sp xp thHit w
phasev = _lpPhaseV pt phasev = _lpPhaseV pt
sp = _lpPos pt sp = _lpPos pt
dir = _lpDir pt dir = _lpDir pt
+14 -9
View File
@@ -2,15 +2,22 @@ module Dodge.Projectile.Create (
createShell, createShell,
) where ) where
import Dodge.Item.Location
import Data.Maybe import Data.Maybe
import Dodge.Data.World import Dodge.Data.World
import Geometry import Geometry
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
import LensHelp import LensHelp
homingDrawType :: ProjectileHoming -> ProjectileDraw
homingDrawType ht = case ht of
NoHoming -> DrawShell
HomeUsingRemoteScreen {} -> DrawRemoteShell
HomeUsingTargeting {} -> DrawRemoteShell
-- assumes the mscreen is in your inventory -- assumes the mscreen is in your inventory
createShell :: Maybe Item -> AmmoParams -> Muzzle -> Item -> Creature -> World -> World createShell :: ProjectileHoming -> AmmoParams -> Muzzle -> Item -> Creature -> World -> World
createShell mscreen aparams muz it cr w = w createShell homing aparams muz it cr w = w
& updatescreen & updatescreen
& cWorld . lWorld . projectiles . at i & cWorld . lWorld . projectiles . at i
?~ Shell ?~ Shell
@@ -18,7 +25,7 @@ createShell mscreen aparams muz it cr w = w
, _prjZ = 20 , _prjZ = 20
, _prjStartPos = pos , _prjStartPos = pos
, _prjVel = rotateV dir (V2 1 0) , _prjVel = rotateV dir (V2 1 0)
, _prjDraw = maybe DrawShell (const DrawRemoteShell) mscreen , _prjDraw = homingDrawType homing
, _prjID = i , _prjID = i
, _prjAcc = rotateV dir (V2 3 0) , _prjAcc = rotateV dir (V2 3 0)
, _prjDir = dir , _prjDir = dir
@@ -26,10 +33,10 @@ createShell mscreen aparams muz it cr w = w
, _prjPayload = _ampPayload aparams , _prjPayload = _ampPayload aparams
, _prjTimer = 350 , _prjTimer = 350
, _prjUpdates = , _prjUpdates =
[ CollisionEffectPU (mscreen ^? _Just . itID) --Just screenid) [ CollisionEffectPU (homing ^? phRemoteID) --Just screenid)
, TimePU , TimePU
, StartSpinPU 335 (_crID cr) (_shellSpinAmount params) , StartSpinPU 335 (_crID cr) (_shellSpinAmount params)
, RemoteDirectionPU (350 - thrustdelay) 0 (mscreen ^? _Just . itID) , RemoteDirectionPU (350 - thrustdelay) 0 homing
, ThrustPU (350 - thrustdelay) 0 , ThrustPU (350 - thrustdelay) 0
, ReduceSpinPU (1 - fromIntegral (_shellSpinDrag params) * 2 / 200) , ReduceSpinPU (1 - fromIntegral (_shellSpinDrag params) * 2 / 200)
] ]
@@ -38,10 +45,8 @@ createShell mscreen aparams muz it cr w = w
thrustdelay = _shellThrustDelay params thrustdelay = _shellThrustDelay params
params = _itParams it params = _itParams it
updatescreen = fromMaybe id $ do updatescreen = fromMaybe id $ do
screeninvid <- mscreen ^? _Just . itLocation . ilInvID screenid <- homing ^? phRemoteID
return $ return $ pointerToItemID screenid . itUse
cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix screeninvid
. itUse
. atLinkedProjectile . atLinkedProjectile
?~ i ?~ i
i = IM.newKey $ w ^. cWorld . lWorld . projectiles i = IM.newKey $ w ^. cWorld . lWorld . projectiles
+22 -6
View File
@@ -3,6 +3,7 @@ module Dodge.Projectile.Update
( updateProjectile ( updateProjectile
) where ) where
import Dodge.Movement.Turn
import NewInt import NewInt
import Dodge.Payload import Dodge.Payload
import Control.Lens import Control.Lens
@@ -108,16 +109,31 @@ trySpinByCID cid i pj w = w & cWorld . lWorld . projectiles . ix pjid . prjSpin
spinFactor = 5 * (6 - fromIntegral i) spinFactor = 5 * (6 - fromIntegral i)
-- note this only allows YOU to remotely track projectiles -- note this only allows YOU to remotely track projectiles
pjRemoteSetDirection :: Maybe (NewInt ItmInt) -> Projectile -> World -> World pjRemoteSetDirection :: ProjectileHoming -> Projectile -> World -> World
pjRemoteSetDirection mscreenid pj w = fromMaybe w $ do pjRemoteSetDirection ph pj w = case ph of
screenid <- fmap _unNInt mscreenid NoHoming -> w
HomeUsingRemoteScreen screenid ->
let newdir let newdir
| w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . imSelectedItem | w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . imSelectedItem
== w ^? cWorld . lWorld . itemLocations . ix screenid . ilInvID == w ^? cWorld . lWorld . itemLocations . ix (_unNInt screenid) . ilInvID
= (w ^. wCam . camRot) + argV (_mousePos (_input w)) = (w ^. wCam . camRot) + argV (_mousePos (_input w))
| otherwise = _prjDir pj | otherwise = _prjDir pj
turntonewdir = magV (_prjAcc pj) *.* unitVectorAtAngle newdir in w & cWorld . lWorld . projectiles . ix (_prjID pj) . prjAcc
return $ w & cWorld . lWorld . projectiles . ix (_prjID pj) . prjAcc .~ turntonewdir .~ magV (_prjAcc pj) *.* unitVectorAtAngle newdir
HomeUsingTargeting itid -> fromMaybe w $ do
tp <- w ^? pointerToItemID itid . itUse . tgPos . _Just
return $ w & cWorld . lWorld . projectiles . ix (_prjID pj) . prjAcc
%~ vecTurnTo 0.2 (_prjPos pj) tp
--pjRemoteSetDirection mscreenid pj w = fromMaybe w $ do
-- screenid <- fmap _unNInt mscreenid
-- let newdir
-- | w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . imSelectedItem
-- == w ^? cWorld . lWorld . itemLocations . ix screenid . ilInvID
-- = (w ^. wCam . camRot) + argV (_mousePos (_input w))
-- | otherwise = _prjDir pj
-- turntonewdir = magV (_prjAcc pj) *.* unitVectorAtAngle newdir
-- return $ w & cWorld . lWorld . projectiles . ix (_prjID pj) . prjAcc .~ turntonewdir
reduceSpinBy :: Float -> Int -> World -> World reduceSpinBy :: Float -> Int -> World -> World
reduceSpinBy x pjid = cWorld . lWorld . projectiles . ix pjid . prjSpin *~ x reduceSpinBy x pjid = cWorld . lWorld . projectiles . ix pjid . prjSpin *~ x
+6 -5
View File
@@ -69,11 +69,12 @@ drawSweep cr w = fromMaybe mempty $ do
mwp = mouseWorldPos theinput campos mwp = mouseWorldPos theinput campos
anyTargeting :: Configuration -> World -> SPic anyTargeting :: Configuration -> World -> SPic
anyTargeting cfig w = fromMaybe mempty $ do anyTargeting _ _ = mempty
tt <- cr ^? crTargeting . ctType . _Just --anyTargeting cfig w = fromMaybe mempty $ do
return $ noShape $ drawTargeting tt cr cfig w -- tt <- cr ^? crTargeting . ctType . _Just
where -- return $ noShape $ drawTargeting tt cr cfig w
cr = you w -- where
-- cr = you w
drawCreature :: Creature -> SPic drawCreature :: Creature -> SPic
drawCreature cr = case _crType cr of drawCreature cr = case _crType cr of
+115 -114
View File
@@ -1,119 +1,120 @@
module Dodge.Targeting ( module Dodge.Targeting (
updateTargeting, -- updateTargeting,
) where ) where
import Color --import Color
import qualified Data.Map.Strict as M --import qualified Data.Map.Strict as M
import Data.Maybe --import Data.Maybe
import Dodge.Base.Collide --import Dodge.Base.Collide
import Dodge.Base.Coordinate --import Dodge.Base.Coordinate
import Dodge.Creature.Test --import Dodge.Creature.Test
import Dodge.Data.World --import Dodge.Data.World
import Dodge.Item.Weapon.LaserPath --import Dodge.Item.Weapon.LaserPath
import Dodge.Zoning.Creature --import Dodge.Zoning.Creature
import FoldableHelp --import FoldableHelp
import Geometry.Vector --import Geometry.Vector
import LensHelp --import LensHelp
import qualified SDL --import qualified SDL
updateTargeting :: Maybe TargetType -> Creature -> World -> World --updateTargeting :: Maybe TargetingType -> Creature -> World -> World
updateTargeting tu = case tu of --updateTargeting tu = case tu of
Nothing -> clearTargeting -- Nothing -> clearTargeting
Just TARGETLASER -> targetLaserUpdate' -- Just TARGETLASER -> targetLaserUpdate'
Just TargetRBPress -> upCT (flip targetRBPressUpdate . _crTargeting) -- Just TargetRBPress -> upCT (flip targetRBPressUpdate . _crTargeting)
Just TargetRBLine -> upCT (flip targetRBPressUpdate . _crTargeting) -- Just TargetRBLine -> upCT (flip targetRBPressUpdate . _crTargeting)
Just TargetRBCreature -> upCT targetRBCreatureUp -- Just TargetRBCreature -> upCT targetRBCreatureUp
Just TargetCursor -> upCT (flip targetCursorUpdate . _crTargeting) -- Just TargetCursor -> upCT (flip targetCursorUpdate . _crTargeting)
clearTargeting :: Creature -> World -> World --clearTargeting :: Creature -> World -> World
clearTargeting cr = cWorld . lWorld . creatures . ix (_crID cr) . crTargeting .~ defaultTargeting --clearTargeting cr = cWorld . lWorld . creatures . ix (_crID cr) . crTargeting .~ defaultTargeting
--
defaultTargeting :: CreatureTargeting --defaultTargeting :: CreatureTargeting
defaultTargeting = CreatureTargeting Nothing Nothing Nothing False --defaultTargeting = CreatureTargeting Nothing Nothing Nothing False
--
upCT :: (Creature -> World -> CreatureTargeting) -> Creature -> World -> World --upCT :: (Creature -> World -> CreatureTargeting) -> Creature -> World -> World
upCT f cr w = w & cWorld . lWorld . creatures . ix (_crID cr) . crTargeting .~ f cr w --upCT f cr w = w & cWorld . lWorld . creatures . ix (_crID cr) . crTargeting .~ f cr w
--
targetRBCreatureUp :: Creature -> World -> CreatureTargeting --targetRBCreatureUp :: Creature -> World -> CreatureTargeting
targetRBCreatureUp cr w --targetRBCreatureUp cr w
| SDL.ButtonRight `M.member` _mouseButtons (_input w) && isJust (t ^? ctID . _Just) -- | SDL.ButtonRight `M.member` _mouseButtons (_input w) && isJust (t ^? ctID . _Just)
&& canSeeTarget = -- && canSeeTarget =
t & updatePos & ctActive .~ True -- t & updatePos & ctActive .~ True
& ctType ?~ TargetRBCreature -- & ctType ?~ TargetRBCreature
| otherwise = t & ctID .~ fmap _crID newtarg & updatePos & ctActive .~ False -- | otherwise = t & ctID .~ fmap _crID newtarg & updatePos & ctActive .~ False
& ctType ?~ TargetRBCreature -- & ctType ?~ TargetRBCreature
where -- where
t = _crTargeting cr -- t = _crTargeting cr
newtarg = -- newtarg =
safeMinimumOn (dist mwp . _crPos) -- safeMinimumOn (dist mwp . _crPos)
. filter (canseepos . _crPos) -- . filter (canseepos . _crPos)
$ crsNearCirc mwp 40 w -- $ crsNearCirc mwp 40 w
canseepos p = hasLOS (_crPos cr) p w -- canseepos p = hasLOS (_crPos cr) p w
mwp = mouseWorldPos (w ^. input) (w ^. wCam) -- mwp = mouseWorldPos (w ^. input) (w ^. wCam)
updatePos t' = t' & ctPos .~ posFromMaybeID (_ctID t') -- updatePos t' = t' & ctPos .~ posFromMaybeID (_ctID t')
posFromMaybeID Nothing = Nothing -- posFromMaybeID Nothing = Nothing
posFromMaybeID (Just i) = w ^? cWorld . lWorld . creatures . ix i . crPos -- posFromMaybeID (Just i) = w ^? cWorld . lWorld . creatures . ix i . crPos
canSeeTarget = fromMaybe False $ do -- canSeeTarget = fromMaybe False $ do
cid <- t ^? ctID . _Just -- cid <- t ^? ctID . _Just
cpos <- w ^? cWorld . lWorld . creatures . ix cid . crPos -- cpos <- w ^? cWorld . lWorld . creatures . ix cid . crPos
Just $ hasLOS cpos (_crPos cr) w -- Just $ hasLOS cpos (_crPos cr) w
--
targetCursorUpdate :: World -> CreatureTargeting -> CreatureTargeting --targetCursorUpdate :: World -> CreatureTargeting -> CreatureTargeting
targetCursorUpdate w ct = --targetCursorUpdate w ct =
ct -- ct
& ctPos . _Just .~ mouseWorldPos (w ^. input) (w ^. wCam) -- & ctPos . _Just .~ mouseWorldPos (w ^. input) (w ^. wCam)
& ctActive .~ True -- & ctActive .~ True
& ctType ?~ TargetCursor -- & ctType ?~ TargetCursor
--
targetRBPressUpdate :: World -> CreatureTargeting -> CreatureTargeting --targetRBPressUpdate :: World -> CreatureTargeting -> CreatureTargeting
targetRBPressUpdate w t --targetRBPressUpdate w t
| SDL.ButtonRight `M.member` _mouseButtons (_input w) = -- | SDL.ButtonRight `M.member` _mouseButtons (_input w) =
t -- t
& ctPos %~ maybe (Just $ mouseWorldPos (w ^. input) (w ^. wCam)) Just -- & ctPos %~ maybe (Just $ mouseWorldPos (w ^. input) (w ^. wCam)) Just
& ctActive .~ True -- & ctActive .~ True
& ctType ?~ TargetRBPress -- & ctType ?~ TargetRBPress
| otherwise = -- | otherwise =
t -- t
& ctPos %~ const Nothing -- & ctPos %~ const Nothing
& ctActive .~ False -- & ctActive .~ False
& ctType ?~ TargetRBPress -- & ctType ?~ TargetRBPress
--
targetLaserUpdate' :: Creature -> World -> World --targetLaserUpdate' :: Creature -> World -> World
targetLaserUpdate' cr w = --targetLaserUpdate' cr w =
let (w', ct') = targetLaserUpdate cr w (_crTargeting cr) -- let (w', ct') = targetLaserUpdate cr w (_crTargeting cr)
in w' & cWorld . lWorld . creatures . ix (_crID cr) . crTargeting .~ ct' -- in w' & cWorld . lWorld . creatures . ix (_crID cr) . crTargeting .~ ct'
--
targetLaserUpdate :: Creature -> World -> CreatureTargeting -> (World, CreatureTargeting) --targetLaserUpdate :: Creature -> World -> CreatureTargeting -> (World, CreatureTargeting)
targetLaserUpdate cr w t --targetLaserUpdate cr w t
| crIsAiming cr = -- | crIsAiming cr =
( addLaserPic w -- --( addLaserPic w
, t -- ( w
& ctPos .~ fmap fst mp -- , t
& ctActive .~ True -- & ctPos .~ fmap fst mp
& ctType ?~ TARGETLASER -- & ctActive .~ True
) -- & ctType ?~ TARGETLASER
| otherwise = -- )
( w -- | otherwise =
, t & ctPos %~ const Nothing -- ( w
& ctActive .~ False -- , t & ctPos %~ const Nothing
) -- & ctActive .~ False
where -- )
(mp, _) = reflectLaserAlong 0.2 sp ep w -- where
sp = _crPos cr +.+ 15 *.* unitVectorAtAngle (_crDir cr) -- (mp, _) = reflectLaserAlong 0.2 sp ep w
ep = sp +.+ 5000 *.* normalizeV (mouseWorldPos (w ^. input) (w ^. wCam) -.- sp) -- sp = _crPos cr +.+ 15 *.* unitVectorAtAngle (_crDir cr)
addLaserPic = -- ep = sp +.+ 5000 *.* normalizeV (mouseWorldPos (w ^. input) (w ^. wCam) -.- sp)
cWorld . lWorld . lasers ---- addLaserPic =
.:~ LaserStart ---- cWorld . lWorld . lasers
{ _lpPhaseV = 1 ---- .:~ LaserStart
, _lpDir = _crDir cr ---- { _lpPhaseV = 1
, _lpPos = sp ---- , _lpDir = _crDir cr
, _lpColor = col ---- , _lpPos = sp
, _lpType = TargetingLaser ---- , _lpColor = col
} ---- , _lpType = TargetingLaser
--wpammo = _itConsumption it ---- }
-- reloadFrac -- --wpammo = _itConsumption it
-- | _laLoaded wpammo == 0 = 1 -- -- reloadFrac
-- | otherwise = case _laTransfer wpammo of -- -- | _laLoaded wpammo == 0 = 1
-- Transfer _ rs -> fromIntegral rs / fromIntegral (_laReloadTime wpammo) -- -- | otherwise = case _laTransfer wpammo of
-- NoTransfer -> 1 -- -- Transfer _ rs -> fromIntegral rs / fromIntegral (_laReloadTime wpammo)
col = blue -- mixColors reloadFrac (1-reloadFrac) blue red -- -- NoTransfer -> 1
---- col = blue -- mixColors reloadFrac (1-reloadFrac) blue red
+43 -38
View File
@@ -2,16 +2,16 @@ module Dodge.Targeting.Draw (
drawTargeting, drawTargeting,
) where ) where
import Data.Maybe --import Data.Maybe
import Dodge.Base --import Dodge.Base
import Dodge.Data.Universe import Dodge.Data.Universe
import Geometry.Data import Geometry.Data
import Geometry.Vector --import Geometry.Vector
import LensHelp --import LensHelp
import Picture import Picture
import ShortShow --import ShortShow
drawTargeting :: TargetType -> Creature -> Configuration -> World -> Picture drawTargeting :: TargetingType -> Creature -> Configuration -> World -> Picture
drawTargeting td = case td of drawTargeting td = case td of
TargetRBCreature -> targetRBCreatureDraw TargetRBCreature -> targetRBCreatureDraw
TargetRBLine -> targetDistanceDraw TargetRBLine -> targetDistanceDraw
@@ -23,48 +23,53 @@ targetSimpleDraw :: Creature -> Configuration -> World -> Picture
targetSimpleDraw = targetDraw activeTargetCursorPic targetSimpleDraw = targetDraw activeTargetCursorPic
targetDistanceDraw :: Creature -> Configuration -> World -> Picture targetDistanceDraw :: Creature -> Configuration -> World -> Picture
targetDistanceDraw cr _ w = fromMaybe mempty $ do targetDistanceDraw _ _ _ = mempty
p <- cr ^? crTargeting . ctPos . _Just --targetDistanceDraw cr _ w = mempty
let p1 = worldPosToScreen cam p -- fromMaybe mempty $ do
mwp = mouseWorldPos (w ^. input) (w ^. wCam) -- p <- cr ^? crTargeting . ctPos . _Just
p2 = worldPosToScreen cam mwp -- let p1 = worldPosToScreen cam p
thecol = if dist p mwp > 100 then red else white -- mwp = mouseWorldPos (w ^. input) (w ^. wCam)
return . -- p2 = worldPosToScreen cam mwp
setLayer FixedCoordLayer $ -- thecol = if dist p mwp > 100 then red else white
color thecol $ -- return .
line [p1, p2] -- setLayer FixedCoordLayer $
<> transMidLine p1 p2 (scale 0.1 0.1 . text . shortShow $ dist p mwp) -- color thecol $
where -- line [p1, p2]
cam = w ^. wCam -- <> transMidLine p1 p2 (scale 0.1 0.1 . text . shortShow $ dist p mwp)
-- where
-- cam = w ^. wCam
targetDraw :: Picture -> Creature -> Configuration -> World -> Picture targetDraw :: Picture -> Creature -> Configuration -> World -> Picture
targetDraw f cr _ _ = fromMaybe mempty $ do targetDraw _ _ _ _ = mempty
p <- cr ^? crTargeting . ctPos . _Just --targetDraw f cr _ _ = mempty
return . -- fromMaybe mempty $ do
setLayer DebugLayer $ -- p <- cr ^? crTargeting . ctPos . _Just
color white $ -- return .
uncurryV translate p f -- setLayer DebugLayer $
-- color white $
-- uncurryV translate p f
activeTargetCursorPic :: Picture activeTargetCursorPic :: Picture
activeTargetCursorPic = activeTargetCursorPic =
fold fold
[rotate a $ line [V2 15 0, V2 10 0] <> targCorner | a <- [0, 0.5 * pi, pi, 1.5 * pi]] [rotate a $ line [V2 15 0, V2 10 0] <> targCorner | a <- [0, 0.5 * pi, pi, 1.5 * pi]]
transMidLine :: Point2 -> Point2 -> Picture -> Picture --transMidLine :: Point2 -> Point2 -> Picture -> Picture
transMidLine p1 p2 = translate 20 (f p1 p2) . uncurryV translate (0.5 *.* (p1 +.+ p2)) --transMidLine p1 p2 = translate 20 (f p1 p2) . uncurryV translate (0.5 *.* (p1 +.+ p2))
where -- where
f (V2 x y) (V2 x' y') -- f (V2 x y) (V2 x' y')
| y > y' && x > x' = max (-10) (x' - x) -- | y > y' && x > x' = max (-10) (x' - x)
| y > y' && x < x' = min 10 (x' - x) -- | y > y' && x < x' = min 10 (x' - x)
| x > x' = min 10 (x - x') -- | x > x' = min 10 (x - x')
| otherwise = max (-10) (x - x') -- | otherwise = max (-10) (x - x')
targetRBCreatureDraw :: Creature -> Configuration -> World -> Picture targetRBCreatureDraw :: Creature -> Configuration -> World -> Picture
targetRBCreatureDraw cr = targetDraw thepic cr targetRBCreatureDraw cr = targetDraw targetCursorPic cr
where --targetRBCreatureDraw cr = targetDraw thepic cr
thepic -- where
| _ctActive $ _crTargeting cr = activeTargetCursorPic -- thepic
| otherwise = targetCursorPic -- | _ctActive $ _crTargeting cr = activeTargetCursorPic
-- | otherwise = targetCursorPic
targCorner :: Picture targCorner :: Picture
targCorner = line [V2 (x - y) x, V2 x x, V2 x (x - y)] targCorner = line [V2 (x - y) x, V2 x x, V2 x (x - y)]
+1 -1
View File
@@ -20,7 +20,7 @@ import Dodge.Data.Universe
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
testStringInit :: Universe -> [String] testStringInit :: Universe -> [String]
testStringInit = const mempty testStringInit u = [maybe mempty show $ u ^? uvWorld . cWorld . lWorld . projectiles . ix 0 . prjUpdates . ix 3 . pjuControllerID]
--testStringInit u = (topTestPart u --testStringInit u = (topTestPart u
-- <>) $ map showh $ -- <>) $ map showh $
---- (IM.toList . IM.filter (\itloc -> itloc ^? ilCrID == Just 0) $ (u ^. uvWorld . cWorld . lWorld . itemLocations)) <> ---- (IM.toList . IM.filter (\itloc -> itloc ^? ilCrID == Just 0) $ (u ^. uvWorld . cWorld . lWorld . itemLocations)) <>
+11 -5
View File
@@ -6,6 +6,7 @@ Description : Simulation update
-} -}
module Dodge.Update (updateUniverse) where module Dodge.Update (updateUniverse) where
import Data.Monoid
import NewInt import NewInt
import Control.Monad import Control.Monad
import Dodge.Update.Input.InGame import Dodge.Update.Input.InGame
@@ -384,10 +385,12 @@ updateCreatureSoundPositions w =
--updateIMr :: (World -> IM.IntMap a) -> (a -> a -> World -> World) -> World -> World --updateIMr :: (World -> IM.IntMap a) -> (a -> a -> World -> World) -> World -> World
--updateIMr fim fup w = foldr (dbArg fup) w (fim w) --updateIMr fim fup w = foldr (dbArg fup) w (fim w)
updateIMl :: (World -> IM.IntMap a) -> (a -> a -> World -> World) -> World -> World updateIMl :: (World -> IM.IntMap a) -> (a -> a -> World -> World) -> World -> World
updateIMl fim fup w = foldl' (flip $ dbArg fup) w (fim w) updateIMl fim fup w = alaf Endo foldMap (dbArg fup) (fim w) w
--updateIMl fim fup w = foldl' (flip $ dbArg fup) w (fim w)
updateIMl' :: (World -> IM.IntMap a) -> (a -> World -> World) -> World -> World updateIMl' :: (World -> IM.IntMap a) -> (a -> World -> World) -> World -> World
updateIMl' fim fup w = foldl' (flip fup) w (fim w) updateIMl' fim fup w = alaf Endo foldMap fup (fim w) w
--updateIMl' fim fup w = foldl' (flip fup) w (fim w)
updateCreatureGroups :: World -> World updateCreatureGroups :: World -> World
updateCreatureGroups w = updateCreatureGroups w =
@@ -561,10 +564,13 @@ ppEvents :: World -> World
ppEvents w = IM.foldl' (flip $ \pp -> doPressPlateEvent (_ppEvent pp) pp) w $ w ^. cWorld . lWorld . pressPlates ppEvents w = IM.foldl' (flip $ \pp -> doPressPlateEvent (_ppEvent pp) pp) w $ w ^. cWorld . lWorld . pressPlates
updateSeenWalls :: World -> World updateSeenWalls :: World -> World
updateSeenWalls w = foldl' markWallSeen w (map (_wlID . snd) $ allVisibleWalls w) updateSeenWalls w = alaf Endo foldMap (markWallSeen . _wlID . snd) (allVisibleWalls w) w
--updateSeenWalls w = foldl' markWallSeen w (map (_wlID . snd) $ allVisibleWalls w)
markWallSeen :: World -> Int -> World markWallSeen :: Int -> World -> World
markWallSeen w i = w & cWorld . seenWalls . at i ?~ () markWallSeen i = cWorld . seenWalls . at i ?~ ()
--markWallSeen :: World -> Int -> World
--markWallSeen w i = w & cWorld . seenWalls . at i ?~ ()
--markWallSeen !w !i = w & cWorld . lWorld . walls %~ IM.adjust markSeen i --markWallSeen !w !i = w & cWorld . lWorld . walls %~ IM.adjust markSeen i
-- in the past there might have been a space leak, which the following was meant -- in the past there might have been a space leak, which the following was meant
+1 -1
View File
@@ -49,7 +49,7 @@ doWdWd we = case we of
doItCrWdWd :: ItCrWdWd -> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World doItCrWdWd :: ItCrWdWd -> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
doItCrWdWd icww = case icww of doItCrWdWd icww = case icww of
ItCrWdId -> \_ _ -> id ItCrWdId -> \_ _ -> id
ItCrWdItemEffect -> flip itemEffect ItCrWdItemEffect -> flip itemUseEffect
accessTerminal :: Maybe Int -> World -> World accessTerminal :: Maybe Int -> World -> World
accessTerminal mtmid w = fromMaybe w $ do accessTerminal mtmid w = fromMaybe w $ do
+1 -1
View File
@@ -13,7 +13,7 @@ import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
newtype NewInt a = NInt { _unNInt :: Int} newtype NewInt a = NInt { _unNInt :: Int}
deriving newtype (Eq,Ord,Show,Num,Read) deriving newtype (Eq,Ord,Show,Num,Read,Integral,Real,Enum)
newtype NewIntMap a b = NIntMap { _unNIntMap :: IM.IntMap b} newtype NewIntMap a b = NIntMap { _unNIntMap :: IM.IntMap b}
deriving (Eq,Ord,Show,Read) deriving (Eq,Ord,Show,Read)
+306 -312
View File
File diff suppressed because it is too large Load Diff