diff --git a/src/Dodge/Data/SoundOrigin.hs b/src/Dodge/Data/SoundOrigin.hs index 8ed0edada..00c820777 100644 --- a/src/Dodge/Data/SoundOrigin.hs +++ b/src/Dodge/Data/SoundOrigin.hs @@ -18,7 +18,8 @@ data SoundOrigin | CrWeaponSound Int Int | ItemSound Int Int | CrWeaponFailSound Int - | MachineSound Int + | MachinePrimarySound Int + | MachineBackgroundSound Int | MachineAltSound Int | TerminalSound | WallSound Int diff --git a/src/Dodge/HeldUse.hs b/src/Dodge/HeldUse.hs index d8073525d..15111519a 100644 --- a/src/Dodge/HeldUse.hs +++ b/src/Dodge/HeldUse.hs @@ -1153,7 +1153,7 @@ doGenFloat (UniRandFloat x y) g = randomR (x, y) g mcShootLaser :: Item -> Machine -> World -> World mcShootLaser _ mc = - shootLaser (MachineSound (_mcID mc)) (DamageLaser 11) 1 pos dir yellow + shootLaser (MachinePrimarySound (_mcID mc)) (DamageLaser 11) 1 pos dir yellow where pos = _mcPos mc +.+ 20 *.* unitVectorAtAngle dir dir = mc ^?! mcType . _McTurret . tuDir diff --git a/src/Dodge/Machine.hs b/src/Dodge/Machine.hs deleted file mode 100644 index d729542b7..000000000 --- a/src/Dodge/Machine.hs +++ /dev/null @@ -1,56 +0,0 @@ -module Dodge.Machine where - -import Linear -import Dodge.Base -import Dodge.Data.World -import Dodge.Machine.Damage -import Dodge.SoundLogic -import Dodge.Wall.Delete -import Geometry -import qualified IntMapHelp as IM -import LensHelp -import Sound.Data - -basicMachineUpdate :: (Machine -> World -> World) -> Machine -> World -> World -basicMachineUpdate f mc = basicMachineApplyDamage mc . f mc - -machineUpdateLiveDieEff :: - -- | effect when hp >= 1 - (Machine -> World -> World) -> - -- | effect (once) when hp < 1 - (Machine -> World -> World) -> - Machine -> - World -> - World -machineUpdateLiveDieEff livef dief mc - | _mcHP mc < 1 = - dief mc - . (cWorld . lWorld . machines %~ IM.delete mcid) - . deleteWallIDs (_mcWallIDs mc) - | otherwise = livef mc . (cWorld . lWorld . machines . ix mcid %~ ((mcDamage .~ []) . (mcHP -~ dams))) - where - dams = sum $ map _dmAmount $ _mcDamage mc - mcid = _mcID mc - -machineUpdateDeathEff :: - (Machine -> World -> World) -> - Machine -> - World -> - World -machineUpdateDeathEff f mc - | _mcHP mc < 1 = - f mc - . (cWorld . lWorld . machines %~ IM.delete mcid) - . deleteWallIDs (_mcWallIDs mc) - | otherwise = cWorld . lWorld . machines . ix mcid %~ ((mcDamage .~ []) . (mcHP -~ dams)) - where - dams = sum $ map _dmAmount $ _mcDamage mc - mcid = _mcID mc - -machineAddSound :: SoundID -> (Machine -> World -> World) -> Machine -> World -> World -machineAddSound sid f mc w - | d < 200 = soundContinueVol (1 -0.005 * d) (MachineSound mid) (_mcPos mc) sid (Just 2) $ f mc w - | otherwise = f mc w - where - d = dist (you w ^. crPos . _xy) (_mcPos mc) - mid = _mcID mc diff --git a/src/Dodge/Machine/Update.hs b/src/Dodge/Machine/Update.hs index 114c59995..f2597da74 100644 --- a/src/Dodge/Machine/Update.hs +++ b/src/Dodge/Machine/Update.hs @@ -118,11 +118,29 @@ mcPlaySound mc w = case _mcType mc of | d < 100 -> soundContinueVol (1 -0.01 * d) - (MachineSound mid) + (MachineBackgroundSound mid) (_mcPos mc) fridgeHumS (Just 2) w + McDistributer {} + | d < 100 -> + soundContinueVol + (0.5 * (1 -0.01 * d)) + (MachineBackgroundSound mid) + (_mcPos mc) + whirS + (Just 2) + w + McProxSensor {} + | d < 100 -> + soundContinueVol + (0.5 * (1 -0.01 * d)) + (MachineBackgroundSound mid) + (_mcPos mc) + throbC4S + (Just 2) + w _ -> w where d = max 0 (dist ( you w ^. crPos . _xy) (_mcPos mc) - 100)