Test making walking movement slightly more floaty

This commit is contained in:
2026-04-03 19:52:56 +01:00
parent 2b2ac53466
commit 47ecfb7fd3
10 changed files with 35 additions and 45 deletions
+1 -1
View File
@@ -99,7 +99,7 @@ startCr =
& crInv .~ mempty
& crFaction .~ PlayerFaction
-- & crMvType .~ MvWalking yourDefaultSpeed
& crType .~ Avatar (PulseStatus 55 0) Flesh 50 50 50 3 AvPosture LeftForward 0
& crType .~ Avatar (PulseStatus 55 0) Flesh 50 50 50 AvPosture LeftForward 0
-- | Items you start with.
startInvList :: [Item]
+1 -1
View File
@@ -6,7 +6,7 @@ import Control.Lens
crMvType :: Creature -> CrMvType
crMvType cr = case _crType cr of
Avatar {_avMoveSpeed = s} -> MvWalking s
Avatar {} -> MvWalking 1.5
ChaseCrit {} -> defaultChaseMvType
HoverCrit {} -> defaultChaseMvType & mvSpeed .~ 0.1
SwarmCrit -> defaultChaseMvType
+5 -2
View File
@@ -26,7 +26,8 @@ updateCarriage' cid cr w = \case
(chooseFootSound ff)
Nothing
& over (cWorld . lWorld . creatures . ix cid . crType) resetStride
_ -> w
& tocr . crPos +~ 0.1 *^ (cr ^. crOldPos - oop)
_ -> w & tocr . crPos +~ 0.5 *^ (cr ^. crOldPos - oop)
Floating -> w
Flying {_zSpeed = dz, _flyInertia = x} ->
w & cWorld . lWorld . creatures . ix cid . crPos . _xy +~ x *^ f (cr ^. crOldPos . _xy - oop ^. _xy)
@@ -38,11 +39,13 @@ updateCarriage' cid cr w = \case
let v = 0.9 *^ (cr ^. crOldPos - oop & _z -~ 0.5)
ep = cr ^. crPos + v
in if ep ^. _z < 0 && not (any (pointInPoly (ep ^. _xy)) (w ^. cWorld . chasms))
then w & cWorld . lWorld . creatures . ix cid . crPos .~ (ep & _z .~ 0)
then w & tocr . crPos .~ (ep & _z .~ 0)
& cWorld . lWorld . creatures . ix cid . crStance . carriage .~ OnGround
else w & cWorld . lWorld . creatures . ix cid . crPos .~ ep
OnGround {} -> w
& tocr . crPos +~ 0.8 *^ (cr ^. crOldPos - oop)
where
tocr = cWorld . lWorld . creatures . ix cid
oop = cr ^. crOldOldPos
f v | norm v > 10 = 10 *^ signorm v
| otherwise = v
+1 -1
View File
@@ -53,7 +53,7 @@ updateLivingCreature cr =
Avatar{} ->
(cWorld . lWorld . creatures . ix 0 . crType . avatarPulse %~ updatePulse)
. crUpdate cid
. yourControl cr
. yourControl
LampCrit{} -> updateLampoid cr
BarrelCrit bt -> updateBarreloid bt cr
ChaseCrit{} -> \w ->
-11
View File
@@ -3,7 +3,6 @@
module Dodge.Creature.Vocalization (
crWarningSounds,
crDeathSounds,
crVocalizationSound,
resetCrVocCoolDown,
) where
@@ -14,16 +13,6 @@ import Dodge.SoundLogic.ExternallyGeneratedSounds
import Sound.Data
import System.Random
crVocalizationSound :: Creature -> Maybe SoundID
crVocalizationSound cr = case cr ^. crType of
Avatar{} -> Nothing
ChaseCrit{} -> Just seagullChatterS
HoverCrit{} -> Just beep3QuickS
SwarmCrit -> Nothing
AutoCrit -> Nothing
BarrelCrit{} -> Nothing
LampCrit{} -> Nothing
crWarningSounds :: Creature -> [SoundID]
crWarningSounds cr = case cr ^. crType of
Avatar{} -> mempty
+4 -8
View File
@@ -23,16 +23,12 @@ import NewInt
import qualified SDL
-- | The AI equivalent for your control.
yourControl :: Creature -> World -> World
yourControl _ w
yourControl :: World -> World
yourControl w
| inTextInputFocus w = w
| NoSubInventory <- w ^. hud . subInventory =
w
& cWorld
. lWorld
. creatures
. ix 0
%~ wasdWithAiming w
& cWorld . lWorld . creatures . ix 0 %~ wasdWithAiming w
& tryClickUse (w ^. input . mouseButtons)
& handleHotkeys
| otherwise = w & cWorld . lWorld . creatures . ix 0 %~ wasdWithAiming w
@@ -147,7 +143,7 @@ wasdMovement lw inp cam speed = theMovement . setMvAim
movAbs = rotateV (cam ^. camRot) $ normalizeV movDir
theMovement
| movDir == V2 0 0 = id
| otherwise = crMvAbsolute lw (speed *.* movAbs)
| otherwise = crMvAbsolute lw (speed *^ movAbs)
aimTurn :: LWorld -> Float -> Creature -> Creature
aimTurn lw a cr = creatureTurnTowardDir a (x * 0.2) cr
-1
View File
@@ -49,7 +49,6 @@ data CreatureType
, _avStrength :: Int
, _avDexterity :: Int
, _avIntelligence :: Int
, _avMoveSpeed :: Float
, _avPosture :: AvatarPosture
, _footForward :: FootForward
, _strideAmount :: Float
+1 -1
View File
@@ -89,7 +89,7 @@ applySetTerminalString var = case key' of
-- "invcap" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crInvCapacity .~ round (fromJust val')
-- "mass" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crMass .~ fromJust val'
-- "mvspeed" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crMvType . mvSpeed .~ fromJust val'
"mvspeed" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crType . avMoveSpeed .~ fromJust val'
-- "mvspeed" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crType . avMoveSpeed .~ fromJust val'
_ -> showTerminalError ("set " ++ var)
where
(key, val) = getSplitString var
+16 -14
View File
@@ -35,20 +35,22 @@ import Data.Monoid
import RandomHelp
testStringInit :: Universe -> [String]
testStringInit u = u ^.. uvWorld . cWorld . lWorld . creatures . ix 1 . crActionPlan . apStrategy . to show
<> u ^.. uvWorld . cWorld . lWorld . creatures . ix 1 . crActionPlan . apAction . to show
<> u ^.. uvWorld . cWorld . lWorld . creatures . ix 1 . crPerception . cpAttention . to show
<> u ^.. uvWorld . cWorld . lWorld . creatures . ix 1 . crPerception . cpAwareness . to show
<> u ^.. uvWorld . cWorld . lWorld . creatures . ix 1 . crIntention . targetCr . to show
<> u ^.. uvWorld . cWorld . lWorld . creatures . ix 1 . crIntention . mvToPoint . to show
<> u ^.. uvWorld . cWorld . lWorld . creatures . ix 1 . crIntention . viewPoint . to show
-- u = [show p, show op, show oop, show (op - oop), show . norm $ op - oop, show d]
-- where
-- f = fromMaybe 0
-- p = f $ u ^? uvWorld . cWorld . lWorld . creatures . ix 2 . crPos . _xy
-- op = f $ u ^? uvWorld . cWorld . lWorld . creatures . ix 2 . crOldPos . _xy
-- oop = fromMaybe 0 $ u ^? uvWorld . cWorld . lWorld . creatures . ix 2 . crStance . carriage . oldOldPos
-- d = fromMaybe 0 $ u ^? uvWorld . cWorld . lWorld . creatures . ix 2 . crDir
testStringInit u = [show p, show op, show oop, show (op - oop), show . norm $ op - oop, show d]
<> u ^.. tocr . crStance . carriage . to show
where
tocr = uvWorld . cWorld . lWorld . creatures . ix 0
f = fromMaybe 0
p = f $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crPos
op = f $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crOldPos
oop = fromMaybe 0 $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crOldOldPos
d = fromMaybe 0 $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crDir
-- u ^.. uvWorld . cWorld . lWorld . creatures . ix 1 . crActionPlan . apStrategy . to show
-- <> u ^.. uvWorld . cWorld . lWorld . creatures . ix 1 . crActionPlan . apAction . to show
-- <> u ^.. uvWorld . cWorld . lWorld . creatures . ix 1 . crPerception . cpAttention . to show
-- <> u ^.. uvWorld . cWorld . lWorld . creatures . ix 1 . crPerception . cpAwareness . to show
-- <> u ^.. uvWorld . cWorld . lWorld . creatures . ix 1 . crIntention . targetCr . to show
-- <> u ^.. uvWorld . cWorld . lWorld . creatures . ix 1 . crIntention . mvToPoint . to show
-- <> u ^.. uvWorld . cWorld . lWorld . creatures . ix 1 . crIntention . viewPoint . to show
-- fmap show (u ^.. uvWorld . cWorld . lWorld . creatures . ix 0 . crWallTouch . each)
-- (fmap show $ u ^.. uvWorld . cWorld . lWorld . creatures . each . crStance . carriage)
-- (fmap show $ u ^.. uvWorld . cWorld . lWorld . creatures . each . crStance . carriage . strideAmount)