diff --git a/src/Dodge/Config/Data.hs b/src/Dodge/Config/Data.hs index 9f9065721..3a1e1f30e 100644 --- a/src/Dodge/Config/Data.hs +++ b/src/Dodge/Config/Data.hs @@ -22,7 +22,7 @@ data Configuration = Configuration , _debug_noclip :: Bool , _debug_cr_status :: Bool , _debug_view_boundaries :: Bool - , _debug_pathing :: Bool + , _debug_pathing :: Bool } deriving (Generic, Show) makeLenses ''Configuration diff --git a/src/Dodge/Data.hs b/src/Dodge/Data.hs index 0baced8d1..756985721 100644 --- a/src/Dodge/Data.hs +++ b/src/Dodge/Data.hs @@ -108,7 +108,7 @@ data World = World , _carteRot :: !Float , _lightSources :: !(IM.IntMap LightSource) , _tempLightSources :: ![TempLightSource] - , _closeObjects :: [Either FloorItem Button] + , _closeObjects :: [Either FloorItem Button] , _seenLocations :: IM.IntMap (World -> Point2,String) , _selLocation :: Int , _sideEffects :: Universe -> IO Universe diff --git a/src/Dodge/Item/Weapon/TriggerType.hs b/src/Dodge/Item/Weapon/TriggerType.hs index 10f917274..3b16728bf 100644 --- a/src/Dodge/Item/Weapon/TriggerType.hs +++ b/src/Dodge/Item/Weapon/TriggerType.hs @@ -303,7 +303,7 @@ modClock n chainEff eff it cr w | otherwise = eff it cr w withMuzFlareI :: ChainEffect -withMuzFlareI f it cr w = makeTLight 3 100 (V3 1 1 0.5) flashPos +withMuzFlareI f it cr w = makeTlsTimeRadColPos 3 100 (V3 1 1 0.5) flashPos . muzFlareAt (V4 5 5 0 2) flarePos dir $ f it cr w where diff --git a/src/Dodge/WorldEvent.hs b/src/Dodge/WorldEvent.hs index f6b94b3aa..1be2dc3ec 100644 --- a/src/Dodge/WorldEvent.hs +++ b/src/Dodge/WorldEvent.hs @@ -21,14 +21,15 @@ import Dodge.Creature.State.Data import Dodge.Data import Geometry import Color +import LensHelp -import Control.Lens +--import Control.Lens import System.Random import qualified Data.IntMap.Strict as IM createBarrelSpark :: Point2 -> Float -> Maybe Int -> Int -> Int -> World -> World -createBarrelSpark pos dir maycid time colid w - = over worldEvents (( over particles (spark :) . sparkFlashAt pos') . ) w +createBarrelSpark pos dir maycid time colid w = w + & worldEvents %~ (( over particles (spark :) . sparkFlashAt pos') . ) where spark = BulletPt { _ptDraw = drawBul @@ -43,16 +44,17 @@ createBarrelSpark pos dir maycid time colid w } x = fst $ randomR (0,20) $ _randGen w pos' = pos +.+ rotateV dir (V2 x 0) - sparkEff bt p cr = over (creatures . ix (_crID cr) . crState . crDamage) - ((:) $ SparkDam 1 sp p ep) - where sp = head (_btTrail' bt) - ep = sp +.+ _btVel' bt + sparkEff bt p cr = creatures . ix (_crID cr) . crState . crDamage .:~ SparkDam 1 sp p ep + where + sp = head (_btTrail' bt) + ep = sp +.+ _btVel' bt damCrsOnLine :: Int -> Point2 -> Point2 -> World -> World -damCrsOnLine dam p1 p2 = over creatures (IM.map damIfOnLine) - where damIfOnLine cr | circOnSeg p1 p2 (_crPos cr) (_crRad cr) - = over crHP (\hp -> hp - dam) cr - | otherwise = cr +damCrsOnLine dam p1 p2 = creatures %~ IM.map damIfOnLine + where + damIfOnLine cr + | circOnSeg p1 p2 (_crPos cr) (_crRad cr) = cr & crHP -~ dam + | otherwise = cr -makeTLight :: Int -> Float -> Point3 -> Point3 -> World -> World -makeTLight i rad (V3 r g b) p = tempLightSources %~ (tlsTimeRadColPos i rad (V3 r g b) p :) +makeTlsTimeRadColPos :: Int -> Float -> Point3 -> Point3 -> World -> World +makeTlsTimeRadColPos i rad (V3 r g b) p = tempLightSources .:~ tlsTimeRadColPos i rad (V3 r g b) p diff --git a/src/Dodge/WorldEvent/Flash.hs b/src/Dodge/WorldEvent/Flash.hs index d2d251fd7..37ee6011d 100644 --- a/src/Dodge/WorldEvent/Flash.hs +++ b/src/Dodge/WorldEvent/Flash.hs @@ -22,8 +22,8 @@ import Dodge.WorldEvent.HelperParticle --import Dodge.Default import Picture import Geometry +import LensHelp -import Control.Lens import System.Random {- Cyan flash. -} @@ -35,7 +35,7 @@ laserGunFlashAt :: Point3 -> World -> World laserGunFlashAt = flareCircleAt yellow 0.2 muzFlareAt :: Color -> Point3 -> Float -> World -> World -muzFlareAt col tranv dir w = w & particles %~ (theFlare :) +muzFlareAt col tranv dir w = w & particles .:~ theFlare where theFlare = Particle { _ptDraw = const $ setLayer 1 . translate3 tranv $ theShape @@ -49,7 +49,7 @@ muzFlareAt col tranv dir w = w & particles %~ (theFlare :) (a:b:c:d:_) = randomRs (2,20) (_randGen w) flareCircleAt :: Color -> Float -> Point3 -> World -> World -flareCircleAt col alphax tranv = particles %~ (theFlareCircle :) +flareCircleAt col alphax tranv = particles .:~ theFlareCircle where theFlareCircle = Particle { _ptDraw = const . setLayer 1 . translate3 tranv @@ -58,7 +58,7 @@ flareCircleAt col alphax tranv = particles %~ (theFlareCircle :) } explosionFlashAt :: Point2 -> World -> World -explosionFlashAt p = tempLightSources %~ (tlsTimeRadFunPos 20 150 intensityFunc (addZ 20 p) :) +explosionFlashAt p = tempLightSources .:~ tlsTimeRadFunPos 20 150 intensityFunc (addZ 20 p) where intensityFunc x | x < 10 = 1 / (10 - fromIntegral x) @@ -69,7 +69,7 @@ sparkFlashAt _ = id flameFlicker :: Particle -> World -> World flameFlicker pt - | _btTimer' pt `mod` 5 == 0 = tempLightSources %~ (theLight :) + | _btTimer' pt `mod` 5 == 0 = tempLightSources .:~ theLight | otherwise = id where V2 x y = _btPos' pt