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:
@@ -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
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ volleyGun i =
|
||||
<*> ZipList [0..i-1]
|
||||
<*> pure PistolFlare
|
||||
<*> pure MuzzleShootBullet
|
||||
<*> pure (UseExactly 1)
|
||||
)
|
||||
& itUse . heldParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i
|
||||
& itUse . heldParams . recoil .~ 20 + 10 * fromIntegral i
|
||||
@@ -88,7 +89,8 @@ miniGunX i =
|
||||
& itUse . heldParams . bulGunSound ?~ (mini1S,2)
|
||||
& itUse . heldAim . aimTurnSpeed .~ 0.5
|
||||
& itUse . heldAim . aimMuzzles
|
||||
.~ replicate i (Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet)
|
||||
.~ replicate i
|
||||
(Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet (UseExactly 1))
|
||||
& itUse . heldParams . recoil .~ 10 * fromIntegral i
|
||||
& itUse . heldParams . torqueAfter .~ 0.04 + 0.02 * fromIntegral i
|
||||
& itUse . heldParams . sidePush .~ 10 * fromIntegral i
|
||||
|
||||
@@ -13,7 +13,8 @@ bangCone =
|
||||
defaultBulletWeapon
|
||||
& itUse . heldDelay . rateMax .~ 20
|
||||
& itUse . heldAim . aimMuzzles
|
||||
.~ replicate 15 (Muzzle (V2 15 0) 0 0.5 0 DefaultFlareType MuzzleShootBullet)
|
||||
.~ replicate 15
|
||||
(Muzzle (V2 15 0) 0 0.5 0 DefaultFlareType MuzzleShootBullet (UseExactly 1))
|
||||
& itUse . heldParams . muzVel .~ UniRandFloat 0.5 0.8
|
||||
& itUse . heldParams . rifling .~ UniRandFloat 0.3 0.8
|
||||
& itUse . heldParams . recoil .~ 150
|
||||
|
||||
@@ -35,6 +35,7 @@ launcherX i =
|
||||
<*> ZipList [0..]
|
||||
<*> pure DefaultFlareType
|
||||
<*> pure MuzzleLauncher
|
||||
<*> pure (UseExactly 1)
|
||||
)
|
||||
& itAmmoSlots .~ IM.fromList [(j,LauncherAmmo) | j <- [0..i-1]]
|
||||
where
|
||||
|
||||
@@ -84,6 +84,7 @@ flameThrower =
|
||||
, _nzWalkSpeed = 0.01
|
||||
, _nzCurrentWalkAngle = 0
|
||||
}
|
||||
(UseExactly 1)
|
||||
]
|
||||
& itAmmoSlots .~ singleAmmo GasAmmo
|
||||
& itType .~ HELD FLAMETHROWER
|
||||
|
||||
@@ -22,7 +22,8 @@ bangStick i =
|
||||
& itType .~ HELD (BANGSTICK i)
|
||||
& itUse . heldDelay . rateMax .~ 8
|
||||
& itUse . heldAim . aimMuzzles
|
||||
.~ [Muzzle (V2 10 0) a 0.01 0 DefaultFlareType MuzzleShootBullet | a <- spreadAroundCenter i baseStickSpread]
|
||||
.~ [Muzzle (V2 10 0) a 0.01 0 DefaultFlareType MuzzleShootBullet (UseExactly 1)
|
||||
| a <- spreadAroundCenter i baseStickSpread]
|
||||
|
||||
baseStickSpread :: Float
|
||||
baseStickSpread = 0.2
|
||||
|
||||
@@ -38,5 +38,8 @@ clickDetector dt =
|
||||
& itUse . heldDelay . rateMax .~ 20
|
||||
& itUse . heldAim . aimRange .~ 1
|
||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1}
|
||||
& itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
& itUse . heldParams .~ DefaultHeldParams
|
||||
& itType .~ HELD (DETECTOR dt)
|
||||
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleDetector
|
||||
& itUse . heldAim . aimMuzzles . ix 0 . mzAmmoPerShot .~ UseExactly 100
|
||||
|
||||
@@ -12,7 +12,8 @@ itemInvColor :: ComposedItem -> Color
|
||||
itemInvColor ci = case ci ^. _2 of
|
||||
HeldPlatformSF -> white
|
||||
EquipmentPlatformSF -> yellow
|
||||
GadgetPlatformSF -> blue
|
||||
GadgetPlatformSF -> white
|
||||
TriggerSF -> yellow
|
||||
WeaponScopeSF -> chartreuse
|
||||
WeaponTargetingSF -> green
|
||||
AugmentedHUDSF -> rose
|
||||
|
||||
Reference in New Issue
Block a user