Start allowing for more granular control of remote projectiles, cleanup

This commit is contained in:
2024-12-26 10:16:18 +00:00
parent ae557f3fd4
commit 53c981718c
14 changed files with 273 additions and 218 deletions
+19 -18
View File
@@ -1,3 +1,4 @@
{-# LANGUAGE LambdaCase #-}
module Dodge.Item.Display (
itemDisplay,
itemBaseName,
@@ -13,6 +14,10 @@ import LensHelp
import Padding
import ShortShow
-- Principles: base names should identify an item, numbers can change based on a
-- variety of factors but typically don't depend on functional quality,
-- colour gives an indication of an item's function within a structure
itemDisplay :: Creature -> ComposedItem -> [String]
itemDisplay cr ci =
zipWithDefaults
@@ -39,7 +44,7 @@ itemDisplayPad ls rs
basicItemDisplay :: Item -> [String]
basicItemDisplay itm =
Prelude.take (itInvHeight itm) $
itemBaseName itm :
itemBaseName (itm ^. itType) :
--catMaybes [maybeWarmupStatus itm, maybeRateStatus itm]
catMaybes [maybeWarmupStatus itm]
++ repeat "*"
@@ -47,36 +52,28 @@ basicItemDisplay itm =
itemString :: Item -> String
itemString = head . basicItemDisplay
itemBaseName :: Item -> String
itemBaseName itm = case _itType itm of
-- this should be immutable with the item type
itemBaseName :: ItemType -> String
itemBaseName = \case
CRAFT str -> show str
HELD hit -> case hit ^? xNum of
Just i -> takeWhile (/= ' ') (show hit) ++ show i
Nothing -> show hit
EQUIP eit -> showEquipItem eit
ATTACH ait -> showAttachItem ait itm
ATTACH ait -> showAttachItem ait
AMMOMAG ait -> show ait
TARGETING tt -> show tt
-- BULLETMOD (BulletModTrajectory btt) -> show btt
BULLETMOD (BulletModPayload btt) -> show btt
BULLETMOD (BulletModEffect btt) -> show btt
showAttachItem :: AttachType -> Item -> String
showAttachItem t itm = case t of
showAttachItem :: AttachType -> String
showAttachItem t = case t of
ZOOMSCOPE -> "ZOOMSCOPE"
BULLETSYNTH -> "BSYNTH"
REMOTESCREEN ->
"REMOTE SCREEN "
++ maybe
mempty
show
(itm ^? itUse . uaParams . apLinkedProjectile . _Just)
REMOTEDETONATOR ->
"REM.DETONATOR"
++ maybe
mempty
show
(itm ^? itUse . uaParams . apLinkedProjectile . _Just)
REMOTESCREEN -> "REM.SCREEN"
REMOTECONTROLLER -> "REM.CONTR0LR"
REMOTEDETONATOR -> "REM.DETONATR"
HOMINGMODULE -> "HOMING MOD"
AUGMENTEDHUD -> "AUGMENTED HUD"
SHELLPAYLOAD x -> show x
@@ -86,6 +83,9 @@ showEquipItem eit = case eit of
INVISIBILITYEQUIPMENT esite -> "INVISIBILITY " ++ show esite
_ -> show eit
-- this can change, but probably won't when (say) dropped and then picked up
-- again
-- that is to say, it should not change based on functional positioning
itemNumberDisplay :: Creature -> ComposedItem -> [String]
itemNumberDisplay cr ci
| EQUIP WRIST_ECG <- ci ^. _1 . itType =
@@ -98,6 +98,7 @@ itemNumberDisplay cr ci
["!TARG!"]
| Just x <- ci ^? _1 . itConsumables . magLoadStatus . iaLoaded = [shortShow x]
| UseAttach (APInt i) <- ci ^. _1 . itUse = [show i]
| UseAttach (APLinkProjectile i) <- ci ^. _1 . itUse = [show i]
| UseScope OpticScope{_opticZoom = x} <- ci ^. _1 . itUse = [shortShow x]
| otherwise = mempty