Allow modifiable speed changes
This commit is contained in:
+2
-2
@@ -1878,8 +1878,8 @@ yourControl :: World -> (World -> World,StdGen) -> Creature -> ((World -> World,
|
|||||||
yourControl w (f,g) cr = ( (updateUsingInput . f, g)
|
yourControl w (f,g) cr = ( (updateUsingInput . f, g)
|
||||||
, Just . crAutoReload . mouseActionsCr (_mouseButtons w) $ wasdWithAiming w speed strafeSpeed 0 cr
|
, Just . crAutoReload . mouseActionsCr (_mouseButtons w) $ wasdWithAiming w speed strafeSpeed 0 cr
|
||||||
)
|
)
|
||||||
where strafeSpeed = 8 * equipFactor * (fromMaybe 1 $ yourItem w ^? itAimingSpeed)
|
where strafeSpeed = _varMovementStrafeSpeedModifier w * equipFactor * (fromMaybe 1 $ yourItem w ^? itAimingSpeed)
|
||||||
speed = 3 * equipFactor
|
speed = _varMovementSpeedModifier w * equipFactor
|
||||||
equipFactor = product $ map equipSpeed $ IM.elems $ _crInv $ _creatures w IM.! 0
|
equipFactor = product $ map equipSpeed $ IM.elems $ _crInv $ _creatures w IM.! 0
|
||||||
|
|
||||||
wasdWithAiming :: World -> Float -> Float -> Int -> Creature -> Creature
|
wasdWithAiming :: World -> Float -> Float -> Int -> Creature -> Creature
|
||||||
|
|||||||
@@ -88,6 +88,8 @@ data World = World
|
|||||||
, _seenLocations :: IM.IntMap (World -> Point2,String)
|
, _seenLocations :: IM.IntMap (World -> Point2,String)
|
||||||
, _selLocation :: Int
|
, _selLocation :: Int
|
||||||
, _keyConfig :: KeyConfigSDL
|
, _keyConfig :: KeyConfigSDL
|
||||||
|
, _varMovementSpeedModifier :: Float
|
||||||
|
, _varMovementStrafeSpeedModifier :: Float
|
||||||
}
|
}
|
||||||
|
|
||||||
data Corpse = Corpse
|
data Corpse = Corpse
|
||||||
|
|||||||
@@ -232,6 +232,8 @@ defaultWorld = World
|
|||||||
]
|
]
|
||||||
, _selLocation = 0
|
, _selLocation = 0
|
||||||
, _keyConfig = defaultKeyConfigSDL
|
, _keyConfig = defaultKeyConfigSDL
|
||||||
|
, _varMovementSpeedModifier = 3
|
||||||
|
, _varMovementStrafeSpeedModifier = 3
|
||||||
}
|
}
|
||||||
youLight =
|
youLight =
|
||||||
-- LS {_lsEff = \w _ p -> (logistic 1 1 1 (d p w * 0.01) )
|
-- LS {_lsEff = \w _ p -> (logistic 1 1 1 (d p w * 0.01) )
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ handlePressedKey _ scancode w
|
|||||||
-- Rotation seems to be duplicated here and in Camera.hs ? why
|
-- Rotation seems to be duplicated here and in Camera.hs ? why
|
||||||
| scancode == rotateCameraPlusKey (_keyConfig w) = Just $ w {_cameraRot = _cameraRot w + 0.01}
|
| scancode == rotateCameraPlusKey (_keyConfig w) = Just $ w {_cameraRot = _cameraRot w + 0.01}
|
||||||
| scancode == rotateCameraMinusKey (_keyConfig w) = Just $ w {_cameraRot = _cameraRot w - 0.01}
|
| scancode == rotateCameraMinusKey (_keyConfig w) = Just $ w {_cameraRot = _cameraRot w - 0.01}
|
||||||
|
| scancode == ScancodeF7 = Just $ w {_varMovementSpeedModifier = _varMovementSpeedModifier w - 1}
|
||||||
|
| scancode == ScancodeF8 = Just $ w {_varMovementSpeedModifier = _varMovementSpeedModifier w + 1}
|
||||||
handlePressedKey _ _ w = Just w
|
handlePressedKey _ _ w = Just w
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user