Add in "linear" lWorld to separate time reversable worlds
This commit is contained in:
@@ -57,7 +57,7 @@ performAimAt cr w tcid p = ([TurnToward tpos aimSp], Just $ AimAt tcid tpos)
|
||||
Just f -> doFloatFloat f $ safeAngleVV (unitVectorAtAngle cdir) (tpos - cpos)
|
||||
Nothing -> error "creature without aiming type"
|
||||
tpos
|
||||
| canSee' = _crPos (_creatures (_cWorld w) IM.! tcid)
|
||||
| canSee' = w ^?! cWorld . lWorld . creatures . ix tcid . crPos
|
||||
| otherwise = p
|
||||
|
||||
performPathTo :: Creature -> World -> Point2 -> OutAction
|
||||
@@ -146,23 +146,23 @@ performAction cr w ac = case ac of
|
||||
|
||||
|
||||
setMinInvSize :: Int -> Creature -> World -> World
|
||||
setMinInvSize n cr = cWorld . creatures . ix (_crID cr) . crInvCapacity .~ n
|
||||
setMinInvSize n cr = cWorld . lWorld . creatures . ix (_crID cr) . crInvCapacity .~ n
|
||||
|
||||
-- maybe this should be removed...
|
||||
stripNoItems :: Creature -> World -> World
|
||||
stripNoItems cr =
|
||||
organiseInvKeys (_crID cr)
|
||||
. (cWorld . creatures . ix (_crID cr) . crInv %~ IM.mapMaybe Just)
|
||||
. (cWorld . lWorld . creatures . ix (_crID cr) . crInv %~ IM.mapMaybe Just)
|
||||
|
||||
organiseInvKeys :: Int -> World -> World
|
||||
organiseInvKeys cid w =
|
||||
w & cWorld . creatures . ix cid
|
||||
w & cWorld . lWorld . creatures . ix cid
|
||||
%~ ( (crInvSel . iselPos .~ newSelKey)
|
||||
. (crInv .~ newInv)
|
||||
. (crInvSel . iselAction .~ NoInvSelAction)
|
||||
)
|
||||
where
|
||||
cr = _creatures (_cWorld w) IM.! cid
|
||||
cr = w ^?! cWorld . lWorld . creatures . ix cid-- _creatures (_cWorld w) IM.! cid
|
||||
pairs = IM.toList (_crInv cr)
|
||||
newSelKey = fromMaybe 0 $ findIndex ((== crSel cr) . fst) pairs
|
||||
newInv = IM.fromAscList $ zip [0 ..] $ map snd pairs
|
||||
@@ -216,8 +216,8 @@ sizeSelf x cr w
|
||||
Just $
|
||||
w
|
||||
& soundMultiFrom [TeleSound 0, TeleSound 1] cpos teleS Nothing
|
||||
& cWorld . distortions .:~ distortionBulge
|
||||
& cWorld . creatures . ix cid
|
||||
& cWorld . lWorld . distortions .:~ distortionBulge
|
||||
& cWorld . lWorld . creatures . ix cid
|
||||
%~ ( (crRad .~ 10 * x)
|
||||
. (crMvType . mvSpeed .~ yourDefaultSpeed * x)
|
||||
. (crStance . strideLength .~ ceiling (fromIntegral yourDefaultStrideLength * x))
|
||||
@@ -234,7 +234,7 @@ sizeSelf x cr w
|
||||
cpos = _crPos cr
|
||||
|
||||
pickUpItemID :: Int -> Int -> World -> World
|
||||
pickUpItemID cid flid w = pickUpItem cid (_floorItems (_cWorld w) IM.! flid) w
|
||||
pickUpItemID cid flid w = pickUpItem cid (w ^?! cWorld . lWorld . floorItems . ix flid) w
|
||||
|
||||
-- | Pick up a specific item.
|
||||
pickUpItem :: Int -> FloorItem -> World -> World
|
||||
|
||||
Reference in New Issue
Block a user