Commit before changing module system to Map

This commit is contained in:
2022-02-21 07:50:15 +00:00
parent 779e076c93
commit 724ee21afc
25 changed files with 171 additions and 86 deletions
+7 -2
View File
@@ -5,6 +5,7 @@ module Dodge.Item.Weapon.InventoryDisplay
( basicItemDisplay
, maybeWarmupStatus
, maybeRateStatus
, moduleStrings
) where
import Dodge.Data
import Padding
@@ -17,9 +18,8 @@ import Control.Lens
basicItemDisplay :: Item -> [String]
basicItemDisplay it = Prelude.take (itSlotsTaken it) $
(midPadL 15 ' ' thename (' ' : thenumber) ++ theparam)
: moduleStrings ++ repeat "*"
: moduleStrings it ++ repeat "*"
where
moduleStrings = fromMaybe [] $ it ^? itModules . modHitEffect . modName
thename = _itName it
thenumber = case it ^? itConsumption of
Just am@LoadableAmmo{} -> case _reloadState am of
@@ -37,6 +37,11 @@ basicItemDisplay it = Prelude.take (itSlotsTaken it) $
-- , maybeRateStatus
]
moduleStrings :: Item -> [String]
moduleStrings it = map (" " ++)
$ (fromMaybe [] $ it ^? itModules . modHitEffect . modName)
++ (fromMaybe [] $ it ^? itModules . modRifleMag . modName)
maybeModeStatus :: Item -> Maybe String
maybeModeStatus it = case it ^? itAttachment of
Just ItCharMode {_itCharMode = (c :<| _)} -> Just [' ',c]