Add destruction to mounted lights
This commit is contained in:
+14
-12
@@ -4,7 +4,8 @@ module Dodge.LightSource (
|
||||
lsPosCol,
|
||||
lsPosRad,
|
||||
lsColPosID,
|
||||
destroyLS,
|
||||
-- destroyLS,
|
||||
destroyLSFlashAt,
|
||||
) where
|
||||
|
||||
import Dodge.Data.World
|
||||
@@ -29,17 +30,18 @@ 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
|
||||
--destroyLS :: Int -> World -> World
|
||||
--destroyLS lsid w =
|
||||
-- w
|
||||
-- & cWorld . lWorld . lightSources . at lsid .~ Nothing
|
||||
-- & destroyLSFlashAt p3
|
||||
-- where
|
||||
-- -- & soundOriginsIDsAt [MaterialSound Glass n | n <- [0, 1, 2]] (destroyMatS Glass) (xyV3 p3)
|
||||
--
|
||||
-- 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
|
||||
(cWorld . lWorld . worldEvents .:~ MakeTempLightFade 0.05 (LSParam x 150 1) 20)
|
||||
. soundOriginsIDsAt [MaterialSound Glass n | n <- [0, 1, 2]] (destroyMatS Glass) (xyV3 x)
|
||||
|
||||
Reference in New Issue
Block a user