Simplify props (should they be removed?)

This commit is contained in:
2025-11-09 11:59:59 +00:00
parent dd4ac80159
commit 397980a83f
4 changed files with 0 additions and 65 deletions
-31
View File
@@ -1,31 +0,0 @@
module Dodge.Prop.Update (updateProp) where
import Control.Lens
import Data.Foldable
import Dodge.Data.World
import Dodge.WdP2f
import Dodge.WorldBool
updateProp :: Prop -> World -> World
updateProp pr = case _prUpdate pr of
PropUpdateId -> id
PropUpdates pus -> doPropUpdates pr pus
PropUpdatePosition x -> propUpdatePosition x pr
PropUpdateWhen t x -> propUpdateIf t x PropUpdateId pr
PropUpdateIf t x y -> propUpdateIf t x y pr
propUpdateIf :: WdBl -> PropUpdate -> PropUpdate -> Prop -> World -> World
propUpdateIf wb x y pr w
| doWdBl wb w = updateProp (pr & prUpdate .~ x) w
| otherwise = updateProp (pr & prUpdate .~ y) w
propUpdatePosition :: WdP2f -> Prop -> World -> World
propUpdatePosition x pr w =
w
& cWorld . lWorld . props . ix (_prID pr) . prPos .~ fst (doWdP2f x w)
& cWorld . lWorld . props . ix (_prID pr) . prRot .~ snd (doWdP2f x w)
doPropUpdates :: Prop -> [PropUpdate] -> World -> World
doPropUpdates pr pus w = foldl' f w pus
where
f w' pu = updateProp (pr & prUpdate .~ pu) w'