Files
loop/src/Dodge/ModificationEffect.hs
T

18 lines
753 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 ^?! cWorld . lWorld . 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 & cWorld . lWorld . lightSources . ix (_mdExternalID1 md) . lsParam . lsCol .~ col
-- note this uses the first external ix, this should be made more
-- transparent
MdFlickerUpdate -> flickerUpdate