Allow for equipment items to set a minimum view distance
This commit is contained in:
@@ -73,8 +73,8 @@ toggleEquipmentAt rbops invid cr w = case rbops ^? opAllocateEquipment of
|
|||||||
crpoint = creatures . ix (_crID cr)
|
crpoint = creatures . ix (_crID cr)
|
||||||
itmat i = _crInv cr IM.! i
|
itmat i = _crInv cr IM.! i
|
||||||
itm = itmat (_crInvSel cr)
|
itm = itmat (_crInvSel cr)
|
||||||
onequip itm' = (_eqOnEquip . _itUse) itm' itm'
|
onequip itm' = (_eqOnEquip . _eqEq . _itUse) itm' itm'
|
||||||
onremove itm' = (_eqOnRemove . _itUse) itm' itm'
|
onremove itm' = (_eqOnRemove . _eqEq . _itUse) itm' itm'
|
||||||
|
|
||||||
useLeftItem :: Int -> World -> World
|
useLeftItem :: Int -> World -> World
|
||||||
useLeftItem cid w
|
useLeftItem cid w
|
||||||
@@ -88,7 +88,7 @@ useLeftItem cid w
|
|||||||
where
|
where
|
||||||
cr = _creatures w IM.! cid
|
cr = _creatures w IM.! cid
|
||||||
itmShouldBeUsed = isJust (cr ^? crInv . ix (_crInvSel cr) . itUse . cUse)
|
itmShouldBeUsed = isJust (cr ^? crInv . ix (_crInvSel cr) . itUse . cUse)
|
||||||
|| ( isJust (cr ^? crInv . ix (_crInvSel cr) . itUse . eqUse)
|
|| ( isJust (cr ^? crInv . ix (_crInvSel cr) . itUse . eqEq . eqUse)
|
||||||
&& _crLeftInvSel cr /= Just (_crInvSel cr)
|
&& _crLeftInvSel cr /= Just (_crInvSel cr)
|
||||||
)
|
)
|
||||||
-- TODO determine itmShouldBeUsed with reference to config options
|
-- TODO determine itmShouldBeUsed with reference to config options
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ useUpdate = (useHammer . hammerPosition %~ moveHammerUp)
|
|||||||
. (useDelay . rateTime %~ decreaseToZero)
|
. (useDelay . rateTime %~ decreaseToZero)
|
||||||
|
|
||||||
useEquipment :: Creature -> Int -> World -> World
|
useEquipment :: Creature -> Int -> World -> World
|
||||||
useEquipment cr i = _eqUse (_itUse itm) itm cr
|
useEquipment cr i = _eqUse (_eqEq $ _itUse itm) itm cr
|
||||||
where
|
where
|
||||||
itm = _crInv cr IM.! i
|
itm = _crInv cr IM.! i
|
||||||
-- a map updating all inventory items
|
-- a map updating all inventory items
|
||||||
|
|||||||
@@ -54,9 +54,7 @@ wasdWithAiming w speed cr
|
|||||||
isReloading = _posture (_crStance cr) == Reloading
|
isReloading = _posture (_crStance cr) == Reloading
|
||||||
mouseDir = case cr ^? crInv . ix (_crInvSel cr) . itScope . scopePos of
|
mouseDir = case cr ^? crInv . ix (_crInvSel cr) . itScope . scopePos of
|
||||||
Just _ -> argV $ mouseWorldPos w -.- _crPos cr
|
Just _ -> argV $ mouseWorldPos w -.- _crPos cr
|
||||||
-- Just p -> normalizeAngle $ argV
|
_ -> argV (_mousePos w) + _cameraRot w
|
||||||
-- $ p +.+ 2 / _cameraZoom w *.* rotateV (_cameraRot w) (_mousePos w)
|
|
||||||
_ -> normalizeAngle $ argV (_mousePos w) + _cameraRot w
|
|
||||||
|
|
||||||
wasdM :: SDL.Scancode -> Point2
|
wasdM :: SDL.Scancode -> Point2
|
||||||
wasdM scancode = case scancode of
|
wasdM scancode = case scancode of
|
||||||
|
|||||||
+13
-11
@@ -459,23 +459,24 @@ data ItemUse
|
|||||||
{ _lUse :: Item -> Creature -> World -> World
|
{ _lUse :: Item -> Creature -> World -> World
|
||||||
, _useDelay :: UseDelay
|
, _useDelay :: UseDelay
|
||||||
, _useHammer :: HammerType
|
, _useHammer :: HammerType
|
||||||
, _eqSite :: EquipSite
|
, _eqEq :: Equipment
|
||||||
, _eqUse :: Item -> Creature -> World -> World
|
|
||||||
, _eqOnEquip :: Item -> Creature -> World -> World
|
|
||||||
, _eqOnRemove :: Item -> Creature -> World -> World
|
|
||||||
, _eqParams :: EquipParams
|
|
||||||
}
|
}
|
||||||
| ConsumeUse
|
| ConsumeUse
|
||||||
{ _cUse :: Item -> Creature -> World -> World
|
{ _cUse :: Item -> Creature -> World -> World
|
||||||
}
|
}
|
||||||
| EquipUse
|
| EquipUse
|
||||||
{ _eqUse :: Item -> Creature -> World -> World
|
{ _eqEq :: Equipment
|
||||||
, _eqOnEquip :: Item -> Creature -> World -> World
|
|
||||||
, _eqOnRemove :: Item -> Creature -> World -> World
|
|
||||||
, _eqSite :: EquipSite
|
|
||||||
, _eqParams :: EquipParams
|
|
||||||
}
|
}
|
||||||
| NoUse
|
| NoUse
|
||||||
|
data Equipment = Equipment
|
||||||
|
{ _eqUse :: Item -> Creature -> World -> World
|
||||||
|
, _eqOnEquip :: Item -> Creature -> World -> World
|
||||||
|
, _eqOnRemove :: Item -> Creature -> World -> World
|
||||||
|
, _eqSite :: EquipSite
|
||||||
|
, _eqParams :: EquipParams
|
||||||
|
, _eqViewDist :: Maybe Float
|
||||||
|
}
|
||||||
|
|
||||||
_itUseAimStance :: Item -> AimStance
|
_itUseAimStance :: Item -> AimStance
|
||||||
_itUseAimStance = _aimStance . _useAim . _itUse
|
_itUseAimStance = _aimStance . _useAim . _itUse
|
||||||
data ItemConsumption
|
data ItemConsumption
|
||||||
@@ -1587,6 +1588,7 @@ makeLenses ''SubInventory
|
|||||||
makeLenses ''TerminalParams
|
makeLenses ''TerminalParams
|
||||||
makeLenses ''TerminalLine
|
makeLenses ''TerminalLine
|
||||||
makeLenses ''ItemValue
|
makeLenses ''ItemValue
|
||||||
|
makeLenses ''Equipment
|
||||||
makeLenses ''ScreenLayer
|
makeLenses ''ScreenLayer
|
||||||
makeLenses ''Sensor
|
makeLenses ''Sensor
|
||||||
makeLenses ''Beam
|
makeLenses ''Beam
|
||||||
|
|||||||
@@ -164,13 +164,7 @@ defaultEquipment = Item
|
|||||||
, _itInvPos = Nothing
|
, _itInvPos = Nothing
|
||||||
, _itDimension = defItDimCol yellow
|
, _itDimension = defItDimCol yellow
|
||||||
, _itConsumption = NoConsumption
|
, _itConsumption = NoConsumption
|
||||||
, _itUse = EquipUse
|
, _itUse = EquipUse defaultEquip
|
||||||
{_eqUse = \_ _ -> id
|
|
||||||
,_eqOnEquip = \_ _ -> id
|
|
||||||
,_eqOnRemove = \_ _ -> id
|
|
||||||
,_eqSite = GoesOnSpecial
|
|
||||||
,_eqParams = NoEquipParams
|
|
||||||
}
|
|
||||||
, _itAttachment = NoItAttachment
|
, _itAttachment = NoItAttachment
|
||||||
, _itParams = NoParams
|
, _itParams = NoParams
|
||||||
, _itTweaks = NoTweaks
|
, _itTweaks = NoTweaks
|
||||||
|
|||||||
@@ -68,11 +68,16 @@ defaultlUse = LeftUse
|
|||||||
{ _lUse = \_ _ -> id
|
{ _lUse = \_ _ -> id
|
||||||
, _useDelay = FixedRate {_rateMax = 8, _rateTime = 0}
|
, _useDelay = FixedRate {_rateMax = 8, _rateTime = 0}
|
||||||
, _useHammer = NoHammer
|
, _useHammer = NoHammer
|
||||||
, _eqSite = GoesOnSpecial
|
, _eqEq = defaultEquip
|
||||||
|
}
|
||||||
|
defaultEquip :: Equipment
|
||||||
|
defaultEquip = Equipment
|
||||||
|
{ _eqSite = GoesOnSpecial
|
||||||
, _eqUse = \_ _ -> id
|
, _eqUse = \_ _ -> id
|
||||||
, _eqOnEquip = \_ _ -> id
|
, _eqOnEquip = \_ _ -> id
|
||||||
, _eqOnRemove = \_ _ -> id
|
, _eqOnRemove = \_ _ -> id
|
||||||
, _eqParams = NoEquipParams
|
, _eqParams = NoEquipParams
|
||||||
|
, _eqViewDist = Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
luseInstantNoH :: (Item -> Creature -> World -> World) -> ItemUse
|
luseInstantNoH :: (Item -> Creature -> World -> World) -> ItemUse
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
module Dodge.Equipment where
|
||||||
|
import Dodge.Data
|
||||||
|
|
||||||
|
import qualified Data.IntMap.Strict as IM
|
||||||
|
import Data.IntMap.Merge.Strict
|
||||||
|
|
||||||
|
getCrEquipment :: Creature -> IM.IntMap Item
|
||||||
|
getCrEquipment cr = merge dropMissing dropMissing (zipWithMatched $ \_ _ -> id)
|
||||||
|
(_crInvEquipped cr) (_crInv cr)
|
||||||
@@ -67,7 +67,7 @@ rmInvItem cid invid w = case w ^? creatures . ix cid . crInv . ix invid . itCons
|
|||||||
cr = _creatures w IM.! cid
|
cr = _creatures w IM.! cid
|
||||||
itm = _crInv cr IM.! invid
|
itm = _crInv cr IM.! invid
|
||||||
dounequipfunction = fromMaybe id $ do
|
dounequipfunction = fromMaybe id $ do
|
||||||
rmf <- itm ^? itUse . eqOnRemove
|
rmf <- itm ^? itUse . eqEq . eqOnRemove
|
||||||
return $ rmf itm cr
|
return $ rmf itm cr
|
||||||
doanyitemeffect = fromMaybe id $ do
|
doanyitemeffect = fromMaybe id $ do
|
||||||
rmf <- itm ^? itEffect . itEffectDrop
|
rmf <- itm ^? itEffect . itEffectDrop
|
||||||
@@ -196,7 +196,7 @@ updateRBList :: World -> World
|
|||||||
updateRBList w
|
updateRBList w
|
||||||
| w ^? rbOptions . opCurInvPos == Just curinvid
|
| w ^? rbOptions . opCurInvPos == Just curinvid
|
||||||
= w & setEquipAllocation & setEquipActivation
|
= w & setEquipAllocation & setEquipActivation
|
||||||
| otherwise = case cr ^? crInv . ix curinvid . itUse . eqSite of
|
| otherwise = case cr ^? crInv . ix curinvid . itUse . eqEq . eqSite of
|
||||||
Just esite -> w
|
Just esite -> w
|
||||||
& rbOptions .~ EquipOptions (equipSiteToPositions esite)
|
& rbOptions .~ EquipOptions (equipSiteToPositions esite)
|
||||||
(chooseEquipmentPosition cr (equipSiteToPositions esite))
|
(chooseEquipmentPosition cr (equipSiteToPositions esite))
|
||||||
|
|||||||
+23
-23
@@ -27,8 +27,8 @@ magShield = defaultEquipment
|
|||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
, _itAttachment = ItMInt Nothing
|
, _itAttachment = ItMInt Nothing
|
||||||
}
|
}
|
||||||
& itUse . eqUse .~ useMagShield
|
& itUse . eqEq . eqUse .~ useMagShield
|
||||||
& itUse . eqSite .~ GoesOnWrist
|
& itUse . eqEq . eqSite .~ GoesOnWrist
|
||||||
useMagShield :: Item -> Creature -> World -> World
|
useMagShield :: Item -> Creature -> World -> World
|
||||||
useMagShield it cr w = w & magnets . at mgid ?~ themagnet
|
useMagShield it cr w = w & magnets . at mgid ?~ themagnet
|
||||||
where
|
where
|
||||||
@@ -49,7 +49,7 @@ flameShield = defaultEquipment
|
|||||||
, _itName = "FLAMESHIELD"
|
, _itName = "FLAMESHIELD"
|
||||||
, _itEquipPict = \cr _ -> (,) emptySH $ setDepth 20 $ pictures [color cyan $ circle (_crRad cr+2)]
|
, _itEquipPict = \cr _ -> (,) emptySH $ setDepth 20 $ pictures [color cyan $ circle (_crRad cr+2)]
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
} & itUse . eqSite .~ GoesOnChest
|
} & itUse . eqEq . eqSite .~ GoesOnChest
|
||||||
{- | Slows you down, blocks forward projectiles. -}
|
{- | Slows you down, blocks forward projectiles. -}
|
||||||
frontArmour :: Item
|
frontArmour :: Item
|
||||||
frontArmour = defaultEquipment
|
frontArmour = defaultEquipment
|
||||||
@@ -61,7 +61,7 @@ frontArmour = defaultEquipment
|
|||||||
])
|
])
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
}
|
}
|
||||||
& itUse . eqSite .~ GoesOnChest
|
& itUse . eqEq . eqSite .~ GoesOnChest
|
||||||
where
|
where
|
||||||
thecol = yellow -- (greyN 0.1)
|
thecol = yellow -- (greyN 0.1)
|
||||||
|
|
||||||
@@ -72,32 +72,32 @@ wristArmour = defaultEquipment
|
|||||||
, _itEquipPict = spicForWrist mempty
|
, _itEquipPict = spicForWrist mempty
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
}
|
}
|
||||||
& itUse . eqSite .~ GoesOnWrist
|
& itUse . eqEq . eqSite .~ GoesOnWrist
|
||||||
& itUse . eqOnEquip .~ onEquipWristShield
|
& itUse . eqEq . eqOnEquip .~ onEquipWristShield
|
||||||
& itUse . eqUse .~ setWristShieldPos
|
& itUse . eqEq . eqUse .~ setWristShieldPos
|
||||||
& itUse . eqOnRemove .~ onRemoveWristShield
|
& itUse . eqEq . eqOnRemove .~ onRemoveWristShield
|
||||||
|
|
||||||
onEquipWristShield :: Item -> Creature -> World -> World
|
onEquipWristShield :: Item -> Creature -> World -> World
|
||||||
onEquipWristShield itm cr w = w
|
onEquipWristShield itm cr w = w
|
||||||
& creatures . ix (_crID cr) . crInv . ix (fromJust (_itInvPos itm)) . itUse . eqParams .~ EquipID i
|
& creatures . ix (_crID cr) . crInv . ix (fromJust (_itInvPos itm)) . itUse . eqEq . eqParams .~ EquipID i
|
||||||
& walls . at i ?~ (shieldWall (_crID cr)) {_wlDraw = True,_wlID = i}
|
& walls . at i ?~ (shieldWall (_crID cr)) {_wlDraw = True,_wlID = i}
|
||||||
& setWristShieldPos (itm & itUse . eqParams .~ EquipID i) cr
|
& setWristShieldPos (itm & itUse . eqEq . eqParams .~ EquipID i) cr
|
||||||
where
|
where
|
||||||
i = IM.newKey (_walls w)
|
i = IM.newKey (_walls w)
|
||||||
|
|
||||||
onRemoveWristShield :: Item -> Creature -> World -> World
|
onRemoveWristShield :: Item -> Creature -> World -> World
|
||||||
onRemoveWristShield itm cr w = w
|
onRemoveWristShield itm cr w = w
|
||||||
& creatures . ix (_crID cr) . crInv . ix (fromJust (_itInvPos itm)) . itUse . eqParams .~ NoEquipParams
|
& creatures . ix (_crID cr) . crInv . ix (fromJust (_itInvPos itm)) . itUse . eqEq . eqParams .~ NoEquipParams
|
||||||
& deleteWallID i
|
& deleteWallID i
|
||||||
where
|
where
|
||||||
i = _eparamID $ _eqParams $ _itUse itm
|
i = _eparamID $ _eqParams $ _eqEq $ _itUse itm
|
||||||
setWristShieldPos :: Item -> Creature -> World -> World
|
setWristShieldPos :: Item -> Creature -> World -> World
|
||||||
setWristShieldPos itm cr w = w
|
setWristShieldPos itm cr w = w
|
||||||
& moveWallIDUnsafe i wlline
|
& moveWallIDUnsafe i wlline
|
||||||
-- & testString .~ (\w' -> [shortShow $ _wlLine (_walls w' IM.! i)])
|
-- & testString .~ (\w' -> [shortShow $ _wlLine (_walls w' IM.! i)])
|
||||||
-- & tempLightSources .:~ tlsTimeRadColPos 1 200 0.7 (fst wlline `v2z` 40)
|
-- & tempLightSources .:~ tlsTimeRadColPos 1 200 0.7 (fst wlline `v2z` 40)
|
||||||
where
|
where
|
||||||
i = _eparamID $ _eqParams $ _itUse itm
|
i = _eparamID $ _eqParams $ _eqEq $ _itUse itm
|
||||||
wlline = (f (V3 (-10) 7 0), f (V3 10 7 0))
|
wlline = (f (V3 (-10) 7 0), f (V3 10 7 0))
|
||||||
invid = fromJust (_itInvPos itm)
|
invid = fromJust (_itInvPos itm)
|
||||||
--wlline = (V2 10 0, V2 (-10) 100)
|
--wlline = (V2 10 0, V2 (-10) 100)
|
||||||
@@ -222,7 +222,7 @@ jetPack = defaultEquipment
|
|||||||
$ pictures [color yellow $ polygon $ rectNSEW 5 (-5) (-3) (-11) ]
|
$ pictures [color yellow $ polygon $ rectNSEW 5 (-5) (-3) (-11) ]
|
||||||
, _itEffect = NoItEffect
|
, _itEffect = NoItEffect
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
} & itUse . eqSite .~ GoesOnBack
|
} & itUse . eqEq . eqSite .~ GoesOnBack
|
||||||
|
|
||||||
brainHat :: Item
|
brainHat :: Item
|
||||||
brainHat = defaultEquipment
|
brainHat = defaultEquipment
|
||||||
@@ -232,7 +232,7 @@ brainHat = defaultEquipment
|
|||||||
, _itEffect = NoItEffect
|
, _itEffect = NoItEffect
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
}
|
}
|
||||||
& itUse . eqSite .~ GoesOnHead
|
& itUse . eqEq . eqSite .~ GoesOnHead
|
||||||
|
|
||||||
headLamp1 :: Item
|
headLamp1 :: Item
|
||||||
headLamp1 = defaultEquipment
|
headLamp1 = defaultEquipment
|
||||||
@@ -246,8 +246,8 @@ headLamp1 = defaultEquipment
|
|||||||
, _itEffect = NoItEffect
|
, _itEffect = NoItEffect
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
}
|
}
|
||||||
& itUse . eqUse .~ createHeadLamp
|
& itUse . eqEq . eqUse .~ createHeadLamp
|
||||||
& itUse . eqSite .~ GoesOnHead
|
& itUse . eqEq . eqSite .~ GoesOnHead
|
||||||
headLamp :: Item
|
headLamp :: Item
|
||||||
headLamp = defaultEquipment
|
headLamp = defaultEquipment
|
||||||
{ _itType = HEADLAMP
|
{ _itType = HEADLAMP
|
||||||
@@ -256,8 +256,8 @@ headLamp = defaultEquipment
|
|||||||
, _itEffect = NoItEffect
|
, _itEffect = NoItEffect
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
}
|
}
|
||||||
& itUse . eqUse .~ createHeadLamp
|
& itUse . eqEq . eqUse .~ createHeadLamp
|
||||||
& itUse . eqSite .~ GoesOnHead
|
& itUse . eqEq . eqSite .~ GoesOnHead
|
||||||
|
|
||||||
headLampShape :: Shape
|
headLampShape :: Shape
|
||||||
headLampShape = colorSH yellow $
|
headLampShape = colorSH yellow $
|
||||||
@@ -278,7 +278,7 @@ powerLegs = defaultEquipment
|
|||||||
, _itEffect = NoItEffect
|
, _itEffect = NoItEffect
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
}
|
}
|
||||||
& itUse . eqSite .~ GoesOnLegs
|
& itUse . eqEq . eqSite .~ GoesOnLegs
|
||||||
speedLegs :: Item
|
speedLegs :: Item
|
||||||
speedLegs = powerLegs
|
speedLegs = powerLegs
|
||||||
{ _itType = SPEEDLEGS
|
{ _itType = SPEEDLEGS
|
||||||
@@ -297,9 +297,9 @@ wristInvisibility = defaultEquipment
|
|||||||
, _itEquipPict = shapeForWrist (colorSH chartreuse $ upperPrismPoly 3 $ rectWH 2 2)
|
, _itEquipPict = shapeForWrist (colorSH chartreuse $ upperPrismPoly 3 $ rectWH 2 2)
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
}
|
}
|
||||||
& itUse . eqSite .~ GoesOnWrist
|
& itUse . eqEq . eqSite .~ GoesOnWrist
|
||||||
& itUse . eqOnEquip .~ overCID (crCamouflage .~ Invisible)
|
& itUse . eqEq . eqOnEquip .~ overCID (crCamouflage .~ Invisible)
|
||||||
& itUse . eqOnRemove .~ overCID (crCamouflage .~ FullyVisible)
|
& itUse . eqEq . eqOnRemove .~ overCID (crCamouflage .~ FullyVisible)
|
||||||
|
|
||||||
overCID :: (Creature -> Creature) -> Item -> Creature -> World -> World
|
overCID :: (Creature -> Creature) -> Item -> Creature -> World -> World
|
||||||
overCID f _ cr = creatures . ix (_crID cr) %~ f
|
overCID f _ cr = creatures . ix (_crID cr) %~ f
|
||||||
|
|||||||
@@ -36,13 +36,13 @@ import qualified Data.Set as S
|
|||||||
import qualified SDL
|
import qualified SDL
|
||||||
autoEffect :: (Item -> Creature -> World -> World) -> Int -> SoundID -> Item -> Creature -> World -> World
|
autoEffect :: (Item -> Creature -> World -> World) -> Int -> SoundID -> Item -> Creature -> World -> World
|
||||||
autoEffect eff t sid itm cr w
|
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)
|
& creatures . ix (_crID cr) . crInv . ix (fromJust $ _itInvPos itm)
|
||||||
. itUse . eqParams . eparamInt .~ t
|
. itUse . eqEq . eqParams . eparamInt .~ t
|
||||||
& soundStart OnceSound (_crPos cr) sid Nothing
|
& soundStart OnceSound (_crPos cr) sid Nothing
|
||||||
| otherwise = w
|
| otherwise = w
|
||||||
& creatures . ix (_crID cr) . crInv . ix (fromJust $ _itInvPos itm)
|
& 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. -}
|
{- | Automatically send out radar pulses that detect walls. -}
|
||||||
autoRadarEffect :: Item -> Creature -> World -> World
|
autoRadarEffect :: Item -> Creature -> World -> World
|
||||||
|
|||||||
@@ -47,9 +47,10 @@ autoDetector dt = defaultEquipment
|
|||||||
-- , _itEffect = autoRadarEffect
|
-- , _itEffect = autoRadarEffect
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
}
|
}
|
||||||
& itUse . eqSite .~ GoesOnWrist
|
& itUse . eqEq . eqSite .~ GoesOnWrist
|
||||||
& itUse . eqUse .~ autoEffect (detectorEffect dt) 100 click1S
|
& itUse . eqEq . eqUse .~ autoEffect (detectorEffect dt) 100 click1S
|
||||||
& itUse . eqParams .~ EquipCounter 0
|
& itUse . eqEq . eqParams .~ EquipCounter 0
|
||||||
|
& itUse . eqEq . eqViewDist ?~ 350
|
||||||
|
|
||||||
detectorColor :: Detector -> Color
|
detectorColor :: Detector -> Color
|
||||||
detectorColor dt = case dt of
|
detectorColor dt = case dt of
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ rewindGun = defaultGun
|
|||||||
, _itEffect = ItRewindEffect rewindEffect []
|
, _itEffect = ItRewindEffect rewindEffect []
|
||||||
, _itUse = defaultlUse
|
, _itUse = defaultlUse
|
||||||
& lUse .~ useRewindGun
|
& lUse .~ useRewindGun
|
||||||
& eqSite .~ GoesOnChest
|
& eqEq . eqSite .~ GoesOnChest
|
||||||
}
|
}
|
||||||
rewindEffect :: Item -> Creature -> World -> World
|
rewindEffect :: Item -> Creature -> World -> World
|
||||||
rewindEffect itm cr w
|
rewindEffect itm cr w
|
||||||
@@ -106,7 +106,7 @@ blinkGun = defaultGun
|
|||||||
, _itUse = defaultlUse
|
, _itUse = defaultlUse
|
||||||
& lUse .~ hammerCheckL (shootL $ const blinkAction)
|
& lUse .~ hammerCheckL (shootL $ const blinkAction)
|
||||||
& useHammer .~ upHammer
|
& useHammer .~ upHammer
|
||||||
& eqSite .~ GoesOnWrist
|
& eqEq . eqSite .~ GoesOnWrist
|
||||||
-- , _itFloorPict = const . noPic . colorSH chartreuse $ upperPrismPoly 2 $ square 2
|
-- , _itFloorPict = const . noPic . colorSH chartreuse $ upperPrismPoly 2 $ square 2
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +115,7 @@ unsafeBlinkGun = blinkGun
|
|||||||
& itName .~ "BLINKER-UNSAFE"
|
& itName .~ "BLINKER-UNSAFE"
|
||||||
& itType .~ BLINKERUNSAFE
|
& itType .~ BLINKERUNSAFE
|
||||||
& itUse . lUse .~ hammerCheckL (shootL $ const unsafeBlinkAction)
|
& itUse . lUse .~ hammerCheckL (shootL $ const unsafeBlinkAction)
|
||||||
|
& itUse . eqEq . eqViewDist ?~ 400
|
||||||
|
|
||||||
effectGun :: String -> (Creature -> World -> World) -> Item
|
effectGun :: String -> (Creature -> World -> World) -> Item
|
||||||
effectGun name eff = defaultGun
|
effectGun name eff = defaultGun
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ module Dodge.Update.Camera
|
|||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.Zone
|
import Dodge.Zone
|
||||||
|
import Dodge.Equipment
|
||||||
import Dodge.Creature.Test
|
import Dodge.Creature.Test
|
||||||
import Geometry
|
import Geometry
|
||||||
--import Geometry.ConvexPoly
|
--import Geometry.ConvexPoly
|
||||||
@@ -110,7 +111,7 @@ zoomInLongGun w
|
|||||||
wpPointer = creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
|
wpPointer = creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
|
||||||
wp = _crInv (_creatures w IM.! 0) IM.! _crInvSel (_creatures w IM.! 0)
|
wp = _crInv (_creatures w IM.! 0) IM.! _crInvSel (_creatures w IM.! 0)
|
||||||
Just currentZoom = wp ^? itScope . scopeZoom
|
Just currentZoom = wp ^? itScope . scopeZoom
|
||||||
newzoom = fromJust (wp ^? itScope . scopeZoom) / zoomSpeed
|
newzoom = (wp ^?! itScope . scopeZoom) / zoomSpeed
|
||||||
mousep = rotateV (_cameraRot w) $ _mousePos w
|
mousep = rotateV (_cameraRot w) $ _mousePos w
|
||||||
|
|
||||||
zoomOutLongGun :: World -> World
|
zoomOutLongGun :: World -> World
|
||||||
@@ -188,7 +189,9 @@ setViewDistance cfig w = w & viewDistance
|
|||||||
|
|
||||||
-- TODO consider adding visible/nearby creatures as view points
|
-- TODO consider adding visible/nearby creatures as view points
|
||||||
farWallDist :: Point2 -> Configuration -> World -> Float
|
farWallDist :: Point2 -> Configuration -> World -> Float
|
||||||
farWallDist p cfig w = (winFac /) . min maxViewDistance $ ssfold (> maxViewDistance) findMax 1 vps
|
--farWallDist p cfig w = (winFac /) . min maxViewDistance $ ssfold (> maxViewDistance) findMax 1 vps
|
||||||
|
farWallDist p cfig w = (winFac /)
|
||||||
|
. min maxViewDistance $ ssfold (> maxViewDistance) findMax distFromEqmnt vps
|
||||||
where
|
where
|
||||||
findMax curMax pout = max curMax $ dist p $ collidePointUpToIndirectMinDist p pout curMax wos
|
findMax curMax pout = max curMax $ dist p $ collidePointUpToIndirectMinDist p pout curMax wos
|
||||||
hw = halfWidth cfig
|
hw = halfWidth cfig
|
||||||
@@ -197,6 +200,8 @@ farWallDist p cfig w = (winFac /) . min maxViewDistance $ ssfold (> maxViewDista
|
|||||||
vps = concatMap _grViewpoints grs ++ extendedViewPoints p grs
|
vps = concatMap _grViewpoints grs ++ extendedViewPoints p grs
|
||||||
grs = filter (pointInOrOnPolygon p . _grBound) (_gameRooms w)
|
grs = filter (pointInOrOnPolygon p . _grBound) (_gameRooms w)
|
||||||
wos = wallsOnScreen cfig w
|
wos = wallsOnScreen cfig w
|
||||||
|
distFromEqmnt = foldr max 1 $ IM.mapMaybe (_eqViewDist . _eqEq. _itUse) $ getCrEquipment $ you w
|
||||||
|
|
||||||
|
|
||||||
extendedViewPoints :: Point2 -> [GameRoom] -> [Point2]
|
extendedViewPoints :: Point2 -> [GameRoom] -> [Point2]
|
||||||
extendedViewPoints p grs = map extend
|
extendedViewPoints p grs = map extend
|
||||||
|
|||||||
Reference in New Issue
Block a user