Files
loop/src/Dodge/ModificationEffect.hs
T
2022-07-23 20:53:00 +01:00

18 lines
717 B
Haskell

module Dodge.ModificationEffect
where
import Dodge.Placement.Instance.LightSource.Flicker
import Dodge.Data
import Control.Lens
doModificationEffect :: MdWdWd -> Modification -> World -> World
doModificationEffect mww = case mww of
MdWdId -> const id
MdTrigIf ftrue ffalse -> \md w -> if w ^?! triggers . ix (_mdExternalID2 md)
then w & doModificationEffect ftrue md
else w & doModificationEffect ffalse md
-- note this uses the second external ix
MdSetLSCol col -> \md w -> w & lightSources . ix (_mdExternalID1 md) . lsParam . lsCol .~ col
-- note this uses the first external ix, this should be made more
-- transparent
MdFlickerUpdate -> flickerUpdate