Allow for equipment items to set a minimum view distance
This commit is contained in:
@@ -36,13 +36,13 @@ import qualified Data.Set as S
|
||||
import qualified SDL
|
||||
autoEffect :: (Item -> Creature -> World -> World) -> Int -> SoundID -> Item -> Creature -> World -> World
|
||||
autoEffect eff t sid itm cr w
|
||||
| _eparamInt (_eqParams (_itUse itm)) < 1 = eff itm cr w
|
||||
| _eparamInt (_eqParams (_eqEq $ _itUse itm)) < 1 = eff itm cr w
|
||||
& creatures . ix (_crID cr) . crInv . ix (fromJust $ _itInvPos itm)
|
||||
. itUse . eqParams . eparamInt .~ t
|
||||
. itUse . eqEq . eqParams . eparamInt .~ t
|
||||
& soundStart OnceSound (_crPos cr) sid Nothing
|
||||
| otherwise = w
|
||||
& creatures . ix (_crID cr) . crInv . ix (fromJust $ _itInvPos itm)
|
||||
. itUse . eqParams . eparamInt -~ 1
|
||||
. itUse . eqEq . eqParams . eparamInt -~ 1
|
||||
|
||||
{- | Automatically send out radar pulses that detect walls. -}
|
||||
autoRadarEffect :: Item -> Creature -> World -> World
|
||||
|
||||
@@ -47,9 +47,10 @@ autoDetector dt = defaultEquipment
|
||||
-- , _itEffect = autoRadarEffect
|
||||
, _itID = Nothing
|
||||
}
|
||||
& itUse . eqSite .~ GoesOnWrist
|
||||
& itUse . eqUse .~ autoEffect (detectorEffect dt) 100 click1S
|
||||
& itUse . eqParams .~ EquipCounter 0
|
||||
& itUse . eqEq . eqSite .~ GoesOnWrist
|
||||
& itUse . eqEq . eqUse .~ autoEffect (detectorEffect dt) 100 click1S
|
||||
& itUse . eqEq . eqParams .~ EquipCounter 0
|
||||
& itUse . eqEq . eqViewDist ?~ 350
|
||||
|
||||
detectorColor :: Detector -> Color
|
||||
detectorColor dt = case dt of
|
||||
|
||||
@@ -32,7 +32,7 @@ rewindGun = defaultGun
|
||||
, _itEffect = ItRewindEffect rewindEffect []
|
||||
, _itUse = defaultlUse
|
||||
& lUse .~ useRewindGun
|
||||
& eqSite .~ GoesOnChest
|
||||
& eqEq . eqSite .~ GoesOnChest
|
||||
}
|
||||
rewindEffect :: Item -> Creature -> World -> World
|
||||
rewindEffect itm cr w
|
||||
@@ -106,7 +106,7 @@ blinkGun = defaultGun
|
||||
, _itUse = defaultlUse
|
||||
& lUse .~ hammerCheckL (shootL $ const blinkAction)
|
||||
& useHammer .~ upHammer
|
||||
& eqSite .~ GoesOnWrist
|
||||
& eqEq . eqSite .~ GoesOnWrist
|
||||
-- , _itFloorPict = const . noPic . colorSH chartreuse $ upperPrismPoly 2 $ square 2
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@ unsafeBlinkGun = blinkGun
|
||||
& itName .~ "BLINKER-UNSAFE"
|
||||
& itType .~ BLINKERUNSAFE
|
||||
& itUse . lUse .~ hammerCheckL (shootL $ const unsafeBlinkAction)
|
||||
& itUse . eqEq . eqViewDist ?~ 400
|
||||
|
||||
effectGun :: String -> (Creature -> World -> World) -> Item
|
||||
effectGun name eff = defaultGun
|
||||
|
||||
Reference in New Issue
Block a user