clearance levels now implemented

This commit is contained in:
nek0 2019-02-08 23:10:18 +01:00
parent 763d945384
commit 44d0da34ac
2 changed files with 28 additions and 14 deletions

View file

@ -437,8 +437,21 @@ assignClearance graph imat =
then do
if actualRoomType b imat == Offi
then do
ret <- doRandomAssign room
return ret
let neigh = filter (all ((/= Hall) . snd) . neighbs) $
catMaybes
(map
(\n -> findNeighbor n b imat onlyrooms)
nonhalls
)
onlyrooms = tail graph
nonhalls = ns -- filter ((/= Hall) . snd) ns
A.logIO A.Debug ("neighs: " ++ show neigh)
if not (null neigh) && any ((Offi /=) . flip actualRoomType imat . bounds) neigh
then
return room
else do
ret <- doRandomAssign room
return ret
else return room
else do
if actualRoomType b imat == Offi
@ -449,13 +462,14 @@ assignClearance graph imat =
(\n -> findNeighbor n b imat onlyrooms)
nonhalls
)
onlyrooms = connects (head acc) ++ tail acc
onlyrooms = connects (head acc)
nonhalls = ns -- filter ((/= Hall) . snd) ns
ret <- if null neigh
then doRandomAssign room
else doBoundedAssign room (clearance $ head neigh)
return ret
else return room
else
return room
actualRoomType :: Boundaries Int -> M.Matrix TileState -> TileState
actualRoomType (Boundaries (minrow, mincol) (maxrow, maxcol)) imat =
@ -502,7 +516,7 @@ findNeighbor (dir, _) bnds imat ingraph
(inBounds (V2 row col) . bounds)
ingraph
in
case A.log A.Debug ("filtered: " ++ show filtered) filtered of
case filtered of
[a@(GRoom _ _ _ ts)] -> Just a
-- if ts == neighTile row col
-- then Just a

View file

@ -237,16 +237,16 @@ loadMapFork ud ad future progress = do
(Types.connects (head gr) ++ tail gr)
)
void $ createEntity $ newEntity
{ pos = Just (fmap ((+ 0.5) . fromIntegral) (pointCoord cpr))
, vel = Just (V2 0 0)
, velFact = Just fact
, rot = Just SE
, npcMoveState = Just (NPCWalking [pointCoord cpr])
, npcWorkplace = Just cpr
, npcActionState = Just ASWork
, npcStats = Just stats
{ pos = Just (fmap ((+ 0.5) . fromIntegral) (pointCoord cpr))
, vel = Just (V2 0 0)
, velFact = Just fact
, rot = Just SE
, npcMoveState = Just (NPCWalking [pointCoord cpr])
, npcWorkplace = Just cpr
, npcActionState = Just ASWork
, npcStats = Just stats
, npcClearanceLvl = Just (clearance room)
, anim = Just $ AnimState (AnimId "jdoem" "standing" SE) 0 0
, anim = Just $ AnimState (AnimId "jdoem" "standing" SE) 0 0
}
) computers
liftIO $ modifyMVar_ progress (return . (\(p, _) ->