Move towards using item structural function when using items

This commit is contained in:
2024-10-05 20:53:50 +01:00
parent 7c324a03f6
commit 3b54f00cc7
16 changed files with 142 additions and 111 deletions
+1 -1
View File
@@ -99,7 +99,7 @@ itemNumberDisplay cr itm = case iu of
UseAttach {} -> []
UseAmmoMag {} -> [maybe "" shortShow $ itm ^? itUse . amagLoadStatus . iaLoaded]
UseScope OpticScope {_opticZoom = x} -> [shortShow x]
UseTargeting {_tgPos = mp} -> [maybe "" shortShow mp]
-- UseTargeting {_tgPos = mp} -> [maybe "" shortShow mp]
-- this could be cleaner here...
UseBulletMod {} -> mempty
where
+6 -2
View File
@@ -1,6 +1,5 @@
module Dodge.Item.Grammar (
invLDT,
invTrees',
invTrees,
invIndentIM,
invAdj,
@@ -81,7 +80,12 @@ itemToFunction itm = case itm ^. itType of
_ -> UncomposableIsolateSF
simplePCI :: Item -> PartiallyComposedItem ItemLink
simplePCI itm = (itm, itemToFunction itm, uncurry useBreakL' $ itemToBreakLists itm)
simplePCI itm = case _itType itm of
HELD LASGUN -> (itm, WeaponScopeSF, uncurry useBreakL' $ itemToBreakLists itm)
_ -> (itm, itemToFunction itm, uncurry useBreakL' $ itemToBreakLists itm)
itemLinkTestLeft :: Item -> PartiallyComposedItem (LinkTest ItemLink) -> Maybe (LinkUpdate ItemLink)
itemLinkTestLeft itm pci = Nothing
basePartiallyComposedItem' :: Item -> PartiallyComposedItem ItemLink
basePartiallyComposedItem' itm = simplePCI itm
+5 -8
View File
@@ -48,14 +48,11 @@ lasGun =
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldAim . aimMuzzles . ix 0 . mzFlareType .~ LasGunFlare
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleLaser
-- & itParams
-- .~ Refracting
-- { _phaseV = 1
-- , _lasColor = yellow
-- , _lasColor2 = yellow
-- , _lasCycle = 0
-- , _lasDamage = 11
-- }
& itTargeting .~ ItTargeting
{ _itTgPos = Nothing
, _itTgID = Nothing
, _itTgActive = False
}
& itDimension . dimRad .~ 10
& itDimension . dimCenter .~ V3 15 0 0
& itUse . heldAim . aimWeight .~ 6
+10 -8
View File
@@ -25,17 +25,19 @@ targetingScope tt= case tt of
TARGETLASER -> defaultHeldItem
& itType .~ TARGETING tt
& itAmmoSlots .~ singleAmmo ElectricalAmmo
& itUse .~ UseTargeting
{ _tgPos = Nothing
, _tgID = Nothing
, _tgActive = False
& itUse .~ UseCraft
& itTargeting .~ ItTargeting
{ _itTgPos = Nothing
, _itTgID = Nothing
, _itTgActive = False
}
_ -> defaultHeldItem
& itType .~ TARGETING tt
& itUse .~ UseTargeting
{ _tgPos = Nothing
, _tgID = Nothing
, _tgActive = False
& itUse .~ UseCraft
& itTargeting .~ ItTargeting
{ _itTgPos = Nothing
, _itTgID = Nothing
, _itTgActive = False
}
homingModule :: Item