Improve click detectors

Introduce "gadgets" as a structural function, for items that can be used
when held and when not held. Click detectors are such an item. Make
click detectors correctly attach and use up batteries when used.
This commit is contained in:
2024-12-18 13:34:05 +00:00
parent 4d6d255893
commit c4e8046332
17 changed files with 119 additions and 79 deletions
+6
View File
@@ -57,6 +57,10 @@ itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
( getAmmoLinks itm
, [(WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
)
(_, GadgetPlatformSF) ->
( getAmmoLinks itm
, [(TriggerSF,TriggerLink),(WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
)
(_, AmmoMagSF{}) -> fromMaybe ([], []) $ do
atype <- itm ^? itUse . amagType
return
@@ -82,6 +86,7 @@ getAmmoLinks itm =
itemToFunction :: Item -> ItemStructuralFunction
itemToFunction itm = case itm ^. itType of
HELD DETECTOR{} -> GadgetPlatformSF
HELD LASER -> WeaponTargetingSF
HELD{} -> HeldPlatformSF
AMMOMAG{} -> maybe UncomposableIsolateSF AmmoMagSF $ itm ^? itUse . amagType
@@ -95,6 +100,7 @@ itemToFunction itm = case itm ^. itType of
BULLETMOD BulletModEffect{} -> AmmoEffectSF BulletAmmo
TARGETING{} -> WeaponTargetingSF
LEFT{} -> EquipmentPlatformSF
EQUIP WRIST_ECG -> TriggerSF
EQUIP{} -> EquipmentPlatformSF
_ -> UncomposableIsolateSF