Zone creatures
This commit is contained in:
+15
-6
@@ -100,7 +100,7 @@ functionalUpdate cfig w = checkEndGame
|
||||
zoneClouds = set (cloudsZone . znObjects) (foldl' (flip cloudInZone) IM.empty (_clouds w))
|
||||
cloudInZone cl = insertInZoneWith x y (++) [cl]
|
||||
where
|
||||
(x,y) = cloudZoneOfPoint $ stripZ $ _clPos cl
|
||||
V2 x y = clZoneOfPoint $ stripZ $ _clPos cl
|
||||
|
||||
updateWorldSelect :: World -> World
|
||||
updateWorldSelect w = case w ^? mouseButtons . ix ButtonLeft of
|
||||
@@ -149,12 +149,21 @@ doRewind w = case _maybeWorld w of
|
||||
zoneCreatures :: World -> World
|
||||
zoneCreatures w = w
|
||||
& creaturesZone . znObjects .~
|
||||
IM.foldl' (flip creatureInZone) IM.empty (_creatures w)
|
||||
runIdentity (S.fold_ zoneCreature IM.empty id (S.each $ _creatures w))
|
||||
|
||||
zoneCreature :: IM.IntMap (IM.IntMap (IM.IntMap Creature))
|
||||
-> Creature
|
||||
-> IM.IntMap (IM.IntMap (IM.IntMap Creature))
|
||||
zoneCreature m cr = runIdentity $ S.fold_ doinsert m id (zoneOfCreature cr)
|
||||
where
|
||||
creatureInZone cr = insertIMInZone x y cid cr
|
||||
where
|
||||
(x,y) = crZoneOfPoint $ _crPos cr
|
||||
cid = _crID cr
|
||||
doinsert m' (V2 x y) = insertIMInZone x y (_crID cr) cr m'
|
||||
|
||||
-- IM.foldl' (flip creatureInZone) IM.empty (_creatures w)
|
||||
-- where
|
||||
-- creatureInZone cr = insertIMInZone x y cid cr
|
||||
-- where
|
||||
-- V2 x y = crZoneOfPoint $ _crPos cr
|
||||
-- cid = _crID cr
|
||||
|
||||
updateCreatureSoundPositions :: World -> World
|
||||
updateCreatureSoundPositions w = M.foldlWithKey' insertSound w
|
||||
|
||||
Reference in New Issue
Block a user