Commit before attempting to simplify creature update

This commit is contained in:
2025-10-17 10:36:19 +01:00
parent c533e88d24
commit f969056912
4 changed files with 4 additions and 34 deletions
-27
View File
@@ -3,13 +3,11 @@
-- | Actions performed by creatures within the world -- | Actions performed by creatures within the world
module Dodge.Creature.Action ( module Dodge.Creature.Action (
performActions, performActions,
-- setMinInvSize,
dropExcept, dropExcept,
dropItem, dropItem,
blinkActionMousePos, blinkActionMousePos,
blinkActionFail, blinkActionFail,
unsafeBlinkAction, unsafeBlinkAction,
-- sizeSelf,
youDropItem, youDropItem,
) where ) where
@@ -25,7 +23,6 @@ import Data.Maybe
import Dodge.Base import Dodge.Base
import Dodge.Creature.Action.Blink import Dodge.Creature.Action.Blink
import Dodge.CreatureEffect import Dodge.CreatureEffect
--import Dodge.Data.SelectionList
import Dodge.Data.World import Dodge.Data.World
import Dodge.FloatFunction import Dodge.FloatFunction
import Dodge.FloorItem import Dodge.FloorItem
@@ -197,7 +194,6 @@ youDropItem w = fromMaybe w $ do
curpos <- curpos <-
cr ^? crManipulation . manObject . imSelectedItem . unNInt cr ^? crManipulation . manObject . imSelectedItem . unNInt
<|> fmap fst (IM.lookupMax (cr ^. crInv . unNIntMap)) <|> fmap fst (IM.lookupMax (cr ^. crInv . unNIntMap))
--guard $ not $ _crInvLock cr
guard $ not $ w ^. cWorld . lWorld . lInvLock guard $ not $ w ^. cWorld . lWorld . lInvLock
return $ case cr ^. crStance . posture of return $ case cr ^. crStance . posture of
Aiming {} -> throwItem w Aiming {} -> throwItem w
@@ -209,26 +205,3 @@ youDropItem w = fromMaybe w $ do
-- should throw all attached items? -- should throw all attached items?
throwItem :: World -> World throwItem :: World -> World
throwItem = id throwItem = id
--sizeSelf :: Float -> Creature -> World -> Maybe World
--sizeSelf x cr w
-- | not (crOnWall cr1 w) =
-- Just $
-- w
-- & soundMultiFrom [TeleSound 0, TeleSound 1] cpos teleS Nothing
-- & cWorld . lWorld . distortions .:~ distortionBulge
-- & cWorld . lWorld . creatures . ix cid
-- %~ ( (crRad .~ 10 * x)
-- . (crMvType . mvSpeed .~ yourDefaultSpeed * x)
-- . (crStance . strideLength .~ ceiling (fromIntegral yourDefaultStrideLength * x))
-- )
-- | otherwise = Nothing
-- where
-- cr1 = colCrWall w (cr{_crRad = 10 * x})
-- distR = 120
-- distortionBulge
-- | _crRad cr < 10 * x = raddist 1.9
-- | otherwise = raddist 0.1
-- raddist = RadialDistortion cpos (cpos +.+ V2 distR 0) (cpos +.+ V2 0 distR)
-- cid = _crID cr
-- cpos = _crPos cr
+2 -2
View File
@@ -44,11 +44,11 @@ crMvForward :: Float -> LWorld -> Creature -> Creature
crMvForward speed = crMvBy (V2 speed 0) crMvForward speed = crMvBy (V2 speed 0)
advanceStepCounter :: Float -> Creature -> Creature advanceStepCounter :: Float -> Creature -> Creature
advanceStepCounter speed = crStance . carriage %~ f advanceStepCounter speed cr = cr & crStance . carriage %~ f
where where
f car = case car of f car = case car of
Standing -> f (Walking 0 RightForward) Standing -> f (Walking 0 RightForward)
Walking i ff -> Walking (i + speed) ff Walking i ff -> Walking (min (cr ^. crStance . strideLength) (i + speed)) ff
_ -> car _ -> car
creatureTurnTo :: Point2 -> Creature -> Creature creatureTurnTo :: Point2 -> Creature -> Creature
+1 -1
View File
@@ -12,7 +12,7 @@ updateWalkCycle :: Int -> World -> World
updateWalkCycle cid w updateWalkCycle cid w
| Just cr <- w ^? cWorld . lWorld . creatures . ix 0 | Just cr <- w ^? cWorld . lWorld . creatures . ix 0
, Walking x ff <- cr ^. crStance . carriage , Walking x ff <- cr ^. crStance . carriage
, x > cr ^. crStance . strideLength = , x >= cr ^. crStance . strideLength =
w w
& soundMultiFrom & soundMultiFrom
[FootstepSound i | i <- [0 .. 10]] [FootstepSound i | i <- [0 .. 10]]
+1 -4
View File
@@ -22,10 +22,7 @@ data Stance = Stance
deriving (Eq, Ord, Show, Read) --Generic, Flat) deriving (Eq, Ord, Show, Read) --Generic, Flat)
data Carriage data Carriage
= Walking = Walking { _strideAmount :: Float , _currentFoot :: FootForward }
{ _strideAmount :: Float
, _currentFoot :: FootForward
}
| Standing | Standing
| Floating | Floating
| Flying | Flying