From ada80fb925ac4cb4b4f3ea7d023290ed8f8e1093 Mon Sep 17 00:00:00 2001 From: justin Date: Fri, 26 Dec 2025 11:35:14 +0000 Subject: [PATCH] Add sounds when distributing ammo --- src/Dodge/WorldEffect.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Dodge/WorldEffect.hs b/src/Dodge/WorldEffect.hs index 2709dda78..7ee438c64 100644 --- a/src/Dodge/WorldEffect.hs +++ b/src/Dodge/WorldEffect.hs @@ -119,17 +119,21 @@ tmDistributeAmmo tm w = fromMaybe w $ do let mid = tm ^. tmMachineID sid <- w ^? cWorld . lWorld . machines . ix mid . mcType . mcdStorageMachine . _Just + p <- w ^? cWorld . lWorld . machines . ix mid . mcPos McStorage atype aamount <- w ^? cWorld . lWorld . machines . ix sid . mcType - let (x',w') = distributeAmmoToYou atype aamount w + let (newaamount,w') = distributeAmmoToYou atype aamount w return $ w' - & cWorld . lWorld . machines . ix sid . mcType . mcsAmount .~ x' + & cWorld . lWorld . machines . ix sid . mcType . mcsAmount .~ newaamount & cWorld . lWorld . terminals . ix (tm ^. tmID) . tmFutureLines .~ - [TLine 1 [TerminalLineConst (g (aamount - x')) white] TmWdId - ,TLine 1 [TerminalLineConst (shortShow x' <>" "<>show atype<>" AVAILABLE") white] TmWdId + [TLine 1 [TerminalLineConst (g (aamount - newaamount)) white] TmWdId + ,TLine 1 [TerminalLineConst (shortShow newaamount <>" "<>show atype<>" AVAILABLE") white] TmWdId ,TLine 1 [TerminalLineConst "" yellow] (TmTmSetStatus (TerminalPressTo "")) ,TLine 1 [TerminalLineConst "" white] TmWdWdPowerDownTerminal ] + & dosound (aamount - newaamount) p where + dosound x p | x > 0 = soundStart TerminalSound p reloadS Nothing + | otherwise = soundStart TerminalSound p dedumS Nothing g 0 = "NO SUITABLE RECIPIENTS" g _ = "SUCCESFUL"