46 lines
1.2 KiB
Haskell
46 lines
1.2 KiB
Haskell
module Dodge.LightSource (
|
|
lsColPosRad,
|
|
lsColPos,
|
|
lsPosCol,
|
|
lsPosRad,
|
|
lsColPosID,
|
|
destroyLS,
|
|
) where
|
|
|
|
import Dodge.Data.World
|
|
import Dodge.Material.Sound
|
|
import Dodge.WorldEvent.Sound
|
|
import Geometry.Data
|
|
import Geometry.Vector
|
|
import LensHelp
|
|
|
|
lsPosRad :: Point3 -> Float -> LightSource
|
|
lsPosRad = lsColPosRad 0.75
|
|
|
|
lsColPosID :: Point3 -> Point3 -> Int -> LightSource
|
|
lsColPosID col p i = lsColPos col p & lsID .~ i
|
|
|
|
lsColPos :: Point3 -> Point3 -> LightSource
|
|
lsColPos col pos = lsColPosRad col pos 450
|
|
|
|
lsPosCol :: Point3 -> Point3 -> LightSource
|
|
lsPosCol pos col = lsColPos col pos
|
|
|
|
lsColPosRad :: Point3 -> Point3 -> Float -> LightSource
|
|
lsColPosRad col p r = LS 0 $ LSParam p r col
|
|
|
|
destroyLS :: Int -> World -> World
|
|
destroyLS lsid w =
|
|
w
|
|
& cWorld . lWorld . lightSources . at lsid .~ Nothing
|
|
& destroyLSFlashAt p3
|
|
& soundOriginsIDsAt [MaterialSound Glass n | n <- [0, 1, 2]] (destroyMatS Glass) (xyV3 p3)
|
|
where
|
|
ls = w ^?! cWorld . lWorld . lightSources . ix lsid -- unsafe
|
|
p3 = _lsPos $ _lsParam ls
|
|
|
|
destroyLSFlashAt :: Point3 -> World -> World
|
|
destroyLSFlashAt x =
|
|
cWorld . lWorld . worldEvents .:~ MakeTempLight
|
|
(LSParam x 150 1) 20
|