Move AmmoType, going towards no need for Aeson

This commit is contained in:
2025-06-05 13:16:57 +01:00
parent cff32e50f3
commit 7f1b790688
17 changed files with 241 additions and 242 deletions
+7 -4
View File
@@ -7,6 +7,9 @@ module Dodge.Item.Grammar (
allInvLocs,
) where
import Dodge.Item.MagAmmoType
import Dodge.Data.AmmoType
import Dodge.Item.AmmoSlots
import Dodge.Data.TriggerType
import Dodge.BaseTriggerType
import Dodge.Data.AimStance
@@ -87,7 +90,7 @@ itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
, [(TriggerSF, TriggerLink), (WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
)
(_, AmmoMagSF{}) -> fromMaybe ([], []) $ do
atype <- itm ^? itConsumables . magType
atype <- magAmmoType itm
let screenanddet = case atype of
LauncherAmmo ->
[ (RemoteScreenSF, RemoteScreenLink)
@@ -138,7 +141,7 @@ getAmmoLinks :: Item -> [(ItemStructuralFunction, ComposeLinkType)]
getAmmoLinks itm =
map
(\(i, a) -> (AmmoMagSF a, AmmoInLink i a))
(IM.toList $ itm ^. itAmmoSlots)
(IM.toList $ itemAmmoSlots itm)
itemToFunction :: Item -> ItemStructuralFunction
itemToFunction itm = case itm ^. itType of
@@ -152,10 +155,10 @@ itemToFunction itm = case itm ^. itType of
--Just MustBeHeld -> UnloadedWeaponSF
_ -> GadgetPlatformSF
_
| Just amtype <- itm ^? itConsumables . magType
| Just amtype <- magAmmoType itm-- ^? itConsumables . magType
, Just _ <- itm ^? itLocation . ilEquipSite . _Just ->
AmmoMagSF amtype
AMMOMAG{} -> maybe NoSF AmmoMagSF $ itm ^? itConsumables . magType
AMMOMAG{} -> maybe NoSF AmmoMagSF $ magAmmoType itm -- ^? itConsumables . magType
ATTACH REMOTESCREEN -> RemoteScreenSF
ATTACH JOYSTICK -> JoystickSF
ATTACH REMOTEDETONATOR -> RemoteDetonatorSF