Separate out concrete part of world
This commit is contained in:
@@ -17,7 +17,7 @@ updateProp pr = case _prUpdate pr of
|
||||
PropRotate x -> rotateProp x pr
|
||||
PropSetToggleAnd wb pu -> propSetToggleAnd wb pu pr
|
||||
PropUpdates pus -> doPropUpdates pr pus
|
||||
PropUpdateLS lsid x -> \w -> w & lightSources . ix lsid %~ doPrWdLsLs x pr w
|
||||
PropUpdateLS lsid x -> \w -> w & cWorld . lightSources . ix lsid %~ doPrWdLsLs x pr w
|
||||
PropUpdatePosition x -> propUpdatePosition x pr
|
||||
PropUpdateWhen t x -> propUpdateIf t x PropUpdateId pr
|
||||
PropUpdateAnd x y -> doPropUpdates pr [x,y]
|
||||
@@ -32,8 +32,8 @@ propUpdateIf wb x y pr w
|
||||
|
||||
propUpdatePosition :: WdP2f -> Prop -> World -> World
|
||||
propUpdatePosition x pr w = w
|
||||
& props . ix (_prID pr) . prPos .~ fst (doWdP2f x w)
|
||||
& props . ix (_prID pr) . prRot .~ snd (doWdP2f x w)
|
||||
& cWorld . props . ix (_prID pr) . prPos .~ fst (doWdP2f x w)
|
||||
& cWorld . props . ix (_prID pr) . prRot .~ snd (doWdP2f x w)
|
||||
|
||||
doPropUpdates :: Prop -> [PropUpdate] -> World -> World
|
||||
doPropUpdates pr pus w = foldl' f w pus
|
||||
@@ -45,9 +45,9 @@ propSetToggleAnd wb pu pr = setToggle (doWdBl wb) pr . updateProp (pr & prUpdate
|
||||
-- fugly
|
||||
|
||||
setToggle :: (World -> Bool) -> Prop -> World -> World
|
||||
setToggle cond pr w = w & props . ix (_prID pr) . prToggle .~ cond w
|
||||
setToggle cond pr w = w & cWorld . props . ix (_prID pr) . prToggle .~ cond w
|
||||
|
||||
rotateProp :: Float -> Prop -> World -> World
|
||||
rotateProp rotAmount pr w = w
|
||||
& props . ix (_prID pr) . prRot +~ rotAmount
|
||||
& cWorld . props . ix (_prID pr) . prRot +~ rotAmount
|
||||
|
||||
|
||||
Reference in New Issue
Block a user