Commit before moving configuration outside of world
This commit is contained in:
+15
-13
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user