Fold aiming parameters into item use datatype

This commit is contained in:
2021-11-27 18:10:05 +00:00
parent 8639b2d428
commit 652af6b0a9
24 changed files with 135 additions and 155 deletions
+2 -2
View File
@@ -22,7 +22,7 @@ crMvBy p' cr = advanceStepCounter (magV p) cr
= product $ map equipAimSpeed $ IM.elems $ _crInv cr = product $ map equipAimSpeed $ IM.elems $ _crInv cr
| otherwise = product $ map equipSpeed $ IM.elems $ _crInv cr | otherwise = product $ map equipSpeed $ IM.elems $ _crInv cr
aimingFactor aimingFactor
| _posture (_crStance cr) == Aiming = fromMaybe 1 $ it ^? itAimingSpeed | _posture (_crStance cr) == Aiming = fromMaybe 1 $ it ^? itUse . useAim . aimSpeed
| otherwise = 1 | otherwise = 1
it = _crInv cr IM.! _crInvSel cr it = _crInv cr IM.! _crInvSel cr
@@ -40,7 +40,7 @@ crMvAbsolute p' cr = advanceStepCounter (magV p) cr
= product $ map equipAimSpeed $ IM.elems $ _crInv cr = product $ map equipAimSpeed $ IM.elems $ _crInv cr
| otherwise = product $ map equipSpeed $ IM.elems $ _crInv cr | otherwise = product $ map equipSpeed $ IM.elems $ _crInv cr
aimingFactor aimingFactor
| _posture (_crStance cr) == Aiming = fromMaybe 1 $ it ^? itAimingSpeed | _posture (_crStance cr) == Aiming = fromMaybe 1 $ it ^? itUse . useAim . aimSpeed
| otherwise = 1 | otherwise = 1
it = _crInv cr IM.! _crInvSel cr it = _crInv cr IM.! _crInvSel cr
+3 -3
View File
@@ -182,17 +182,17 @@ scalp cr
fhead = colorSH (greyN 0.9) . upperPrismPolyHalf 5 $ polyCirc 4 5 fhead = colorSH (greyN 0.9) . upperPrismPolyHalf 5 $ polyCirc 4 5
oneH :: Creature -> Bool oneH :: Creature -> Bool
oneH cr = crIsAiming' cr && crIt ^? itAimStance == Just OneHand oneH cr = crIsAiming' cr && crIt ^? itUse . useAim . aimStance == Just OneHand
where where
crIt = _crInv cr IM.! _crInvSel cr crIt = _crInv cr IM.! _crInvSel cr
twoFlat :: Creature -> Bool twoFlat :: Creature -> Bool
twoFlat cr = crIsAiming' cr && crIt ^? itAimStance == Just TwoHandFlat twoFlat cr = crIsAiming' cr && crIt ^? itUse . useAim . aimStance == Just TwoHandFlat
where where
crIt = _crInv cr IM.! _crInvSel cr crIt = _crInv cr IM.! _crInvSel cr
twists :: Creature -> Bool twists :: Creature -> Bool
twists cr = crIsAiming' cr && crIt ^? itAimStance == Just TwoHandTwist twists cr = crIsAiming' cr && crIt ^? itUse . useAim . aimStance == Just TwoHandTwist
where where
crIt = _crInv cr IM.! _crInvSel cr crIt = _crInv cr IM.! _crInvSel cr
+12 -16
View File
@@ -301,13 +301,22 @@ data ItemUse
, _useDelay :: UseDelay , _useDelay :: UseDelay
, _useMods :: [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World] , _useMods :: [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
, _useHammer :: HammerType , _useHammer :: HammerType
, _useAim :: AimParams
} }
| LeftUse | LeftUse
{ _lUse :: Creature -> Int -> World -> World { _lUse :: Creature -> Int -> World -> World
, _itUseDelay :: UseDelay , _useDelay :: UseDelay
, _itHammer :: HammerType , _useHammer :: HammerType
} }
| NoUse | NoUse
data AimParams = AimParams
{ _aimSpeed :: Float
, _aimRange :: Float
, _aimZoom :: ItZoom
, _aimStance :: AimStance
}
_itUseAimStance :: Item -> AimStance
_itUseAimStance = _aimStance . _useAim . _itUse
data ItemAmmo data ItemAmmo
= LoadableAmmo = LoadableAmmo
{ _aoType :: AmmoType { _aoType :: AmmoType
@@ -333,10 +342,7 @@ data Item
, _wpSpread :: Float , _wpSpread :: Float
, _wpRange :: Float , _wpRange :: Float
, _itFloorPict :: Item -> SPic , _itFloorPict :: Item -> SPic
, _itAimingSpeed :: Float
, _itAimingRange :: Float
, _itZoom :: ItZoom , _itZoom :: ItZoom
, _itAimZoom :: ItZoom
, _itEquipPict :: Creature -> Int -> SPic , _itEquipPict :: Creature -> Int -> SPic
, _itScroll :: Float -> Creature -> Item -> Item , _itScroll :: Float -> Creature -> Item -> Item
, _itIdentity :: ItemIdentity , _itIdentity :: ItemIdentity
@@ -347,7 +353,6 @@ data Item
, _itInvColor :: Color , _itInvColor :: Color
, _itTargeting :: Maybe (World -> Maybe Point2, Int -> Item -> Creature -> World -> Picture) , _itTargeting :: Maybe (World -> Maybe Point2, Int -> Item -> Creature -> World -> Picture)
, _itWorldTrigger :: Maybe (Int -> World -> Bool) , _itWorldTrigger :: Maybe (Int -> World -> Bool)
, _itAimStance :: AimStance
, _wpNumBarrels :: Int , _wpNumBarrels :: Int
, _itDimension :: ItemDimension , _itDimension :: ItemDimension
, _itCurseStatus :: CurseStatus , _itCurseStatus :: CurseStatus
@@ -364,7 +369,6 @@ data Item
, _itInvDisplay :: Item -> String , _itInvDisplay :: Item -> String
, _itInvColor :: Color , _itInvColor :: Color
, _itEffect :: ItEffect , _itEffect :: ItEffect
, _itAimStance :: AimStance
, _itCurseStatus :: CurseStatus , _itCurseStatus :: CurseStatus
, _itDimension :: ItemDimension , _itDimension :: ItemDimension
} }
@@ -378,7 +382,6 @@ data Item
, _itID :: Maybe Int , _itID :: Maybe Int
, _itInvDisplay :: Item -> String , _itInvDisplay :: Item -> String
, _itInvColor :: Color , _itInvColor :: Color
, _itAimStance :: AimStance
, _itCurseStatus :: CurseStatus , _itCurseStatus :: CurseStatus
, _itDimension :: ItemDimension , _itDimension :: ItemDimension
} }
@@ -389,13 +392,9 @@ data Item
, _itIdentity :: ItemIdentity , _itIdentity :: ItemIdentity
, _itEffect :: ItEffect , _itEffect :: ItEffect
, _itID :: Maybe Int , _itID :: Maybe Int
, _itAimingSpeed :: Float
, _itAimingRange :: Float
, _itZoom :: ItZoom , _itZoom :: ItZoom
, _itAimZoom :: ItZoom
, _itInvDisplay :: Item -> String , _itInvDisplay :: Item -> String
, _itInvColor :: Color , _itInvColor :: Color
, _itAimStance :: AimStance
, _itCurseStatus :: CurseStatus , _itCurseStatus :: CurseStatus
, _itDimension :: ItemDimension , _itDimension :: ItemDimension
} }
@@ -407,10 +406,7 @@ data Item
, _twMaxRange :: Float , _twMaxRange :: Float
, _twAccuracy :: Float , _twAccuracy :: Float
, _itUse :: ItemUse , _itUse :: ItemUse
, _itAimingSpeed :: Float
, _itAimingRange :: Float
, _itZoom :: ItZoom , _itZoom :: ItZoom
, _itAimZoom :: ItZoom
, _itEquipPict :: Creature -> Int -> SPic , _itEquipPict :: Creature -> Int -> SPic
, _itIdentity :: ItemIdentity , _itIdentity :: ItemIdentity
, _itID :: Maybe Int , _itID :: Maybe Int
@@ -419,7 +415,6 @@ data Item
, _itInvColor :: Color , _itInvColor :: Color
, _itEffect :: ItEffect , _itEffect :: ItEffect
, _itScroll :: Float -> Creature -> Item -> Item , _itScroll :: Float -> Creature -> Item -> Item
, _itAimStance :: AimStance
, _itCurseStatus :: CurseStatus , _itCurseStatus :: CurseStatus
, _itDimension :: ItemDimension , _itDimension :: ItemDimension
} }
@@ -894,3 +889,4 @@ makeLenses ''Zone
makeLenses ''ItemDimension makeLenses ''ItemDimension
makeLenses ''Vocalization makeLenses ''Vocalization
makeLenses ''UseDelay makeLenses ''UseDelay
makeLenses ''AimParams
-6
View File
@@ -138,13 +138,9 @@ defaultEquipment = Equipment
, _itEquipPict = \_ _ -> (,) emptySH blank , _itEquipPict = \_ _ -> (,) emptySH blank
, _itEffect = NoItEffect , _itEffect = NoItEffect
, _itID = Nothing , _itID = Nothing
, _itAimingSpeed = 1
, _itAimingRange = 0
, _itZoom = defaultItZoom , _itZoom = defaultItZoom
, _itAimZoom = defaultItZoom
, _itInvColor = yellow , _itInvColor = yellow
, _itInvDisplay = _itName , _itInvDisplay = _itName
, _itAimStance = LeaveHolstered
, _itDimension = defaultItemDimension , _itDimension = defaultItemDimension
} }
defaultItZoom :: ItZoom defaultItZoom :: ItZoom
@@ -163,7 +159,6 @@ defaultConsumable = Consumable
, _itInvColor = blue , _itInvColor = blue
, _itInvDisplay = \it -> _itName it ++ " x" ++ show (_itAmount it) , _itInvDisplay = \it -> _itName it ++ " x" ++ show (_itAmount it)
, _itEffect = wpRecock , _itEffect = wpRecock
, _itAimStance = LeaveHolstered
, _itDimension = defaultItemDimension , _itDimension = defaultItemDimension
} }
defaultApplyDamage :: [DamageType] -> Creature -> (World -> World, Creature) defaultApplyDamage :: [DamageType] -> Creature -> (World -> World, Creature)
@@ -212,7 +207,6 @@ defaultIt = Consumable
, _itInvDisplay = _itName , _itInvDisplay = _itName
, _itInvColor = blue , _itInvColor = blue
, _itEffect = NoItEffect , _itEffect = NoItEffect
, _itAimStance = LeaveHolstered
} }
defaultMachine :: Machine defaultMachine :: Machine
defaultMachine = Machine defaultMachine = Machine
+17 -11
View File
@@ -10,6 +10,8 @@ import Shape
import Geometry.Vector3D import Geometry.Vector3D
import Geometry import Geometry
import Control.Lens
defaultAmmo :: ItemAmmo defaultAmmo :: ItemAmmo
defaultAmmo = LoadableAmmo defaultAmmo = LoadableAmmo
{ _aoType = GenericAmmo { _aoType = GenericAmmo
@@ -33,6 +35,7 @@ ruseRate i f ht usemods = RightUse
} }
, _useMods = usemods , _useMods = usemods
, _useHammer = ht , _useHammer = ht
, _useAim = defaultAimParams
} }
ruseInstant ruseInstant
@@ -45,6 +48,7 @@ ruseInstant f ht usemods = RightUse
, _useDelay = NoDelay , _useDelay = NoDelay
, _useMods = usemods , _useMods = usemods
, _useHammer = ht , _useHammer = ht
, _useAim = defaultAimParams
} }
defaultrUse :: ItemUse defaultrUse :: ItemUse
@@ -53,19 +57,27 @@ defaultrUse = RightUse
, _useDelay = DelayRate {_rateMax = 8, _rateTime = 0} , _useDelay = DelayRate {_rateMax = 8, _rateTime = 0}
, _useMods = [] , _useMods = []
, _useHammer = HasHammer HammerUp , _useHammer = HasHammer HammerUp
, _useAim = defaultAimParams
} }
defaultlUse :: ItemUse defaultlUse :: ItemUse
defaultlUse = LeftUse defaultlUse = LeftUse
{ _lUse = \_ _ -> id { _lUse = \_ _ -> id
, _itUseDelay = DelayRate {_rateMax = 8, _rateTime = 0} , _useDelay = DelayRate {_rateMax = 8, _rateTime = 0}
, _itHammer = NoHammer , _useHammer = NoHammer
} }
luseInstantNoH :: (Creature -> Int -> World -> World) -> ItemUse luseInstantNoH :: (Creature -> Int -> World -> World) -> ItemUse
luseInstantNoH f = LeftUse luseInstantNoH f = LeftUse
{ _lUse = f { _lUse = f
, _itUseDelay = NoDelay , _useDelay = NoDelay
, _itHammer = NoHammer , _useHammer = NoHammer
}
defaultAimParams :: AimParams
defaultAimParams = AimParams
{ _aimSpeed = 1
, _aimRange = 0
, _aimZoom = ItZoom 20 0.2 1
, _aimStance = OneHand
} }
defaultGun :: Item defaultGun :: Item
@@ -85,10 +97,7 @@ defaultGun = Weapon
(map (addZ 3) $ rectNESW 3 3 (-3) (-3)) (map (addZ 3) $ rectNESW 3 3 (-3) (-3))
(map (addZ 0) $ rectNESW 5 3 (-5) (-7)) (map (addZ 0) $ rectNESW 5 3 (-5) (-7))
) )
, _itAimingSpeed = 1
, _itAimingRange = 0
, _itZoom = ItZoom 20 0.2 1 , _itZoom = ItZoom 20 0.2 1
, _itAimZoom = ItZoom 20 0.2 1
, _itEquipPict = pictureWeaponOnAim , _itEquipPict = pictureWeaponOnAim
, _itScroll = \_ _ -> id , _itScroll = \_ _ -> id
, _itAttachment = NoItAttachment , _itAttachment = NoItAttachment
@@ -98,7 +107,6 @@ defaultGun = Weapon
, _itInvColor = white , _itInvColor = white
, _itTargeting = Nothing , _itTargeting = Nothing
, _itWorldTrigger = Nothing , _itWorldTrigger = Nothing
, _itAimStance = OneHand
, _wpNumBarrels = 1 , _wpNumBarrels = 1
, _itDimension = defaultItemDimension , _itDimension = defaultItemDimension
} }
@@ -113,9 +121,7 @@ defaultItemDimension = ItemDimension
defaultAutoGun :: Item defaultAutoGun :: Item
defaultAutoGun = defaultGun defaultAutoGun = defaultGun
{ _itInvDisplay = basicWeaponDisplay & itUse . useAim . aimStance .~ TwoHandTwist
, _itAimStance = TwoHandTwist
}
defaultShellAmmo :: AmmoType defaultShellAmmo :: AmmoType
defaultShellAmmo = ShellAmmo defaultShellAmmo = ShellAmmo
{ _amPayload = const id { _amPayload = const id
-4
View File
@@ -18,8 +18,6 @@ keyToken n = defaultEquipment
, _itEquipPict = \_ _ -> (,) emptySH $ setDepth 0 $ translate (-5) (-5) $ rotate (pi/2.5) keyPic , _itEquipPict = \_ _ -> (,) emptySH $ setDepth 0 $ translate (-5) (-5) $ rotate (pi/2.5) keyPic
, _itEffect = NoItEffect , _itEffect = NoItEffect
, _itID = Nothing , _itID = Nothing
, _itAimingSpeed = 1
, _itAimingRange = 0
, _itZoom = defaultItZoom , _itZoom = defaultItZoom
, _itInvColor = yellow , _itInvColor = yellow
, _itInvDisplay = _itName , _itInvDisplay = _itName
@@ -41,8 +39,6 @@ latchkey n = defaultEquipment
, _itEquipPict = \_ _ -> (,) emptySH $ setDepth 0 $ translate (-5) (-5) $ rotate (pi/2.5) latchkeyPic , _itEquipPict = \_ _ -> (,) emptySH $ setDepth 0 $ translate (-5) (-5) $ rotate (pi/2.5) latchkeyPic
, _itEffect = NoItEffect , _itEffect = NoItEffect
, _itID = Nothing , _itID = Nothing
, _itAimingSpeed = 1
, _itAimingRange = 0
, _itZoom = defaultItZoom , _itZoom = defaultItZoom
, _itInvColor = yellow , _itInvColor = yellow
, _itInvDisplay = _itName , _itInvDisplay = _itName
+1 -1
View File
@@ -61,7 +61,7 @@ changeFuse
-> Item -> Item
changeFuse scrollAmount _ it = it changeFuse scrollAmount _ it = it
& ( itAttachment .~ ItFuse newTime ) & ( itAttachment .~ ItFuse newTime )
& ( itAimZoom .~ defaultItZoom{_itZoomMax = zm, _itZoomMin = zm} ) & ( itUse . useAim . aimZoom .~ defaultItZoom{_itZoomMax = zm, _itZoomMin = zm} )
where where
oldTime = _itFuseTime $ _itAttachment it oldTime = _itFuseTime $ _itAttachment it
newTime = min 90 $ max 20 $ oldTime - round (5 * scrollAmount) newTime = min 90 $ max 20 $ oldTime - round (5 * scrollAmount)
-1
View File
@@ -19,5 +19,4 @@ pipe = Craftable
, _itID = Nothing , _itID = Nothing
, _itInvDisplay = _itName , _itInvDisplay = _itName
, _itInvColor = green , _itInvColor = green
, _itAimStance = LeaveHolstered
} }
+4 -3
View File
@@ -68,9 +68,10 @@ pictureWeaponOnAimItem p cr posInInv
Just (Walking x LeftForward) -> f x * 50 Just (Walking x LeftForward) -> f x * 50
_ -> 0 _ -> 0
theIt = _crInv cr IM.! posInInv theIt = _crInv cr IM.! posInInv
isTwisting = _itAimStance theIt == TwoHandTwist isTwisting = theIt ^? itUseAimStance == Just TwoHandTwist
isOneHand = _itAimStance theIt == OneHand isOneHand = theIt ^? itUseAimStance == Just OneHand
isTwoHandFlat = _itAimStance theIt == TwoHandFlat isTwoHandFlat = theIt ^? itUseAimStance == Just TwoHandFlat
itUseAimStance = itUse . useAim . aimStance
f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
sLen = _strideLength $ _crStance cr sLen = _strideLength $ _crStance cr
+1 -2
View File
@@ -50,8 +50,7 @@ frontArmour = defaultEquipment
} }
flatShield :: Item flatShield :: Item
flatShield = defaultEquipment flatShield = defaultEquipment
{ _itEquipPict = pictureWeaponOnAim' flatShieldEquipSPic { _itEquipPict = pictureWeaponOnAim' flatShieldEquipSPic -- this will not work any more because the shield has no aim stance
, _itAimStance = TwoHandFlat
, _itEffect = effectOnOffEquip createShieldWall removeShieldWall , _itEffect = effectOnOffEquip createShieldWall removeShieldWall
, _itName = "SHIELD" , _itName = "SHIELD"
, _itIdentity = FlatShield , _itIdentity = FlatShield
+8
View File
@@ -21,6 +21,14 @@ useAmmoParamsRate rate ht usemods = RightUse
, _useDelay = DelayRate {_rateMax = rate,_rateTime = 0} , _useDelay = DelayRate {_rateMax = rate,_rateTime = 0}
, _useMods = usemods , _useMods = usemods
, _useHammer = ht , _useHammer = ht
, _useAim = defaultAimParams
}
defaultAimParams :: AimParams
defaultAimParams = AimParams
{ _aimSpeed = 1
, _aimRange = 0
, _aimZoom = ItZoom 20 0.2 1
, _aimStance = OneHand
} }
useAmmoParams :: Item -> Creature -> World -> World useAmmoParams :: Item -> Creature -> World -> World
+9 -10
View File
@@ -42,20 +42,18 @@ teslaGun = defaultGun
, _wpLoadedAmmo = 200 , _wpLoadedAmmo = 200
, _wpReloadTime = 80 , _wpReloadTime = 80
} }
, _itAimStance = TwoHandFlat
, _itUse = ruseInstant (const aTeslaArc) NoHammer , _itUse = ruseInstant (const aTeslaArc) NoHammer
[ ammoCheckI [ ammoCheckI
, useTimeCheckI
, withTempLight 1 100 (V3 0 0 1) , withTempLight 1 100 (V3 0 0 1)
, withSoundForI elecCrackleS 1 , withSoundForI elecCrackleS 1
, useAmmo 1 , useAmmo 1
] ]
& useAim . aimSpeed .~ 0.4
& useAim . aimStance .~ TwoHandFlat
, _wpSpread = 0.001 , _wpSpread = 0.001
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = teslaGunPic , _itFloorPict = teslaGunPic
, _itAimingSpeed = 0.4
, _itZoom = defaultItZoom , _itZoom = defaultItZoom
, _itAimingRange = 0
} }
teslaGunPic :: Item -> SPic teslaGunPic :: Item -> SPic
teslaGunPic _ = noPic $ colorSH blue $ teslaGunPic _ = noPic $ colorSH blue $
@@ -76,16 +74,16 @@ lasGun = defaultAutoGun
} }
, _itUse = ruseInstant (const aLaser) NoHammer , _itUse = ruseInstant (const aLaser) NoHammer
[ ammoCheckI [ ammoCheckI
, useTimeCheckI
, withTempLight 1 100 (V3 1 1 0) , withTempLight 1 100 (V3 1 1 0)
, withSoundForI tone440sawtoothquietS 2 , withSoundForI tone440sawtoothquietS 2
, useAmmo 1 , useAmmo 1
] ]
& useAim . aimSpeed .~ 0.4
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
, _wpSpread = 0.001 , _wpSpread = 0.001
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = lasGunPic , _itFloorPict = lasGunPic
, _itAimingSpeed = 0.4
, _itAimingRange = 1
, _itAttachment = ItCharMode $ Seq.fromList "/VZ" , _itAttachment = ItCharMode $ Seq.fromList "/VZ"
, _itScroll = scrollCharMode , _itScroll = scrollCharMode
, _itInvDisplay = basicWeaponDisplay , _itInvDisplay = basicWeaponDisplay
@@ -113,13 +111,14 @@ tractorGun = defaultAutoGun
, _wpReloadTime = 40 , _wpReloadTime = 40
} }
, _itUse = ruseInstant aTractorBeam NoHammer , _itUse = ruseInstant aTractorBeam NoHammer
[ ammoUseCheckI [ ammoCheckI
] ]
& useAim . aimSpeed .~ 0.4
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
, _wpSpread = 0.00001 , _wpSpread = 0.00001
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = tractorGunSPic , _itFloorPict = tractorGunSPic
, _itAimingSpeed = 0.4
, _itAimingRange = 0.5
} }
-- TODO own picture for tractor gun -- TODO own picture for tractor gun
tractorGunSPic :: Item -> SPic tractorGunSPic :: Item -> SPic
+5 -3
View File
@@ -26,23 +26,25 @@ bezierGun = defaultGun
, _itUse = ruseRate 6 (\_ -> useTargetPos $ \p -> shootBezier $ fromJust p) -- <- the start point , _itUse = ruseRate 6 (\_ -> useTargetPos $ \p -> shootBezier $ fromJust p) -- <- the start point
NoHammer NoHammer
[ ammoCheckI [ ammoCheckI
, useTimeCheckI , useTimeCheck
, withSoundStart tap2S , withSoundStart tap2S
, useAmmo 1 , useAmmo 1
, withMuzFlareI , withMuzFlareI
. withRecoilI 40 . withRecoilI 40
. torqueBefore 0.05 . torqueBefore 0.05
] ]
& useAim . aimSpeed .~ 0.4
& useAim . aimRange .~ 0
& useAim . aimStance .~ TwoHandTwist
-- & useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
, _itFloorPict = bezierGunSPic , _itFloorPict = bezierGunSPic
, _itAttachment = NoItAttachment , _itAttachment = NoItAttachment
, _itScroll = \_ _ -> removeItTarget , _itScroll = \_ _ -> removeItTarget
, _itEffect = rbSetTarget , _itEffect = rbSetTarget
, _itZoom = defaultItZoom , _itZoom = defaultItZoom
, _itAimingRange = 0
, _wpAmmo = defaultAmmo , _wpAmmo = defaultAmmo
{ _wpMaxAmmo = 50 { _wpMaxAmmo = 50
} }
, _itAimStance = TwoHandTwist
} }
bezierGunSPic :: Item -> SPic bezierGunSPic :: Item -> SPic
bezierGunSPic = autoGunPic bezierGunSPic = autoGunPic
-2
View File
@@ -122,8 +122,6 @@ boosterGun = defaultGun
, _wpSpread = 0.05 , _wpSpread = 0.05
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)] , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)]
, _itAimingSpeed = 1
, _itAimingRange = 0
, _itEffect = resetAttachmentID , _itEffect = resetAttachmentID
} }
resetAttachmentID :: ItEffect resetAttachmentID :: ItEffect
+26 -29
View File
@@ -46,7 +46,7 @@ autoGun = defaultAutoGun
, charFiringStratI , charFiringStratI
[('S', hammerCheckI) [('S', hammerCheckI)
] ]
, useTimeCheckI , useTimeCheck
, charFiringStratI , charFiringStratI
[('M', torqueBefore 0.08) [('M', torqueBefore 0.08)
,('S', torqueBefore 0.05) ,('S', torqueBefore 0.05)
@@ -58,13 +58,14 @@ autoGun = defaultAutoGun
, withMuzFlareI , withMuzFlareI
, withSmoke 1 black 20 200 5 , withSmoke 1 black 20 200 5
] ]
& useAim . aimSpeed .~ 0.4
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
, _wpSpread = autogunSpread , _wpSpread = autogunSpread
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = autoGunPic , _itFloorPict = autoGunPic
, _itAimingSpeed = 0.4
, _itAimingRange = 1
, _itZoom = defaultItZoom , _itZoom = defaultItZoom
, _itAimZoom = defaultItZoom {_itZoomFac = 1.5}
, _itEquipPict = pictureWeaponOnAim , _itEquipPict = pictureWeaponOnAim
, _itAttachment = ItCharMode $ Seq.fromList "MS" , _itAttachment = ItCharMode $ Seq.fromList "MS"
, _itScroll = scrollCharMode , _itScroll = scrollCharMode
@@ -93,7 +94,7 @@ pistol = defaultGun
, _itUse = useAmmoParamsRate 8 upHammer , _itUse = useAmmoParamsRate 8 upHammer
[ ammoCheckI [ ammoCheckI
, hammerCheckI , hammerCheckI
, useTimeCheckI , useTimeCheck
, withSoundStart tap3S , withSoundStart tap3S
, useAmmo 1 , useAmmo 1
, randSpreadDir , randSpreadDir
@@ -102,8 +103,6 @@ pistol = defaultGun
, _wpSpread = 0.02 , _wpSpread = 0.02
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = pistolPic , _itFloorPict = pistolPic
, _itAimingSpeed = 1
, _itAimingRange = 0
, _itZoom = defaultItZoom , _itZoom = defaultItZoom
, _itEquipPict = pictureWeaponAim pistolPic , _itEquipPict = pictureWeaponAim pistolPic
, _itID = Nothing , _itID = Nothing
@@ -143,10 +142,12 @@ hvAutoGun = defaultAutoGun
, withThinSmokeI , withThinSmokeI
, withMuzFlareI , withMuzFlareI
] ]
& useAim . aimSpeed .~ 0.2
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = hvAutoGunPic , _itFloorPict = hvAutoGunPic
, _itAimingSpeed = 0.2
, _itAimingRange = 1
} }
hvAutoGunPic :: Item -> SPic hvAutoGunPic :: Item -> SPic
hvAutoGunPic it = hvAutoGunPic it =
@@ -171,7 +172,7 @@ ltAutoGun = defaultAutoGun
} }
, _itUse = useAmmoParamsRate 3 NoHammer , _itUse = useAmmoParamsRate 3 NoHammer
[ ammoCheckI [ ammoCheckI
, useTimeCheckI , useTimeCheck
, withSoundStart tap1S , withSoundStart tap1S
, useAmmo 1 , useAmmo 1
, withRandomDirI 0.1 , withRandomDirI 0.1
@@ -182,10 +183,7 @@ ltAutoGun = defaultAutoGun
, _wpSpread = 0.5 , _wpSpread = 0.5
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = ltAutoGunPic , _itFloorPict = ltAutoGunPic
, _itAimingSpeed = 1
, _itAimingRange = 0
, _itZoom = defaultItZoom , _itZoom = defaultItZoom
, _itAimStance = OneHand
} }
& itDimension . muzzleLength .~ 10 & itDimension . muzzleLength .~ 10
ltAutoGunPic :: Item -> SPic ltAutoGunPic :: Item -> SPic
@@ -212,7 +210,6 @@ miniGun = defaultAutoGun
, _itUse = ruseInstant (useAmmoParamsVelMod vm4) NoHammer , _itUse = ruseInstant (useAmmoParamsVelMod vm4) NoHammer
[ ammoCheckI [ ammoCheckI
, withWarmUpI crankSlowS , withWarmUpI crankSlowS
, useTimeCheckI
--, afterRecoil recoilAmount --, afterRecoil recoilAmount
, withSoundForI mini1S 2 , withSoundForI mini1S 2
--, withThinSmokeI --, withThinSmokeI
@@ -242,10 +239,12 @@ miniGun = defaultAutoGun
, withOldDir od3 , withOldDir od3
, withSmoke 1 black 20 200 5 , withSmoke 1 black 20 200 5
] ]
& useAim . aimSpeed .~ 0.4
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = miniGunPictItem , _itFloorPict = miniGunPictItem
, _itAimingSpeed = 0.4
, _itAimingRange = 1
, _itEquipPict = pictureWeaponAim miniGunPictItem , _itEquipPict = pictureWeaponAim miniGunPictItem
} & itDimension . muzzleLength .~ 15 } & itDimension . muzzleLength .~ 15
where where
@@ -300,7 +299,7 @@ spreadGun = defaultGun
, _itUse = useAmmoParamsRate 20 upHammer , _itUse = useAmmoParamsRate 20 upHammer
[ ammoCheckI [ ammoCheckI
, hammerCheckI , hammerCheckI
, useTimeCheckI , useTimeCheck
, withSoundStart shotgunS , withSoundStart shotgunS
, useAmmo 1 , useAmmo 1
, withRecoilI 100 , withRecoilI 100
@@ -310,8 +309,6 @@ spreadGun = defaultGun
, _wpSpread = spreadGunSpread , _wpSpread = spreadGunSpread
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = spreadGunPic , _itFloorPict = spreadGunPic
, _itAimingSpeed = 1
, _itAimingRange = 0
, _wpNumBarrels = 50 , _wpNumBarrels = 50
} }
spreadGunPic :: Item -> SPic spreadGunPic :: Item -> SPic
@@ -335,21 +332,21 @@ multGun = defaultGun
, _itUse = useAmmoParamsRate 20 upHammer , _itUse = useAmmoParamsRate 20 upHammer
[ ammoCheckI [ ammoCheckI
, hammerCheckI , hammerCheckI
, useTimeCheckI , useTimeCheck
, withSoundStart shotgunS , withSoundStart shotgunS
, useAmmo 1 , useAmmo 1
, withRecoilI 200 , withRecoilI 200
, withMuzFlareI , withMuzFlareI
, numI , numI
] ]
& useAim . aimSpeed .~ 0.4
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
, _wpSpread = spreadGunSpread , _wpSpread = spreadGunSpread
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = multGunSPic , _itFloorPict = multGunSPic
, _itAimingSpeed = 0.4
, _itAimingRange = 1
, _itZoom = defaultItZoom , _itZoom = defaultItZoom
, _itAimZoom = defaultItZoom {_itZoomFac = 1.5}
, _itAimStance = TwoHandTwist
, _wpNumBarrels = 5 , _wpNumBarrels = 5
} }
multGunSPic :: Item -> SPic multGunSPic :: Item -> SPic
@@ -381,23 +378,23 @@ longGun = defaultGun
, _itUse = useAmmoParamsRate 100 upHammer , _itUse = useAmmoParamsRate 100 upHammer
[ ammoCheckI [ ammoCheckI
, hammerCheckI , hammerCheckI
, useTimeCheckI , useTimeCheck
, withSoundStart bangEchoS , withSoundStart bangEchoS
, useAmmo 1 , useAmmo 1
, withThickSmokeI , withThickSmokeI
, torqueAfterI 0.05 , torqueAfterI 0.05
, withMuzFlareI , withMuzFlareI
] ]
& useAim . aimSpeed .~ 0.2
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
& useAim . aimZoom .~ defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5}
, _wpRange = 200 , _wpRange = 200
, _itFloorPict = longGunSPic , _itFloorPict = longGunSPic
, _itAimingSpeed = 0.2
, _itAimingRange = 1
, _itZoom = defaultItZoom , _itZoom = defaultItZoom
, _itAimZoom = defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5}
, _itScroll = zoomLongGun , _itScroll = zoomLongGun
, _itAttachment = ItScope (V2 0 0) 0 1 False , _itAttachment = ItScope (V2 0 0) 0 1 False
, _itEffect = itemLaserScopeEffect , _itEffect = itemLaserScopeEffect
, _itAimStance = TwoHandTwist
} }
longGunSPic :: Item -> SPic longGunSPic :: Item -> SPic
longGunSPic _ = longGunSPic _ =
+4 -4
View File
@@ -31,17 +31,17 @@ lasDrones = defaultGun
} }
, _itUse = ruseRate 20 aDroneWithItemParams upHammer , _itUse = ruseRate 20 aDroneWithItemParams upHammer
[ ammoCheckI [ ammoCheckI
, useTimeCheckI , useTimeCheck
, withSoundStart tap4S , withSoundStart tap4S
, useAmmo 1 , useAmmo 1
] ]
& useAim . aimSpeed .~ 0.2
& useAim . aimRange .~ 0.5
& useAim . aimStance .~ TwoHandTwist
, _wpSpread = 0.02 , _wpSpread = 0.02
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = lasDronesPic , _itFloorPict = lasDronesPic
, _itAimingSpeed = 0.2
, _itAimingRange = 0.5
, _itEffect = NoItEffect , _itEffect = NoItEffect
, _itAimStance = TwoHandTwist
} }
lasDronesPic :: Item -> SPic lasDronesPic :: Item -> SPic
+3 -3
View File
@@ -34,11 +34,11 @@ wpRecock = ItInvEffect
,_itEffectCounter = 0 ,_itEffectCounter = 0
} }
where where
f _ cr i = creatures . ix (_crID cr) . crInv %~ IM.adjust fOnIt i f _ cr invid = creatures . ix (_crID cr) . crInv . ix invid
. itUse . useHammer . hammerPosition %~ moveHammerUp
moveHammerUp HammerDown = HammerReleased moveHammerUp HammerDown = HammerReleased
moveHammerUp HammerReleased = HammerUp moveHammerUp HammerReleased = HammerUp
moveHammerUp HammerUp = HammerUp moveHammerUp HammerUp = HammerUp
fOnIt it = it & itUse . itHammer . hammerPosition %~ moveHammerUp
--{- | --{- |
--Special recock for the bezier gun. --Special recock for the bezier gun.
--Not sure of its purpose at this time... -} --Not sure of its purpose at this time... -}
@@ -65,7 +65,7 @@ itemLaserScopeEffect
f _ cr invid w f _ cr invid w
| invid == _crInvSel cr && crIsAiming' cr = w | invid == _crInvSel cr && crIsAiming' cr = w
& particles %~ (:) (makeLaserScope sp ep reloadFrac) & particles %~ (:) (makeLaserScope sp ep reloadFrac)
& creatures . ix (_crID cr) . crInv . ix invid . itUse . itHammer . hammerPosition %~ moveHammerUp & creatures . ix (_crID cr) . crInv . ix invid . itUse . useHammer . hammerPosition %~ moveHammerUp
| otherwise = w | otherwise = w
where where
p = _crPos cr p = _crPos cr
+4 -7
View File
@@ -35,12 +35,10 @@ grenade = Throwable
, _twMaxRange = 150 , _twMaxRange = 150
, _twAccuracy = 30 , _twAccuracy = 30
, _itUse = ruseRate 25 (\_ -> throwGrenade makeExplosionAt) upHammer , _itUse = ruseRate 25 (\_ -> throwGrenade makeExplosionAt) upHammer
[ useTimeCheckI [ useTimeCheck
] ]
, _itAimingSpeed = 1 & useAim . aimZoom .~ defaultItZoom {_itZoomMax = f fuseTime, _itZoomMin = f fuseTime}
, _itAimingRange = 0
, _itZoom = defaultItZoom , _itZoom = defaultItZoom
, _itAimZoom = defaultItZoom {_itZoomMax = f fuseTime, _itZoomMin = f fuseTime}
, _itEquipPict = pictureWeaponOnAim' $ \_ -> grenadePic fuseTime , _itEquipPict = pictureWeaponOnAim' $ \_ -> grenadePic fuseTime
, _itID = Nothing , _itID = Nothing
, _itAttachment = ItFuse fuseTime , _itAttachment = ItFuse fuseTime
@@ -48,7 +46,6 @@ grenade = Throwable
, _itInvDisplay = basicWeaponDisplay , _itInvDisplay = basicWeaponDisplay
, _itEffect = wpRecock , _itEffect = wpRecock
, _itScroll = changeFuse , _itScroll = changeFuse
, _itAimStance = OneHand
} }
where where
fuseTime = 50 fuseTime = 50
@@ -129,7 +126,7 @@ throwArmReset x = ItInvEffect {_itInvEffect = f ,_itEffectCounter = x }
f _ cr i = creatures . ix (_crID cr) . crInv %~ IM.adjust counterDown i f _ cr i = creatures . ix (_crID cr) . crInv %~ IM.adjust counterDown i
counterDown it counterDown it
| _itEffectCounter (_itEffect it) == 0 = it | _itEffectCounter (_itEffect it) == 0 = it
& itUse . itHammer . hammerPosition .~ HammerUp & itUse . useHammer . hammerPosition .~ HammerUp
& itEquipPict .~ pictureWeaponOnAim' (\_ -> grenadePic 50) & itEquipPict .~ pictureWeaponOnAim' (\_ -> grenadePic 50)
| otherwise = it & itEffect . itEffectCounter -~ 1 | otherwise = it & itEffect . itEffectCounter -~ 1
@@ -207,7 +204,7 @@ setRemoteBombScope itid pj w' = case _itemPositions w' IM.! itid of
InInv cid invid InInv cid invid
-> w' & creatures . ix cid . crInv . ix invid . itAttachment -> w' & creatures . ix cid . crInv . ix invid . itAttachment
. scopePos .~ (_pjPos pj -.- _crPos (_creatures w' IM.! cid)) . scopePos .~ (_pjPos pj -.- _crPos (_creatures w' IM.! cid))
& creatures . ix cid . crInv . ix invid . itAimZoom & creatures . ix cid . crInv . ix invid . itUse . useAim . aimZoom
.~ (defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5}) .~ (defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5})
_ -> w' _ -> w'
+7 -7
View File
@@ -51,17 +51,17 @@ launcher = defaultGun
} }
, _itUse = ruseRate 20 aRocketWithItemParams upHammer , _itUse = ruseRate 20 aRocketWithItemParams upHammer
[ ammoCheckI [ ammoCheckI
, useTimeCheckI , useTimeCheck
, withSoundStart tap4S , withSoundStart tap4S
, useAmmo 1 , useAmmo 1
] ]
& useAim . aimSpeed .~ 0.2
& useAim . aimRange .~ 0.5
& useAim . aimStance .~ TwoHandTwist
, _wpSpread = 0.02 , _wpSpread = 0.02
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = launcherPic , _itFloorPict = launcherPic
, _itAimingSpeed = 0.2
, _itAimingRange = 0.5
, _itEffect = NoItEffect , _itEffect = NoItEffect
, _itAimStance = TwoHandTwist
} }
launcherPic :: Item -> SPic launcherPic :: Item -> SPic
@@ -251,13 +251,13 @@ remoteLauncher = defaultGun
[ ammoCheckI [ ammoCheckI
, hammerCheckI , hammerCheckI
] ]
& useAim . aimSpeed .~ 0.2
& useAim . aimRange .~ 0.5
& useAim . aimStance .~ TwoHandTwist
, _wpSpread = 0.02 , _wpSpread = 0.02
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = launcherPic , _itFloorPict = launcherPic
, _itAimingSpeed = 0.2
, _itAimingRange = 0.5
, _itAttachment = ItScope (V2 0 0) 0 1 True , _itAttachment = ItScope (V2 0 0) 0 1 True
, _itAimStance = TwoHandTwist
} }
fireRemoteLauncher :: Creature -> World -> World fireRemoteLauncher :: Creature -> World -> World
+8 -12
View File
@@ -14,6 +14,8 @@ import Geometry
import Picture import Picture
import Shape import Shape
import Control.Lens
{- | {- |
Sends out pulses that display walls. -} Sends out pulses that display walls. -}
radar :: Item radar :: Item
@@ -26,14 +28,14 @@ radar = defaultGun
, _wpReloadTime = 200 , _wpReloadTime = 200
} }
, _itUse = ruseRate 120 (const aRadarPulse) upHammer , _itUse = ruseRate 120 (const aRadarPulse) upHammer
[ ammoUseCheckI [ ammoUseCheck
] ]
& useAim . aimRange .~ 1
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1}
, _wpSpread = autogunSpread , _wpSpread = autogunSpread
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color blue $ polygon $ rectNESW 5 5 (-5) (-5) , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color blue $ polygon $ rectNESW 5 5 (-5) (-5)
, _itAimingRange = 1
, _itZoom = defaultItZoom { _itZoomMax = 1} , _itZoom = defaultItZoom { _itZoomMax = 1}
, _itAimZoom = defaultItZoom { _itZoomMax = 1}
, _itEquipPict = pictureWeaponOnAim' $ \_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5) , _itEquipPict = pictureWeaponOnAim' $ \_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5)
} }
{- | {- |
@@ -48,13 +50,13 @@ sonar = defaultGun
, _wpReloadTime = 200 , _wpReloadTime = 200
} }
, _itUse = ruseRate 120 (const aSonarPulse) upHammer , _itUse = ruseRate 120 (const aSonarPulse) upHammer
[ ammoUseCheckI [ ammoUseCheck
] ]
& useAim . aimRange .~ 1
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1}
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color blue $ polygon $ rectNESW 5 5 (-5) (-5) , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color blue $ polygon $ rectNESW 5 5 (-5) (-5)
, _itAimingRange = 1
, _itZoom = defaultItZoom {_itZoomMax = 1} , _itZoom = defaultItZoom {_itZoomMax = 1}
, _itAimZoom = defaultItZoom {_itZoomMax = 1}
, _itEquipPict = pictureWeaponOnAim' $ \_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5) , _itEquipPict = pictureWeaponOnAim' $ \_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5)
} }
{- | {- |
@@ -69,10 +71,7 @@ autoSonar = defaultEquipment
, _itEquipPict = \_ _ -> (,) emptySH blank , _itEquipPict = \_ _ -> (,) emptySH blank
, _itEffect = autoSonarEffect , _itEffect = autoSonarEffect
, _itID = Nothing , _itID = Nothing
, _itAimingSpeed = 1
, _itAimingRange = 0
, _itZoom = defaultItZoom {_itZoomMax = 1} , _itZoom = defaultItZoom {_itZoomMax = 1}
, _itAimZoom = defaultItZoom {_itZoomMax = 1}
} }
{- | {- |
Automatically sends out pulses that display walls. -} Automatically sends out pulses that display walls. -}
@@ -86,8 +85,5 @@ autoRadar = defaultEquipment
, _itEquipPict = \_ _ -> (,) emptySH blank , _itEquipPict = \_ _ -> (,) emptySH blank
, _itEffect = autoRadarEffect , _itEffect = autoRadarEffect
, _itID = Nothing , _itID = Nothing
, _itAimingSpeed = 1
, _itAimingRange = 0
, _itZoom = defaultItZoom {_itZoomMax = 1} , _itZoom = defaultItZoom {_itZoomMax = 1}
, _itAimZoom = defaultItZoom {_itZoomMax = 1}
} }
+6 -8
View File
@@ -41,15 +41,14 @@ poisonSprayer = defaultAutoGun
} }
, _itUse = ruseInstant (const aGasCloud) NoHammer , _itUse = ruseInstant (const aGasCloud) NoHammer
[ ammoCheckI [ ammoCheckI
, useTimeCheckI
, withSoundForI foamSprayLoopS 5 , withSoundForI foamSprayLoopS 5
, useAmmo 1 , useAmmo 1
, spreadNumI , spreadNumI
] ]
& useAim . aimSpeed .~ 0.2
& useAim . aimRange .~ 0
, _wpRange = 8 , _wpRange = 8
, _itFloorPict = flamerPic , _itFloorPict = flamerPic
, _itAimingSpeed = 0.2
, _itAimingRange = 0
, _itZoom = defaultItZoom , _itZoom = defaultItZoom
, _wpSpread = 0.1 , _wpSpread = 0.1
, _wpNumBarrels = 3 , _wpNumBarrels = 3
@@ -64,18 +63,17 @@ flamer = defaultAutoGun
, _wpReloadTime = 100 , _wpReloadTime = 100
} }
, _itUse = ruseInstant (\_ -> randWalkAngle 0.2 0.01 aFlame) NoHammer , _itUse = ruseInstant (\_ -> randWalkAngle 0.2 0.01 aFlame) NoHammer
[ ammoUseCheckI [ ammoCheckI
, withSidePushI 5 , withSidePushI 5
--, withTempLight 1 100 (V3 1 0 0) --, withTempLight 1 100 (V3 1 0 0)
, withSidePushAfterI 20 , withSidePushAfterI 20
] ]
& useAim . aimSpeed .~ 0.5
& useAim . aimZoom .~ defaultItZoom {_itZoomMax = 5, _itZoomMin = 1.5}
, _wpSpread = 0 , _wpSpread = 0
, _wpRange = 8 , _wpRange = 8
, _itFloorPict = flamerPic , _itFloorPict = flamerPic
, _itAimingSpeed = 0.5
, _itAimingRange = 0
, _itZoom = defaultItZoom , _itZoom = defaultItZoom
, _itAimZoom = defaultItZoom {_itZoomMax = 5, _itZoomMin = 1.5}
, _itAttachment = NoItAttachment , _itAttachment = NoItAttachment
} }
flamerPic :: Item -> SPic flamerPic :: Item -> SPic
+13 -12
View File
@@ -6,7 +6,7 @@ module Dodge.Item.Weapon.TriggerType
, withOldDir , withOldDir
, trigDoAlso , trigDoAlso
, withTempLight , withTempLight
, ammoUseCheckI , ammoUseCheck
, rateIncABI , rateIncABI
, torqueBefore , torqueBefore
, torqueBeforeAtLeast , torqueBeforeAtLeast
@@ -30,7 +30,7 @@ module Dodge.Item.Weapon.TriggerType
, hammerCheckI , hammerCheckI
, hammerCheckL , hammerCheckL
, shootL , shootL
, useTimeCheckI , useTimeCheck
, ammoCheckI , ammoCheckI
, randSpreadDir , randSpreadDir
, modClock , modClock
@@ -220,26 +220,27 @@ useAmmo amAmount eff item cr = eff item cr
. (creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . wpAmmo . wpLoadedAmmo -~ amAmount) . (creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . wpAmmo . wpLoadedAmmo -~ amAmount)
{- | {- |
Applies a world effect after an item use cooldown check. -} Applies a world effect after an item use cooldown check. -}
useTimeCheckI :: ChainEffect useTimeCheck :: ChainEffect
useTimeCheckI f item cr w = case item ^? itUse . useDelay . rateTime of useTimeCheck f item cr w = case item ^? itUse . useDelay . rateTime of
Just 0 -> f item cr $ setUseTime w Just 0 -> f item cr $ setUseTime w
_ -> w _ -> w
where where
cid = _crID cr cid = _crID cr
setUseTime = creatures . ix cid . crInv . ix (_crInvSel cr) . itUse . useDelay . rateTime +~ userate setUseTime = creatures . ix cid . crInv . ix (_crInvSel cr) . itUse . useDelay . rateTime +~ userate
userate = fromMaybe 0 $ item ^? itUse . useDelay . rateMax userate = fromMaybe 0 $ item ^? itUse . useDelay . rateMax
{- | Applies a world effect after a hammer position check. -} {- | Applies a world effect after a hammer position check. -}
hammerCheckI :: ChainEffect hammerCheckI :: ChainEffect
hammerCheckI f it cr w = case it ^? itUse . itHammer . hammerPosition of hammerCheckI f it cr w = case it ^? itUse . useHammer . hammerPosition of
Just HammerUp -> f it cr $ setHammerDown w Just HammerUp -> f it cr $ setHammerDown w
_ -> setHammerDown w _ -> setHammerDown w
where where
cid = _crID cr cid = _crID cr
setHammerDown = creatures . ix cid . crInv . ix (_crInvSel cr) . itUse setHammerDown = creatures . ix cid . crInv . ix (_crInvSel cr) . itUse
. itHammer . hammerPosition .~ HammerDown . useHammer . hammerPosition .~ HammerDown
{- | Applies a world effect after an ammo check. -} {- | Applies a world effect after an ammo check. -}
ammoUseCheckI :: ChainEffect -- this should be made "safe" incase there is no _rateTime
ammoUseCheckI f item cr w ammoUseCheck :: ChainEffect
ammoUseCheck f item cr w
| fireCondition = f item cr w & pointerToItem %~ | fireCondition = f item cr w & pointerToItem %~
( (wpAmmo . wpLoadedAmmo -~ 1) ( (wpAmmo . wpLoadedAmmo -~ 1)
. (itUse . useDelay . rateTime .~ _rateMax ( _useDelay (_itUse item)) )) . (itUse . useDelay . rateTime .~ _rateMax ( _useDelay (_itUse item)) ))
@@ -261,12 +262,12 @@ hammerCheckL
-> Int -> Int
-> World -> World
-> World -> World
hammerCheckL f cr invid w = case (_crInv cr IM.! invid) ^? itUse . itHammer . hammerPosition of hammerCheckL f cr invid w = case (_crInv cr IM.! invid) ^? itUse . useHammer . hammerPosition of
Just HammerUp -> f cr invid $ setHammerDown w Just HammerUp -> f cr invid $ setHammerDown w
_ -> setHammerDown w _ -> setHammerDown w
where where
cid = _crID cr cid = _crID cr
setHammerDown = creatures . ix cid . crInv . ix invid . itUse . itHammer . hammerPosition .~ HammerDown setHammerDown = creatures . ix cid . crInv . ix invid . itUse . useHammer . hammerPosition .~ HammerDown
{- | Applies a world effect after an ammo check. {- | Applies a world effect after an ammo check.
Arbitrary inventory position. -} Arbitrary inventory position. -}
shootL shootL
-7
View File
@@ -60,13 +60,10 @@ shrinkGun = defaultGun
, _wpLoadedAmmo = 100 , _wpLoadedAmmo = 100
, _wpReloadTime = 20 , _wpReloadTime = 20
} }
, _itAimStance = TwoHandFlat
, _itUse = defaultlUse {_lUse = \cr invid -> useShrinkGun (_crInv cr IM.! invid) cr} , _itUse = defaultlUse {_lUse = \cr invid -> useShrinkGun (_crInv cr IM.! invid) cr}
, _wpSpread = 0.05 , _wpSpread = 0.05
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = shrinkGunPic , _itFloorPict = shrinkGunPic
, _itAimingSpeed = 1
, _itAimingRange = 0
, _itAttachment = ItBool True , _itAttachment = ItBool True
} }
@@ -97,8 +94,6 @@ blinkGun = defaultGun
, _wpSpread = 0.05 , _wpSpread = 0.05
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2[(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)] , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2[(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)]
, _itAimingSpeed = 1
, _itAimingRange = 0
} }
@@ -132,8 +127,6 @@ forceFieldGun = defaultGun
, _wpSpread = 0.02 , _wpSpread = 0.02
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-4,-4),(-4,4),(4,4),(4,0),(0,0),(0,-4)] , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-4,-4),(-4,4),(4,4),(4,0),(0,0),(0,-4)]
, _itAimingSpeed = 0.4
, _itAimingRange = 0.5
} }
-- grapGun = defaultGun -- grapGun = defaultGun
-- { _itName = "grapGun" -- { _itName = "grapGun"
+2 -2
View File
@@ -38,7 +38,7 @@ moveCamera w = w
where where
aimRangeFactor aimRangeFactor
| _cameraZoom w == 0 = 0 | _cameraZoom w == 0 = 0
| otherwise = fromMaybe 0 (yourItem w ^? itAimingRange) / _cameraZoom w | otherwise = fromMaybe 0 (yourItem w ^? itUse . useAim . aimRange) / _cameraZoom w
aimingMult aimingMult
| SDL.ButtonRight `S.member` _mouseButtons w = 1 | SDL.ButtonRight `S.member` _mouseButtons w = 1
| otherwise = 0 | otherwise = 0
@@ -164,7 +164,7 @@ autoZoomCamera w
wallZoom = farWallDist camPos w wallZoom = farWallDist camPos w
idealZoom idealZoom
| SDL.ButtonRight `S.member` _mouseButtons w | SDL.ButtonRight `S.member` _mouseButtons w
= theScopeZoom * maybe zoomNoItem zoomFromItem (yourItem w ^? itAimZoom) wallZoom = theScopeZoom * maybe zoomNoItem zoomFromItem (yourItem w ^? itUse . useAim . aimZoom) wallZoom
| otherwise | otherwise
= maybe zoomNoItem zoomFromItem (yourItem w ^? itZoom) wallZoom = maybe zoomNoItem zoomFromItem (yourItem w ^? itZoom) wallZoom
changeZoom curZoom changeZoom curZoom