enable collision for doors, but exclude it from pathfinding

This commit is contained in:
Nek0 - 2019-02-15 20:02:34 +01:00
parent a68f4fc7e7
commit 371a54cbd7
3 changed files with 7 additions and 3 deletions

View File

@ -292,9 +292,11 @@ loadMapFork ud ad future progress = do
| head wall == V2 1 0 || head wall == V2 (-1) 0 = NW
| otherwise = error ("strange wall: " ++ show wall)
void $ createEntity $ newEntity
{ pos = Just (fmap ((+ 0.5) . fromIntegral) coord)
, clearanceLvl = Just (maximum $ 0 : Prelude.map clearance (Prelude.map snd rooms))
, anim = Just $ AnimState (AnimId AnimDoor0 "shut" orientation) 0 0
{ pos = Just (fmap ((+ 0.5) . fromIntegral) coord)
, clearanceLvl = Just (maximum $ 0 : Prelude.map clearance (Prelude.map snd rooms))
, anim = Just $ AnimState (AnimId AnimDoor0 "shut" orientation) 0 0
, obstacle = Just $ Boundaries (4/9, 0) (5/9, 1)
, ignoreObstacle = Just ()
}
) doors
liftIO $ modifyMVar_ progress (return . (\(p, _) ->

View File

@ -35,6 +35,7 @@ getPosBounds = do
efor allEnts $ do
with pos
with obstacle
without ignoreObstacle
pos' <- query pos
bnds <- query obstacle
return (pos', bnds)

View File

@ -21,6 +21,7 @@ data Entity f = Entity
, velFact :: Component f 'Field Double
, rot :: Component f 'Field Direction
, obstacle :: Component f 'Field (Boundaries Double)
, ignoreObstacle :: Component f 'Field ()
, player :: Component f 'Unique ()
, npcMoveState :: Component f 'Field NPCMoveState
, npcWorkplace :: Component f 'Field ReachPoint