Destroying mounted lights flashes, move equipment datatype

This commit is contained in:
2022-07-13 19:45:23 +01:00
parent cede677560
commit 33e9b5b1f0
16 changed files with 118 additions and 96 deletions
+22
View File
@@ -10,11 +10,16 @@ module Dodge.LightSource
, lsPosRad
, lsColPosID
, makeTlsTimeRadColPos
, destroyLS
) where
import Dodge.Data
import Geometry.Data
import Geometry.Vector
import Geometry.Vector3D
import Dodge.Default.LightSource
import LensHelp
import Dodge.WorldEvent.Sound
import Dodge.Material
lsPosRad :: Point3 -> Float -> LightSource
lsPosRad = lsColPosRad 0.75
@@ -85,3 +90,20 @@ tlsTimeRadColPos t rmax col (V3 x y z) = TLS
makeTlsTimeRadColPos :: Int -> Float -> Point3 -> Point3 -> World -> World
makeTlsTimeRadColPos i rad (V3 r g b) p = tempLightSources .:~ tlsTimeRadColPos i rad (V3 r g b) p
destroyLS :: Int -> World -> World
destroyLS lsid w = w
& lightSources . at lsid .~ Nothing
& destroyLSFlashAt p3
& originsIDsAt [MaterialSound Glass n | n <- [0,1,2]] (destroyMatS Glass) (xyV3 p3)
where
ls = w ^?! lightSources . ix lsid
p3 = _lsPos $ _lsParam ls
destroyLSFlashAt :: Point3 -> World -> World
destroyLSFlashAt (V3 x' y' z') = tempLightSources .:~ tlsTimeRadFunPos 20 150 intensityFunc (addZ z' p)
where
p = V2 x' y'
intensityFunc x
| x < 10 = 1 / (10 - fromIntegral x)
| otherwise = 1