c4e8046332
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.
46 lines
1.4 KiB
Haskell
46 lines
1.4 KiB
Haskell
module Dodge.Item.Held.Utility where
|
|
|
|
import Linear
|
|
import Dodge.Default.Item
|
|
import Control.Lens
|
|
import Dodge.Data.Item
|
|
--import Geometry.Data
|
|
|
|
flatShield :: Item
|
|
flatShield =
|
|
defaultHeldItem
|
|
& itEffect . ieInv .~ EffectRootNotroot CreateShieldWall RemoveShieldWall
|
|
& itUse . heldAim . aimWeight .~ 5
|
|
& itUse . heldAim . aimTurnSpeed .~ 0.5
|
|
& itUse . heldAim . aimStance .~ TwoHandFlat
|
|
-- & itUse . heldAim . aimHandlePos .~ 0
|
|
& itType .~ HELD FLATSHIELD
|
|
|
|
keyCard :: Int -> Item
|
|
keyCard n = defaultHeldItem & itType .~ HELD (KEYCARD n)
|
|
|
|
latchkey :: Int -> Item
|
|
latchkey _ = defaultHeldItem
|
|
|
|
torch :: Item
|
|
torch =
|
|
defaultHeldItem
|
|
& itType .~ HELD TORCH
|
|
& itUse . heldAim . aimMuzzles . ix 0 . mzPos . _x .~ 10
|
|
& itAmmoSlots .~ singleAmmo ElectricalAmmo
|
|
|
|
{- |
|
|
Sends out pulses that display walls.
|
|
-}
|
|
clickDetector :: Detector -> Item
|
|
clickDetector dt =
|
|
defaultHeldItem
|
|
& 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
|