Improve detector equipment, various cleanup

This commit is contained in:
2022-05-27 18:49:54 +01:00
parent 60fc2d44e8
commit 79b3a86520
15 changed files with 180 additions and 138 deletions
+4 -4
View File
@@ -34,9 +34,9 @@ import Data.Maybe
--import qualified Control.Foldl as L
import qualified Data.Set as S
import qualified SDL
autoEffect :: (Creature -> World -> World) -> Int -> SoundID -> Item -> Creature -> World -> World
autoEffect :: (Item -> Creature -> World -> World) -> Int -> SoundID -> Item -> Creature -> World -> World
autoEffect eff t sid itm cr w
| _eparamInt (_eqParams (_itUse itm)) < 1 = eff cr w
| _eparamInt (_eqParams (_itUse itm)) < 1 = eff itm cr w
& creatures . ix (_crID cr) . crInv . ix (fromJust $ _itInvPos itm)
. itUse . eqParams . eparamInt .~ t
& soundStart OnceSound (_crPos cr) sid Nothing
@@ -46,10 +46,10 @@ autoEffect eff t sid itm cr w
{- | Automatically send out radar pulses that detect walls. -}
autoRadarEffect :: Item -> Creature -> World -> World
autoRadarEffect = autoEffect aWallPulse 100 click1S
autoRadarEffect = autoEffect (const aWallPulse) 100 click1S
{- | Automatically send out sonar pulses that detect creatures. -}
autoSonarEffect :: Item -> Creature -> World -> World
autoSonarEffect = autoEffect aSonarPulse 50 click1S
autoSonarEffect = autoEffect (const aSonarPulse) 50 click1S
defaultTargeting :: Targeting
defaultTargeting = Targeting
{ _tgPos = Nothing