Refactor reloading to use list of required steps

This commit is contained in:
2022-06-20 19:06:02 +01:00
parent a85cf4d1fb
commit 37eb69c661
16 changed files with 79 additions and 118 deletions
+10 -6
View File
@@ -31,16 +31,20 @@ itemDisplay it = Prelude.take (itSlotsTaken it) $
showConsumption :: ItemConsumption -> String
showConsumption ic = case ic of
am@LoadableAmmo{} -> showLoading (_laLoadType ic) ++ show (_laLoaded am)
am@LoadableAmmo{} -> showLoading (_laProgress ic) ++ show (_laLoaded am)
am@ChargeableAmmo{} -> show $ _wpCharge am
x@ItemItselfConsumable{} -> show (_icAmount x)
NoConsumption -> ""
showLoading :: LoadType -> String
showLoading lt = case lt ^? loadProgress of
Just (Eject t) -> show t ++ "E"
Just (Insert t _) -> show t ++ "R"
Just NoTransfer -> ""
showLoading :: LoadProgress -> String
showLoading lt = case lt ^? futureActions . ix 0 of
Just lap -> show (_actionTime (_actionType lap) - _actionProgress lap)
++ showLoadActionType (_actionType lap)
Nothing -> ""
showLoadActionType :: LoadAction -> String
showLoadActionType la = case la of
Eject {} -> "E"
Insert {} -> "L"
Prime {} -> "P"
-- & itInvDisplay .~ \it -> head (basicItemDisplay it) :
-- ["*FIRERATE:" ++ fromMaybe "" (maybeRateStatus it)