Cleanup constructors FooUse -> UseFoo

This commit is contained in:
2024-10-03 20:39:41 +01:00
parent 6b4cf596b1
commit 127d85e7ce
10 changed files with 49 additions and 92 deletions
+5 -23
View File
@@ -1,36 +1,18 @@
module Dodge.Item.Display (
itemDisplay,
-- canAttachTargeting,
itemString,
itemBaseName,
basicItemDisplay,
) where
--import Control.Applicative
--import Control.Monad
import ShortShow
import Data.Maybe
import Dodge.Data.Creature
import LensHelp
import Padding
--canAttachTargeting :: TargetingType -> Item -> Bool
--canAttachTargeting TARGETLASER _ = True
--canAttachTargeting _ itm =
-- isJust (itm ^? itType . iyModules . ix ModBulletTrajectory . imtBulletTrajectoryType)
-- || Just LAUNCHHOME == (itm ^? itType . iyModules . ix ModLauncherHoming)
--targetingTypeString :: TargetType -> String
--targetingTypeString tt = case tt of
-- TARGETLASER -> "LASER"
-- TargetRBPress -> "POS"
-- TargetRBLine -> ""
-- TargetRBCreature -> "LIFEFORM"
-- TargetCursor -> "CURSOR"
itemDisplay :: Creature -> Item -> [String]
itemDisplay cr itm =
--itemDisplayWithNumber (showConsumption cr it) it
zipWithDefaults id (leftPad 15 ' ') itemDisplayPad (basicItemDisplay itm) (itemNumberDisplay cr itm)
zipWithDefaults :: (a -> c) -> (b -> c) -> (a -> b -> c) -> [a] -> [b] -> [c]
@@ -113,15 +95,15 @@ itemNumberDisplay cr itm = case iu of
UseHeld{} -> []
UseHotkey{} -> [showAutoRechargeProgress (_leftConsumption iu)]
UseEquip{} -> showEquipmentNumber cr itm
CraftUse -> []
UseCraft -> []
UseConsume {} -> []
UseAttach {} -> []
UseAmmoMag {} -> [maybe "" shortShow $ itm ^? itUse . amagLoadStatus . iaLoaded]
ScopeUse OpticScope {_opticZoom = x} -> [shortShow x]
ScopeUse {} -> []
TargetingUse {_tgPos = mp} -> [maybe "" shortShow mp]
UseScope OpticScope {_opticZoom = x} -> [shortShow x]
UseScope {} -> []
UseTargeting {_tgPos = mp} -> [maybe "" shortShow mp]
-- this could be cleaner here...
BulletModUse {} -> mempty
UseBulletMod {} -> mempty
where
iu = itm ^?! itUse