Cleanup, improve aiming code
This commit is contained in:
@@ -33,14 +33,12 @@ useItemLoc ::
|
||||
useItemLoc cr loc pt w
|
||||
| HeldPlatformSF <- sf
|
||||
, fromMaybe False $ loc ^? locLDT . ldtValue . _1 . itLocation . ilIsRoot
|
||||
-- , cr ^. crStance . posture == Aiming =
|
||||
, Aiming {} <- cr ^. crStance . posture =
|
||||
return $ heldEffect pt (bimap _iatType (^. _1) ldt) cr w
|
||||
| GadgetPlatformSF <- sf =
|
||||
return $ gadgetEffect pt loc cr w
|
||||
| UnderBarrelPlatformSF <- sf
|
||||
, fromMaybe False $ loc ^? locLDT . ldtValue . _1 . itLocation . ilIsAttached
|
||||
-- , cr ^. crStance . posture == Aiming =
|
||||
, Aiming {} <- cr ^. crStance . posture =
|
||||
return $ heldEffect pt (bimap _iatType (^. _1) ldt) cr w
|
||||
| RemoteDetonatorSF <- sf
|
||||
|
||||
@@ -119,11 +119,11 @@ wasdWithAiming w cr = wasdAim inp cam $ wasdMovement inp cam speed cr
|
||||
|
||||
wasdAim :: Input -> Camera -> Creature -> Creature
|
||||
wasdAim inp cam cr
|
||||
| Just 0 <- inp ^? mouseButtons . ix SDL.ButtonRight =
|
||||
setAimPosture cr
|
||||
| Just 0 <- inp ^? mouseButtonsReleased . ix SDL.ButtonRight =
|
||||
removeAimPosture 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
|
||||
where
|
||||
mouseDir = argV $ mouseWorldPos inp cam - (cr ^. crPos)
|
||||
|
||||
Reference in New Issue
Block a user