Reify modifications

This commit is contained in:
2022-07-23 20:53:00 +01:00
parent f0f9751afe
commit 5de837c8cf
8 changed files with 56 additions and 22 deletions
+17
View File
@@ -0,0 +1,17 @@
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