Implement bullet synth
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -217,7 +217,11 @@ inventoryX c = case c of
|
|||||||
, makeTypeCraftNum 1 SOUNDSENSOR
|
, makeTypeCraftNum 1 SOUNDSENSOR
|
||||||
, makeTypeCraftNum 1 HEATSENSOR
|
, makeTypeCraftNum 1 HEATSENSOR
|
||||||
]
|
]
|
||||||
'L' -> [scrollWatch]
|
'L' -> [burstRifle
|
||||||
|
,tinMag
|
||||||
|
, bulletSynthesizer
|
||||||
|
, battery
|
||||||
|
]
|
||||||
'M' -> stackedInventory
|
'M' -> stackedInventory
|
||||||
'N' -> [zoomScope,laser,battery, sniperRifle, tinMag]
|
'N' -> [zoomScope,laser,battery, sniperRifle, tinMag]
|
||||||
'O' -> [ launcherX 2
|
'O' -> [ launcherX 2
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ crUpdate f =
|
|||||||
, f
|
, f
|
||||||
, footstepSideEffect
|
, footstepSideEffect
|
||||||
, updateInv -- upInv must be called before invSideEff 22.05.23
|
, updateInv -- upInv must be called before invSideEff 22.05.23
|
||||||
|
, invRootItemEffs
|
||||||
, invSideEff
|
, invSideEff
|
||||||
, equipmentEffects
|
, equipmentEffects
|
||||||
]
|
]
|
||||||
@@ -163,6 +164,40 @@ invSideEff cr = alaf Endo foldMap f (_crInv cr) . updateHeldRootItem cr
|
|||||||
where
|
where
|
||||||
f it = maybe id (\g -> doInvEffect g it cr) (it ^? itEffect . ieInv)
|
f it = maybe id (\g -> doInvEffect g it cr) (it ^? itEffect . ieInv)
|
||||||
|
|
||||||
|
-- a loop going over all root inventory items
|
||||||
|
invRootItemEffs :: Creature -> World -> World
|
||||||
|
invRootItemEffs cr = appEndo $ foldMap (reduceLocLDT (Endo . invItemLocUpdate) . LocLDT TopLDT)
|
||||||
|
(invLDT (_crInv cr))
|
||||||
|
|
||||||
|
invItemLocUpdate :: LocationLDT ItemLink PartiallyComposedItem -> World -> World
|
||||||
|
invItemLocUpdate loc w = case itm ^. itType of
|
||||||
|
ATTACH BULLETSYNTH -> fromMaybe w $ do
|
||||||
|
i <- itm ^? itLocation . ilInvID
|
||||||
|
x <- itm ^? itUse . uaParams . apInt
|
||||||
|
if x < 100
|
||||||
|
then do
|
||||||
|
bat <- loc ^? locLDT . ldtLeft . ix 0 . _2 . ldtValue . _1
|
||||||
|
j <- bat ^? itLocation . ilInvID
|
||||||
|
y <- bat ^? itUse . amagLoadStatus . iaLoaded
|
||||||
|
guard $ y > 0
|
||||||
|
return $ w & cWorld . lWorld . creatures
|
||||||
|
. ix 0 . crInv . ix i . itUse . uaParams . apInt +~ 1
|
||||||
|
& cWorld . lWorld . creatures
|
||||||
|
. ix 0 . crInv . ix j . itUse . amagLoadStatus . iaLoaded -~ 1
|
||||||
|
else do
|
||||||
|
mag <- loc ^? locLdtContext . cldtParent . _1
|
||||||
|
j <- mag ^? itLocation . ilInvID
|
||||||
|
y <- mag ^? itUse . amagLoadStatus . iaLoaded
|
||||||
|
ymax <- mag ^? itUse . amagLoadStatus . iaMax
|
||||||
|
guard $ y < ymax
|
||||||
|
return $ w & cWorld . lWorld . creatures
|
||||||
|
. ix 0 . crInv . ix i . itUse . uaParams . apInt .~ 0
|
||||||
|
& cWorld . lWorld . creatures
|
||||||
|
. ix 0 . crInv . ix j . itUse . amagLoadStatus . iaLoaded +~ 1
|
||||||
|
_ -> w
|
||||||
|
where
|
||||||
|
itm = loc ^. locLDT . ldtValue . _1
|
||||||
|
|
||||||
updateHeldRootItem :: Creature -> World -> World
|
updateHeldRootItem :: Creature -> World -> World
|
||||||
updateHeldRootItem cr = fromMaybe id $ do
|
updateHeldRootItem cr = fromMaybe id $ do
|
||||||
invid <- cr ^? crManipulation . manObject . imRootSelectedItem
|
invid <- cr ^? crManipulation . manObject . imRootSelectedItem
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ data CraftType
|
|||||||
|
|
||||||
data AttachType
|
data AttachType
|
||||||
= ZOOMSCOPE
|
= ZOOMSCOPE
|
||||||
| BULLETSYNTHESIZER
|
| BULLETSYNTH
|
||||||
| REMOTESCREEN
|
| REMOTESCREEN
|
||||||
| HOMINGMODULE
|
| HOMINGMODULE
|
||||||
| AUGMENTEDHUD
|
| AUGMENTEDHUD
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ data AttachParams
|
|||||||
{_apLinkedProjectile :: Maybe Int}
|
{_apLinkedProjectile :: Maybe Int}
|
||||||
| APItEffect
|
| APItEffect
|
||||||
{_apItEffect :: ItEffect }
|
{_apItEffect :: ItEffect }
|
||||||
|
| APInt {_apInt :: Int}
|
||||||
| APNothing
|
| APNothing
|
||||||
deriving (Eq, Show, Read)
|
deriving (Eq, Show, Read)
|
||||||
|
|
||||||
|
|||||||
@@ -252,3 +252,7 @@ cldtPropagateFold lf rf up x loc =
|
|||||||
(LocLDT con' t'))
|
(LocLDT con' t'))
|
||||||
(locGoRight loc)
|
(locGoRight loc)
|
||||||
. up x loc
|
. up x loc
|
||||||
|
|
||||||
|
reduceLocLDT :: Monoid m => (LocationLDT b a -> m) -> LocationLDT b a -> m
|
||||||
|
reduceLocLDT f x =foldMap (reduceLocLDT f) (locGoLeft x) <> f x
|
||||||
|
<> foldMap (reduceLocLDT f) (locGoRight x)
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@ itemFromAmmoMag at = case at of
|
|||||||
itemFromAttachType :: AttachType -> Item
|
itemFromAttachType :: AttachType -> Item
|
||||||
itemFromAttachType at = case at of
|
itemFromAttachType at = case at of
|
||||||
ZOOMSCOPE -> zoomScope
|
ZOOMSCOPE -> zoomScope
|
||||||
BULLETSYNTHESIZER -> bulletSynthesizer
|
BULLETSYNTH -> bulletSynthesizer
|
||||||
REMOTESCREEN -> remoteScreen
|
REMOTESCREEN -> remoteScreen
|
||||||
-- ROCKETHOMER -> rocketHomer
|
-- ROCKETHOMER -> rocketHomer
|
||||||
HOMINGMODULE -> homingModule
|
HOMINGMODULE -> homingModule
|
||||||
|
|||||||
@@ -122,4 +122,5 @@ chemFuelPouch =
|
|||||||
}
|
}
|
||||||
|
|
||||||
bulletSynthesizer :: Item
|
bulletSynthesizer :: Item
|
||||||
bulletSynthesizer = makeAttach BULLETSYNTHESIZER
|
bulletSynthesizer = makeAttach BULLETSYNTH
|
||||||
|
& itUse .~ UseAttach (APInt 0)
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ itemBaseName itm = case _itType itm of
|
|||||||
showAttachItem :: AttachType -> Item -> String
|
showAttachItem :: AttachType -> Item -> String
|
||||||
showAttachItem t itm = case t of
|
showAttachItem t itm = case t of
|
||||||
ZOOMSCOPE -> "ZOOMSCOPE"
|
ZOOMSCOPE -> "ZOOMSCOPE"
|
||||||
BULLETSYNTHESIZER -> "BSYNTH"
|
BULLETSYNTH -> "BSYNTH"
|
||||||
REMOTESCREEN -> "REMOTE SCREEN " ++ show (itm ^? itUse . uaParams . apLinkedProjectile . _Just)
|
REMOTESCREEN -> "REMOTE SCREEN " ++ show (itm ^? itUse . uaParams . apLinkedProjectile . _Just)
|
||||||
HOMINGMODULE -> "HOMING MOD"
|
HOMINGMODULE -> "HOMING MOD"
|
||||||
AUGMENTEDHUD -> "AUGMENTED HUD"
|
AUGMENTEDHUD -> "AUGMENTED HUD"
|
||||||
@@ -93,20 +93,21 @@ showAutoRechargeProgress lc = case lc of
|
|||||||
-- ic = (itm ^?! itUse . heldConsumption . laSource)
|
-- ic = (itm ^?! itUse . heldConsumption . laSource)
|
||||||
|
|
||||||
itemNumberDisplay :: Creature -> ComposedItem -> [String]
|
itemNumberDisplay :: Creature -> ComposedItem -> [String]
|
||||||
itemNumberDisplay cr ci = case (ci ^. cItemFunction,iu) of
|
itemNumberDisplay cr ci = case (ci ^. cItemFunction, itm ^?! itUse) of
|
||||||
(WeaponTargetingSF,_) -> [maybe "" (const "!TARG!") (itm ^? itTargeting . itTgPos . _Just)]
|
(WeaponTargetingSF,_)
|
||||||
|
-> [maybe "" (const "!TARG!") (itm ^? itTargeting . itTgPos . _Just)]
|
||||||
(_,UseHeld{}) -> []
|
(_,UseHeld{}) -> []
|
||||||
(_,UseHotkey{}) -> [showAutoRechargeProgress (_leftConsumption iu)]
|
(_,UseHotkey{_leftConsumption=lc}) -> [showAutoRechargeProgress lc]
|
||||||
(_,UseEquip{}) -> showEquipmentNumber cr itm
|
(_,UseEquip{}) -> showEquipmentNumber cr itm
|
||||||
(_,UseCraft) -> []
|
(_,UseCraft) -> []
|
||||||
(_,UseConsume {}) -> []
|
(_,UseConsume {}) -> []
|
||||||
|
(_,UseAttach (APInt i)) -> [show i]
|
||||||
(_,UseAttach {}) -> []
|
(_,UseAttach {}) -> []
|
||||||
(_,UseAmmoMag {}) -> [maybe "" shortShow $ itm ^? itUse . amagLoadStatus . iaLoaded]
|
(_,UseAmmoMag {}) -> [maybe "" shortShow $ itm ^? itUse . amagLoadStatus . iaLoaded]
|
||||||
(_,UseScope OpticScope {_opticZoom = x}) -> [shortShow x]
|
(_,UseScope OpticScope {_opticZoom = x}) -> [shortShow x]
|
||||||
(_,UseBulletMod {}) -> mempty
|
(_,UseBulletMod {}) -> mempty
|
||||||
where
|
where
|
||||||
itm = ci ^. cItem
|
itm = ci ^. cItem
|
||||||
iu = itm ^?! itUse
|
|
||||||
|
|
||||||
showEquipmentNumber :: Creature -> Item -> [String]
|
showEquipmentNumber :: Creature -> Item -> [String]
|
||||||
showEquipmentNumber _ itm = case _eeUse ee of
|
showEquipmentNumber _ itm = case _eeUse ee of
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ import Dodge.Item.Orientation
|
|||||||
import LensHelp
|
import LensHelp
|
||||||
import ListHelp
|
import ListHelp
|
||||||
|
|
||||||
|
tryAttachItems ::
|
||||||
|
LabelDoubleTree ItemLink PartiallyComposedItem ->
|
||||||
|
LabelDoubleTree ItemLink PartiallyComposedItem ->
|
||||||
|
Maybe (LabelDoubleTree ItemLink PartiallyComposedItem)
|
||||||
|
tryAttachItems = leftRightCombine leftIsParentCombine rightIsParentCombine
|
||||||
|
|
||||||
useBreakL ::
|
useBreakL ::
|
||||||
[(ItemStructuralFunction, ComposeLinkType)] ->
|
[(ItemStructuralFunction, ComposeLinkType)] ->
|
||||||
[(ItemStructuralFunction, ComposeLinkType)] ->
|
[(ItemStructuralFunction, ComposeLinkType)] ->
|
||||||
@@ -66,6 +72,8 @@ itemToBreakLists ci = case (itm ^. itType, ci ^. cItemFunction) of
|
|||||||
, []
|
, []
|
||||||
)
|
)
|
||||||
(_, WeaponTargetingSF) -> (getAmmoLinks itm ++ [(AugmentedHUDSF, AugmentedHUDLink)], [])
|
(_, WeaponTargetingSF) -> (getAmmoLinks itm ++ [(AugmentedHUDSF, AugmentedHUDLink)], [])
|
||||||
|
(ATTACH BULLETSYNTH, _)
|
||||||
|
-> ([(AmmoMagSF ElectricalAmmo, AmmoInLink 0 ElectricalAmmo)],[])
|
||||||
_ -> ([], [])
|
_ -> ([], [])
|
||||||
where
|
where
|
||||||
itm = ci ^. cItem
|
itm = ci ^. cItem
|
||||||
@@ -78,10 +86,11 @@ getAmmoLinks itm =
|
|||||||
|
|
||||||
itemToFunction :: Item -> ItemStructuralFunction
|
itemToFunction :: Item -> ItemStructuralFunction
|
||||||
itemToFunction itm = case itm ^. itType of
|
itemToFunction itm = case itm ^. itType of
|
||||||
|
HELD LASER -> WeaponTargetingSF
|
||||||
HELD{} -> WeaponPlatformSF
|
HELD{} -> WeaponPlatformSF
|
||||||
AMMOMAG{} -> maybe UncomposableIsolateSF AmmoMagSF $ itm ^? itUse . amagType
|
AMMOMAG{} -> maybe UncomposableIsolateSF AmmoMagSF $ itm ^? itUse . amagType
|
||||||
ATTACH REMOTESCREEN -> RemoteScreenSF
|
ATTACH REMOTESCREEN -> RemoteScreenSF
|
||||||
ATTACH BULLETSYNTHESIZER -> AmmoModifierSF BulletAmmo
|
ATTACH BULLETSYNTH -> AmmoModifierSF BulletAmmo
|
||||||
ATTACH ZOOMSCOPE -> WeaponScopeSF
|
ATTACH ZOOMSCOPE -> WeaponScopeSF
|
||||||
ATTACH HOMINGMODULE -> AmmoTargetingSF ProjectileAmmo
|
ATTACH HOMINGMODULE -> AmmoTargetingSF ProjectileAmmo
|
||||||
ATTACH AUGMENTEDHUD -> AugmentedHUDSF
|
ATTACH AUGMENTEDHUD -> AugmentedHUDSF
|
||||||
@@ -89,8 +98,8 @@ itemToFunction itm = case itm ^. itType of
|
|||||||
BULLETMOD BulletModPayload{} -> AmmoPayloadSF BulletAmmo
|
BULLETMOD BulletModPayload{} -> AmmoPayloadSF BulletAmmo
|
||||||
BULLETMOD BulletModEffect{} -> AmmoEffectSF BulletAmmo
|
BULLETMOD BulletModEffect{} -> AmmoEffectSF BulletAmmo
|
||||||
TARGETING{} -> WeaponTargetingSF
|
TARGETING{} -> WeaponTargetingSF
|
||||||
LEFT {} -> EquipmentPlatformSF
|
LEFT{} -> EquipmentPlatformSF
|
||||||
EQUIP {} -> EquipmentPlatformSF
|
EQUIP{} -> EquipmentPlatformSF
|
||||||
_ -> UncomposableIsolateSF
|
_ -> UncomposableIsolateSF
|
||||||
|
|
||||||
pciToCI :: PartiallyComposedItem -> ComposedItem
|
pciToCI :: PartiallyComposedItem -> ComposedItem
|
||||||
@@ -98,8 +107,12 @@ pciToCI (x, y, _) = CItem x y
|
|||||||
|
|
||||||
basePCI :: Item -> PartiallyComposedItem
|
basePCI :: Item -> PartiallyComposedItem
|
||||||
basePCI itm = case _itType itm of
|
basePCI itm = case _itType itm of
|
||||||
HELD LASER -> (itm, WeaponTargetingSF, laserLinkTest itm)
|
_ -> (itm, itemToFunction itm, itemBaseConnections itm)
|
||||||
_ -> (itm, itemToFunction itm, uncurry useBreakL $ itemToBreakLists (CItem itm (itemToFunction itm)))
|
|
||||||
|
itemBaseConnections :: Item -> LinkTest
|
||||||
|
itemBaseConnections itm = case _itType itm of
|
||||||
|
HELD LASER -> laserLinkTest itm
|
||||||
|
_ -> uncurry useBreakL $ itemToBreakLists (CItem itm (itemToFunction itm))
|
||||||
|
|
||||||
laserLinkTest :: Item -> LinkTest
|
laserLinkTest :: Item -> LinkTest
|
||||||
laserLinkTest itm = LTest (llleft itm) (llright itm)
|
laserLinkTest itm = LTest (llleft itm) (llright itm)
|
||||||
@@ -171,7 +184,7 @@ joinItemsInList f xs = snd $ h (xs, [])
|
|||||||
-- this puts the first elements in the intmap at the end of the list
|
-- this puts the first elements in the intmap at the end of the list
|
||||||
invLDT :: IM.IntMap Item -> [LabelDoubleTree ItemLink PartiallyComposedItem]
|
invLDT :: IM.IntMap Item -> [LabelDoubleTree ItemLink PartiallyComposedItem]
|
||||||
invLDT =
|
invLDT =
|
||||||
joinItemsInList (leftRightCombine leftIsParentCombine rightIsParentCombine) . IM.elems
|
joinItemsInList tryAttachItems . IM.elems
|
||||||
. fmap (singleLDT . basePCI)
|
. fmap (singleLDT . basePCI)
|
||||||
|
|
||||||
-- this assumes the creature inventory is well formed, specifically the
|
-- this assumes the creature inventory is well formed, specifically the
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ itInvHeight :: Item -> Int
|
|||||||
itInvHeight x = case x ^. itType of
|
itInvHeight x = case x ^. itType of
|
||||||
HELD (MINIGUNX i) -> (i + 3) `div` 2
|
HELD (MINIGUNX i) -> (i + 3) `div` 2
|
||||||
HELD LAUNCHER -> 3
|
HELD LAUNCHER -> 3
|
||||||
|
HELD LAUNCHERX{} -> 3
|
||||||
HELD FLATSHIELD -> 3
|
HELD FLATSHIELD -> 3
|
||||||
HELD (BANGSTICK i) -> max 1 (i `div` 2)
|
HELD (BANGSTICK i) -> max 1 (i `div` 2)
|
||||||
_ -> 1
|
_ -> 1
|
||||||
@@ -27,7 +28,7 @@ itDim x = case x ^. itType of
|
|||||||
& dimCenter .~ V3 9 0 0
|
& dimCenter .~ V3 9 0 0
|
||||||
HELD y | hasCaneGunDim y -> did & dimRad .~ 8
|
HELD y | hasCaneGunDim y -> did & dimRad .~ 8
|
||||||
& dimCenter .~ V3 5 0 0
|
& dimCenter .~ V3 5 0 0
|
||||||
HELD (MINIGUNX {}) -> did & dimRad .~ 20
|
HELD MINIGUNX {} -> did & dimRad .~ 20
|
||||||
& dimCenter .~ V3 5 0 0
|
& dimCenter .~ V3 5 0 0
|
||||||
& dimAttachPos .~ V3 5 (-5) 0
|
& dimAttachPos .~ V3 5 (-5) 0
|
||||||
HELD LAUNCHER -> did & dimRad .~ 9
|
HELD LAUNCHER -> did & dimRad .~ 9
|
||||||
|
|||||||
Reference in New Issue
Block a user