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

View file

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

View file

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