Remove aimParam records
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
|
||||
module Dodge.Creature.YourControl (
|
||||
yourControl,
|
||||
) where
|
||||
|
||||
import Dodge.Data.AimStance
|
||||
import Dodge.Item.AimStance
|
||||
import Control.Monad
|
||||
import qualified Data.Map.Strict as M
|
||||
import Data.Maybe
|
||||
import Dodge.Creature.Impulse.Movement
|
||||
import Dodge.Creature.Impulse.UseItem
|
||||
import Dodge.Data.AimStance
|
||||
import Dodge.Data.World
|
||||
import Dodge.Hotkey
|
||||
import Dodge.InputFocus
|
||||
import Dodge.Inventory
|
||||
import Dodge.Item.AimStance
|
||||
import Dodge.SelectedClose
|
||||
import Dodge.WASD
|
||||
import Geometry
|
||||
@@ -41,7 +43,7 @@ yourControl _ w
|
||||
handleHotkeys :: World -> World
|
||||
handleHotkeys w
|
||||
| ispressed SDL.ScancodeLShift || ispressed SDL.ScancodeRShift
|
||||
, Just hk <-
|
||||
, Just hk <-
|
||||
listToMaybe . mapMaybe scancodeToHotkey . M.keys $ w ^. input . pressedKeys
|
||||
, Just invid <- lw ^? creatures . ix 0 . crManipulation . manObject . imSelectedItem
|
||||
, Just itid <- lw ^? creatures . ix 0 . crInv . ix invid . itID =
|
||||
@@ -121,9 +123,9 @@ wasdWithAiming w cr = wasdAim inp w $ wasdMovement inp cam speed cr
|
||||
|
||||
wasdAim :: Input -> World -> Creature -> Creature
|
||||
wasdAim inp w cr
|
||||
| Just 0 <- inp ^? mouseButtons . ix SDL.ButtonRight
|
||||
, Nothing <- inp ^? mouseButtons . ix SDL.ButtonLeft
|
||||
= setAimPosture cr
|
||||
| Just 0 <- inp ^? mouseButtons . ix SDL.ButtonRight
|
||||
, Nothing <- inp ^? mouseButtons . ix SDL.ButtonLeft =
|
||||
setAimPosture cr
|
||||
| SDL.ButtonRight `M.member` _mouseButtons inp = aimTurn mousedir cr
|
||||
| Aiming <- cr ^. crStance . posture = removeAimPosture cr
|
||||
| otherwise = creatureTurnTowardDir (_crMvAim cr) 0.2 cr
|
||||
@@ -163,7 +165,56 @@ aimTurn a cr = creatureTurnTowardDir a (x * 0.2) cr
|
||||
where
|
||||
x = fromMaybe 1 $ do
|
||||
itRef <- cr ^? crManipulation . manObject . imRootSelectedItem
|
||||
cr ^? crInv . ix itRef . itUse . heldAim . aimTurnSpeed
|
||||
fmap itemBulkiness $ cr ^? crInv . ix itRef . itType
|
||||
|
||||
itemBulkiness :: ItemType -> Float
|
||||
itemBulkiness = \case
|
||||
HELD hit -> heldItemBulkiness hit
|
||||
_ -> 1
|
||||
|
||||
heldItemBulkiness :: HeldItemType -> Float
|
||||
heldItemBulkiness = \case
|
||||
BANGSTICK{} -> 1
|
||||
REWINDER -> 1
|
||||
TIMESTOPPER -> 1
|
||||
TIMESCROLLER -> 1
|
||||
PISTOL -> 1
|
||||
MACHINEPISTOL -> 1
|
||||
AUTOPISTOL -> 1
|
||||
SMG -> 1
|
||||
BANGCONE -> 1
|
||||
BLUNDERBUSS -> 1
|
||||
GRAPECANNON{} -> 1
|
||||
MINIGUNX{} -> 0.5
|
||||
VOLLEYGUN{} -> 1
|
||||
RIFLE -> 1
|
||||
ALTERIFLE -> 1
|
||||
AUTORIFLE -> 1
|
||||
BURSTRIFLE -> 1
|
||||
BANGROD -> 1
|
||||
ELEPHANTGUN -> 1
|
||||
AMR -> 1
|
||||
AUTOAMR -> 1
|
||||
SNIPERRIFLE -> 1
|
||||
FLAMESPITTER -> 1
|
||||
FLAMETHROWER -> 1
|
||||
FLAMETORRENT -> 1
|
||||
FLAMEWALL -> 1
|
||||
BLOWTORCH -> 1
|
||||
SPARKGUN -> 1
|
||||
TESLAGUN -> 1
|
||||
LASER -> 1
|
||||
TRACTORGUN -> 1
|
||||
RLAUNCHER -> 0.9
|
||||
RLAUNCHERX{} -> 0.9
|
||||
GLAUNCHER -> 1
|
||||
POISONSPRAYER -> 1
|
||||
SHATTERGUN -> 1
|
||||
TORCH -> 1
|
||||
FLATSHIELD -> 0.5
|
||||
KEYCARD{} -> 1
|
||||
BLINKER -> 1
|
||||
BLINKERUNSAFE -> 1
|
||||
|
||||
tryClickUse :: M.Map SDL.MouseButton Int -> World -> World
|
||||
tryClickUse pkeys w = fromMaybe w $ do
|
||||
|
||||
Reference in New Issue
Block a user