Auto create tree structure for held item ammo, add derive instances
This commit is contained in:
@@ -39,6 +39,7 @@ beltMag =
|
||||
tinMag & itType . iyBase . ibtAmmoMag .~ BELTMAG
|
||||
& itUse . amagLoadStatus . iaLoaded .~ 10000
|
||||
& itUse . amagLoadStatus . iaMax .~ 20000
|
||||
& itUse . amagType .~ BeltBulletAmmo
|
||||
|
||||
shellMag :: Item
|
||||
shellMag =
|
||||
|
||||
@@ -28,16 +28,26 @@ singleDT x = DT x [] []
|
||||
singleLDT :: a -> LabelDoubleTree b a
|
||||
singleLDT x = LDT x [] []
|
||||
|
||||
baseComposedItem' :: ItemBaseType -> CIL
|
||||
baseComposedItem' ibt = case ibt of
|
||||
HELD BURSTRIFLE -> (WeaponCI, [(AmmoInLink,BulletAmmoCI)], [])
|
||||
AMMOMAG TINMAG -> (BulletAmmoCI, [(AmmoModLink,AmmoModifierCI)], [])
|
||||
AMMOMAG DRUMMAG -> (BulletAmmoCI, [(AmmoModLink,AmmoModifierCI)], [])
|
||||
ATTACH BULLETSYNTHESIZER -> (AmmoModifierCI, [], [])
|
||||
baseComposedItem :: ItemBaseType -> Item -> CIL
|
||||
baseComposedItem ibt itm = case ibt of
|
||||
HELD _ -> heldComposedItem itm
|
||||
AMMOMAG _ -> ammoComposedItem itm
|
||||
ATTACH BULLETSYNTHESIZER -> (AmmoModifierCI BulletAmmo, [], [])
|
||||
_ -> (UncomposableCI, [], [])
|
||||
|
||||
heldComposedItem :: Item -> CIL
|
||||
heldComposedItem itm = (WeaponCI, map f ats, [])
|
||||
where
|
||||
ats = itm ^.. itUse . heldAmmoTypes . traverse
|
||||
f atype = (AmmoInLink atype,AmmoCI atype)
|
||||
|
||||
ammoComposedItem :: Item -> CIL
|
||||
ammoComposedItem itm = fromMaybe (error "in ammoComposedItem, wrong item") $ do
|
||||
atype <- itm ^? itUse . amagType
|
||||
return (AmmoCI atype, [(AmmoModLink,AmmoModifierCI atype)], [])
|
||||
|
||||
baseCIS :: Item -> ComposedItemStructure
|
||||
baseCIS itm = let (a,b,c) = baseComposedItem' (itm ^. itType . iyBase)
|
||||
baseCIS itm = let (a,b,c) = baseComposedItem (itm ^. itType . iyBase) itm
|
||||
in (itm, a, b, c)
|
||||
|
||||
type LDTTest a b = LabelDoubleTree b a -> LabelDoubleTree b a -> Maybe b
|
||||
|
||||
@@ -101,7 +101,7 @@ miniGunUse i =
|
||||
& heldAim . aimRange .~ 1
|
||||
& heldAim . aimStance .~ TwoHandUnder
|
||||
& heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
& heldAmmoTypes .~ [BulletAmmo]
|
||||
& heldAmmoTypes .~ [BeltBulletAmmo]
|
||||
|
||||
miniGunX :: Int -> Item
|
||||
miniGunX i =
|
||||
|
||||
Reference in New Issue
Block a user