Commit before attempting to simplify creature update
This commit is contained in:
@@ -3,13 +3,11 @@
|
||||
-- | Actions performed by creatures within the world
|
||||
module Dodge.Creature.Action (
|
||||
performActions,
|
||||
-- setMinInvSize,
|
||||
dropExcept,
|
||||
dropItem,
|
||||
blinkActionMousePos,
|
||||
blinkActionFail,
|
||||
unsafeBlinkAction,
|
||||
-- sizeSelf,
|
||||
youDropItem,
|
||||
) where
|
||||
|
||||
@@ -25,7 +23,6 @@ import Data.Maybe
|
||||
import Dodge.Base
|
||||
import Dodge.Creature.Action.Blink
|
||||
import Dodge.CreatureEffect
|
||||
--import Dodge.Data.SelectionList
|
||||
import Dodge.Data.World
|
||||
import Dodge.FloatFunction
|
||||
import Dodge.FloorItem
|
||||
@@ -197,7 +194,6 @@ youDropItem w = fromMaybe w $ do
|
||||
curpos <-
|
||||
cr ^? crManipulation . manObject . imSelectedItem . unNInt
|
||||
<|> fmap fst (IM.lookupMax (cr ^. crInv . unNIntMap))
|
||||
--guard $ not $ _crInvLock cr
|
||||
guard $ not $ w ^. cWorld . lWorld . lInvLock
|
||||
return $ case cr ^. crStance . posture of
|
||||
Aiming {} -> throwItem w
|
||||
@@ -209,26 +205,3 @@ youDropItem w = fromMaybe w $ do
|
||||
-- should throw all attached items?
|
||||
throwItem :: World -> World
|
||||
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
|
||||
|
||||
@@ -44,11 +44,11 @@ crMvForward :: Float -> LWorld -> Creature -> Creature
|
||||
crMvForward speed = crMvBy (V2 speed 0)
|
||||
|
||||
advanceStepCounter :: Float -> Creature -> Creature
|
||||
advanceStepCounter speed = crStance . carriage %~ f
|
||||
advanceStepCounter speed cr = cr & crStance . carriage %~ f
|
||||
where
|
||||
f car = case car of
|
||||
Standing -> f (Walking 0 RightForward)
|
||||
Walking i ff -> Walking (i + speed) ff
|
||||
Walking i ff -> Walking (min (cr ^. crStance . strideLength) (i + speed)) ff
|
||||
_ -> car
|
||||
|
||||
creatureTurnTo :: Point2 -> Creature -> Creature
|
||||
|
||||
@@ -12,7 +12,7 @@ updateWalkCycle :: Int -> World -> World
|
||||
updateWalkCycle cid w
|
||||
| Just cr <- w ^? cWorld . lWorld . creatures . ix 0
|
||||
, Walking x ff <- cr ^. crStance . carriage
|
||||
, x > cr ^. crStance . strideLength =
|
||||
, x >= cr ^. crStance . strideLength =
|
||||
w
|
||||
& soundMultiFrom
|
||||
[FootstepSound i | i <- [0 .. 10]]
|
||||
|
||||
@@ -22,10 +22,7 @@ data Stance = Stance
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
data Carriage
|
||||
= Walking
|
||||
{ _strideAmount :: Float
|
||||
, _currentFoot :: FootForward
|
||||
}
|
||||
= Walking { _strideAmount :: Float , _currentFoot :: FootForward }
|
||||
| Standing
|
||||
| Floating
|
||||
| Flying
|
||||
|
||||
Reference in New Issue
Block a user