Add sounds when distributing ammo
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user