20 lines
516 B
Haskell
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
|