This commit is contained in:
2022-07-14 21:32:19 +01:00
parent 893a3d5f17
commit 7d7ed6689d
10 changed files with 173 additions and 188 deletions
+6 -5
View File
@@ -111,14 +111,15 @@ mcTriggerVal :: Machine -> Maybe Bool
mcTriggerVal mc = case mc ^. mcSensor of
NoSensor -> Nothing
s@ProximitySensor{} -> s ^? sensToggle
s@SensorToggleAmount{} -> Just $ (_sensAmount s) > 900
s@SensorToggleAmount{} -> Just $ _sensAmount s > 900
mcPlaySound :: Machine -> World -> World
mcPlaySound mc w = case _mcCloseSound mc of
Just sid | d < 200 -> soundContinueVol (1-0.01*max 0 (d-100)) (MachineSound mid) (_mcPos mc) sid (Just 2) w
_ -> w
Just sid | d < 100
-> soundContinueVol (1-0.01*d) (MachineSound mid) (_mcPos mc) sid (Just 2) w
_ -> w
where
d = dist (_crPos $ you w) (_mcPos mc)
d = max 0 (dist (_crPos $ you w) (_mcPos mc) - 100)
mid = _mcID mc
mcApplyDamage :: [Damage] -> Machine -> World -> World
@@ -130,7 +131,7 @@ mcApplyDamage ds mc = case _mcSensor mc of
mcSensorUpdate :: Machine -> World -> World
mcSensorUpdate mc w = case _mcSensor mc of
NoSensor -> w
SensorToggleAmount{} -> foldr (flip sensorUpdate mc) w (map _dmType $ _mcDamage mc)
SensorToggleAmount{} -> foldr (flip sensorUpdate mc . _dmType) w (_mcDamage mc)
ProximitySensor{} -> mcProximitySensorUpdate mc w
mcProximitySensorUpdate :: Machine -> World -> World