Cleanup
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user