Commit before moving configuration outside of world
This commit is contained in:
@@ -22,7 +22,7 @@ data Configuration = Configuration
|
|||||||
, _debug_noclip :: Bool
|
, _debug_noclip :: Bool
|
||||||
, _debug_cr_status :: Bool
|
, _debug_cr_status :: Bool
|
||||||
, _debug_view_boundaries :: Bool
|
, _debug_view_boundaries :: Bool
|
||||||
, _debug_pathing :: Bool
|
, _debug_pathing :: Bool
|
||||||
}
|
}
|
||||||
deriving (Generic, Show)
|
deriving (Generic, Show)
|
||||||
makeLenses ''Configuration
|
makeLenses ''Configuration
|
||||||
|
|||||||
+1
-1
@@ -108,7 +108,7 @@ data World = World
|
|||||||
, _carteRot :: !Float
|
, _carteRot :: !Float
|
||||||
, _lightSources :: !(IM.IntMap LightSource)
|
, _lightSources :: !(IM.IntMap LightSource)
|
||||||
, _tempLightSources :: ![TempLightSource]
|
, _tempLightSources :: ![TempLightSource]
|
||||||
, _closeObjects :: [Either FloorItem Button]
|
, _closeObjects :: [Either FloorItem Button]
|
||||||
, _seenLocations :: IM.IntMap (World -> Point2,String)
|
, _seenLocations :: IM.IntMap (World -> Point2,String)
|
||||||
, _selLocation :: Int
|
, _selLocation :: Int
|
||||||
, _sideEffects :: Universe -> IO Universe
|
, _sideEffects :: Universe -> IO Universe
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ modClock n chainEff eff it cr w
|
|||||||
| otherwise = eff it cr w
|
| otherwise = eff it cr w
|
||||||
|
|
||||||
withMuzFlareI :: ChainEffect
|
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
|
. muzFlareAt (V4 5 5 0 2) flarePos dir
|
||||||
$ f it cr w
|
$ f it cr w
|
||||||
where
|
where
|
||||||
|
|||||||
+15
-13
@@ -21,14 +21,15 @@ import Dodge.Creature.State.Data
|
|||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Geometry
|
import Geometry
|
||||||
import Color
|
import Color
|
||||||
|
import LensHelp
|
||||||
|
|
||||||
import Control.Lens
|
--import Control.Lens
|
||||||
import System.Random
|
import System.Random
|
||||||
import qualified Data.IntMap.Strict as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
|
|
||||||
createBarrelSpark :: Point2 -> Float -> Maybe Int -> Int -> Int -> World -> World
|
createBarrelSpark :: Point2 -> Float -> Maybe Int -> Int -> Int -> World -> World
|
||||||
createBarrelSpark pos dir maycid time colid w
|
createBarrelSpark pos dir maycid time colid w = w
|
||||||
= over worldEvents (( over particles (spark :) . sparkFlashAt pos') . ) w
|
& worldEvents %~ (( over particles (spark :) . sparkFlashAt pos') . )
|
||||||
where
|
where
|
||||||
spark = BulletPt
|
spark = BulletPt
|
||||||
{ _ptDraw = drawBul
|
{ _ptDraw = drawBul
|
||||||
@@ -43,16 +44,17 @@ createBarrelSpark pos dir maycid time colid w
|
|||||||
}
|
}
|
||||||
x = fst $ randomR (0,20) $ _randGen w
|
x = fst $ randomR (0,20) $ _randGen w
|
||||||
pos' = pos +.+ rotateV dir (V2 x 0)
|
pos' = pos +.+ rotateV dir (V2 x 0)
|
||||||
sparkEff bt p cr = over (creatures . ix (_crID cr) . crState . crDamage)
|
sparkEff bt p cr = creatures . ix (_crID cr) . crState . crDamage .:~ SparkDam 1 sp p ep
|
||||||
((:) $ SparkDam 1 sp p ep)
|
where
|
||||||
where sp = head (_btTrail' bt)
|
sp = head (_btTrail' bt)
|
||||||
ep = sp +.+ _btVel' bt
|
ep = sp +.+ _btVel' bt
|
||||||
|
|
||||||
damCrsOnLine :: Int -> Point2 -> Point2 -> World -> World
|
damCrsOnLine :: Int -> Point2 -> Point2 -> World -> World
|
||||||
damCrsOnLine dam p1 p2 = over creatures (IM.map damIfOnLine)
|
damCrsOnLine dam p1 p2 = creatures %~ IM.map damIfOnLine
|
||||||
where damIfOnLine cr | circOnSeg p1 p2 (_crPos cr) (_crRad cr)
|
where
|
||||||
= over crHP (\hp -> hp - dam) cr
|
damIfOnLine cr
|
||||||
| otherwise = cr
|
| circOnSeg p1 p2 (_crPos cr) (_crRad cr) = cr & crHP -~ dam
|
||||||
|
| otherwise = cr
|
||||||
|
|
||||||
makeTLight :: Int -> Float -> Point3 -> Point3 -> World -> World
|
makeTlsTimeRadColPos :: Int -> Float -> Point3 -> Point3 -> World -> World
|
||||||
makeTLight i rad (V3 r g b) p = tempLightSources %~ (tlsTimeRadColPos i rad (V3 r g b) p :)
|
makeTlsTimeRadColPos i rad (V3 r g b) p = tempLightSources .:~ tlsTimeRadColPos i rad (V3 r g b) p
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ import Dodge.WorldEvent.HelperParticle
|
|||||||
--import Dodge.Default
|
--import Dodge.Default
|
||||||
import Picture
|
import Picture
|
||||||
import Geometry
|
import Geometry
|
||||||
|
import LensHelp
|
||||||
|
|
||||||
import Control.Lens
|
|
||||||
import System.Random
|
import System.Random
|
||||||
|
|
||||||
{- Cyan flash. -}
|
{- Cyan flash. -}
|
||||||
@@ -35,7 +35,7 @@ laserGunFlashAt :: Point3 -> World -> World
|
|||||||
laserGunFlashAt = flareCircleAt yellow 0.2
|
laserGunFlashAt = flareCircleAt yellow 0.2
|
||||||
|
|
||||||
muzFlareAt :: Color -> Point3 -> Float -> World -> World
|
muzFlareAt :: Color -> Point3 -> Float -> World -> World
|
||||||
muzFlareAt col tranv dir w = w & particles %~ (theFlare :)
|
muzFlareAt col tranv dir w = w & particles .:~ theFlare
|
||||||
where
|
where
|
||||||
theFlare = Particle
|
theFlare = Particle
|
||||||
{ _ptDraw = const $ setLayer 1 . translate3 tranv $ theShape
|
{ _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)
|
(a:b:c:d:_) = randomRs (2,20) (_randGen w)
|
||||||
|
|
||||||
flareCircleAt :: Color -> Float -> Point3 -> World -> World
|
flareCircleAt :: Color -> Float -> Point3 -> World -> World
|
||||||
flareCircleAt col alphax tranv = particles %~ (theFlareCircle :)
|
flareCircleAt col alphax tranv = particles .:~ theFlareCircle
|
||||||
where
|
where
|
||||||
theFlareCircle = Particle
|
theFlareCircle = Particle
|
||||||
{ _ptDraw = const . setLayer 1 . translate3 tranv
|
{ _ptDraw = const . setLayer 1 . translate3 tranv
|
||||||
@@ -58,7 +58,7 @@ flareCircleAt col alphax tranv = particles %~ (theFlareCircle :)
|
|||||||
}
|
}
|
||||||
|
|
||||||
explosionFlashAt :: Point2 -> World -> World
|
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
|
where
|
||||||
intensityFunc x
|
intensityFunc x
|
||||||
| x < 10 = 1 / (10 - fromIntegral x)
|
| x < 10 = 1 / (10 - fromIntegral x)
|
||||||
@@ -69,7 +69,7 @@ sparkFlashAt _ = id
|
|||||||
|
|
||||||
flameFlicker :: Particle -> World -> World
|
flameFlicker :: Particle -> World -> World
|
||||||
flameFlicker pt
|
flameFlicker pt
|
||||||
| _btTimer' pt `mod` 5 == 0 = tempLightSources %~ (theLight :)
|
| _btTimer' pt `mod` 5 == 0 = tempLightSources .:~ theLight
|
||||||
| otherwise = id
|
| otherwise = id
|
||||||
where
|
where
|
||||||
V2 x y = _btPos' pt
|
V2 x y = _btPos' pt
|
||||||
|
|||||||
Reference in New Issue
Block a user