Allow a spring and hardware to make weapons automatic
This commit is contained in:
@@ -56,10 +56,11 @@ itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
|
||||
(_, HeldPlatformSF) ->
|
||||
( getAmmoLinks itm
|
||||
, [(WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
|
||||
<> getAutoSpringLinks itm
|
||||
)
|
||||
(_, GadgetPlatformSF) ->
|
||||
( getAmmoLinks itm
|
||||
, [(TriggerSF,TriggerLink),(WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
|
||||
, [(TriggerSF, TriggerLink), (WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
|
||||
)
|
||||
(_, AmmoMagSF{}) -> fromMaybe ([], []) $ do
|
||||
atype <- itm ^? itConsumables . magType
|
||||
@@ -78,6 +79,11 @@ itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
|
||||
([(AmmoMagSF ElectricalAmmo, AmmoInLink 0 ElectricalAmmo)], [])
|
||||
_ -> ([], [])
|
||||
|
||||
getAutoSpringLinks :: Item -> [(ItemStructuralFunction, ComposeLinkType)]
|
||||
getAutoSpringLinks itm = case itm ^? itUse . heldTriggerType of
|
||||
Just HammerTrigger -> [(MakeAutoSF, MakeAutoLink)]
|
||||
_ -> []
|
||||
|
||||
getAmmoLinks :: Item -> [(ItemStructuralFunction, ComposeLinkType)]
|
||||
getAmmoLinks itm =
|
||||
map
|
||||
@@ -90,9 +96,10 @@ itemToFunction itm = case itm ^. itType of
|
||||
HELD{} -> case itm ^? itUseCondition of
|
||||
Just MustBeHeld -> HeldPlatformSF
|
||||
_ -> GadgetPlatformSF
|
||||
_ | Just amtype <- itm ^? itConsumables . magType
|
||||
, Just _ <- itm ^? itLocation . ilEquipSite . _Just
|
||||
-> AmmoMagSF amtype
|
||||
_
|
||||
| Just amtype <- itm ^? itConsumables . magType
|
||||
, Just _ <- itm ^? itLocation . ilEquipSite . _Just ->
|
||||
AmmoMagSF amtype
|
||||
AMMOMAG{} -> maybe UncomposableIsolateSF AmmoMagSF $ itm ^? itConsumables . magType
|
||||
ATTACH REMOTESCREEN -> RemoteScreenSF
|
||||
ATTACH BULLETSYNTH -> AmmoModifierSF BulletAmmo
|
||||
@@ -114,6 +121,7 @@ basePCI itm = case _itType itm of
|
||||
itemBaseConnections :: Item -> LinkTest
|
||||
itemBaseConnections itm = case _itType itm of
|
||||
HELD LASER -> laserLinkTest itm
|
||||
CRAFT SPRING -> springLinkTest itm
|
||||
_ -> uncurry useBreakL $ itemToBreakLists itm (itemToFunction itm)
|
||||
|
||||
laserLinkTest :: Item -> LinkTest
|
||||
@@ -137,6 +145,18 @@ toLasgunUpdate itm =
|
||||
(\(par, _, _) -> (par, HeldPlatformSF, uncurry useBreakL $ itemToBreakLists itm HeldPlatformSF))
|
||||
(\(chi, _, up) -> (chi, FunctionChangeSF, up))
|
||||
|
||||
springLinkTest :: Item -> LinkTest
|
||||
springLinkTest itm = LTest (const Nothing) $
|
||||
\ci -> case ci ^. _1 . itType of
|
||||
CRAFT HARDWARE ->
|
||||
Just
|
||||
( LUpdate
|
||||
(ILink FunctionChangeLink orientAttachment)
|
||||
(\(par, _, up) -> (par, MakeAutoSF, up))
|
||||
(\(chi, _, up) -> (chi, FunctionChangeSF, up))
|
||||
)
|
||||
_ -> Nothing
|
||||
|
||||
--itemLinkTestLeft :: Item -> PartiallyComposedItem -> Maybe LinkUpdate
|
||||
--itemLinkTestLeft itm = _tryLeftLink $
|
||||
-- uncurry useBreakL $ itemToBreakLists itm
|
||||
|
||||
@@ -9,6 +9,7 @@ import Dodge.Data.ComposedItem
|
||||
itemInvColor :: ComposedItem -> Color
|
||||
itemInvColor ci = case ci ^. _2 of
|
||||
HeldPlatformSF -> white
|
||||
MakeAutoSF -> white
|
||||
EquipmentPlatformSF -> yellow
|
||||
GadgetPlatformSF -> white
|
||||
TriggerSF -> yellow
|
||||
|
||||
Reference in New Issue
Block a user