Redo sound travel distances
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
module Dodge.Creature.Perception
|
||||
( perceptionUpdate
|
||||
, chaseCritPerceptionUpdate
|
||||
, newSounds
|
||||
-- , newSounds
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Creature.Vocalization
|
||||
@@ -165,7 +165,13 @@ rememberSounds w cr = cr
|
||||
where
|
||||
awakeupdate | null closesounds = id
|
||||
| otherwise = crPerception . crAwakeLevel .~ Vigilant
|
||||
closesounds = map fst (filter (soundIsClose cr) (newSounds w))
|
||||
closesounds = map fst (filter (soundIsClose w cr) (newSounds w))
|
||||
|
||||
soundIsClose :: Creature -> (Point2,Float) -> Bool
|
||||
soundIsClose cr (pos,vol) = vol > (_auDist . _crAudition $ _crPerception cr) (dist pos (_crPos cr))
|
||||
-- TODO work out correct form for sounds passing through walls
|
||||
soundIsClose :: World -> Creature -> (Point2,Float) -> Bool
|
||||
soundIsClose w cr (pos,vol)
|
||||
| dist cpos pos > 2000 = False
|
||||
| hasLOS cpos pos w = vol > (_auDist . _crAudition $ _crPerception cr) (dist pos cpos)
|
||||
| otherwise = False
|
||||
where
|
||||
cpos = _crPos cr
|
||||
|
||||
Reference in New Issue
Block a user