Files
loop/src/Dodge/PressPlate.hs
T
2025-10-10 13:47:31 +01:00

20 lines
516 B
Haskell

module Dodge.PressPlate where
import Control.Lens
import Linear
import Dodge.Base.You
import Dodge.Data.World
import Dodge.WorldEvent.Explosion
import Geometry
doPressPlateEvent :: PressPlateEvent -> PressPlate -> World -> World
doPressPlateEvent ppe = case ppe of
PressPlateId -> const id
PPLevelReset -> ppLevelReset
ppLevelReset :: PressPlate -> World -> World
ppLevelReset pp w
| dist (you w ^. crPos . _xy) (_ppPos pp) < 20
= makeExplosionAt (_ppPos pp `v2z` 20) 0 w
| otherwise = w