clearance levels now implemented
This commit is contained in:
parent
763d945384
commit
44d0da34ac
2 changed files with 28 additions and 14 deletions
|
@ -437,8 +437,21 @@ assignClearance graph imat =
|
||||||
then do
|
then do
|
||||||
if actualRoomType b imat == Offi
|
if actualRoomType b imat == Offi
|
||||||
then do
|
then do
|
||||||
ret <- doRandomAssign room
|
let neigh = filter (all ((/= Hall) . snd) . neighbs) $
|
||||||
return ret
|
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 return room
|
||||||
else do
|
else do
|
||||||
if actualRoomType b imat == Offi
|
if actualRoomType b imat == Offi
|
||||||
|
@ -449,13 +462,14 @@ assignClearance graph imat =
|
||||||
(\n -> findNeighbor n b imat onlyrooms)
|
(\n -> findNeighbor n b imat onlyrooms)
|
||||||
nonhalls
|
nonhalls
|
||||||
)
|
)
|
||||||
onlyrooms = connects (head acc) ++ tail acc
|
onlyrooms = connects (head acc)
|
||||||
nonhalls = ns -- filter ((/= Hall) . snd) ns
|
nonhalls = ns -- filter ((/= Hall) . snd) ns
|
||||||
ret <- if null neigh
|
ret <- if null neigh
|
||||||
then doRandomAssign room
|
then doRandomAssign room
|
||||||
else doBoundedAssign room (clearance $ head neigh)
|
else doBoundedAssign room (clearance $ head neigh)
|
||||||
return ret
|
return ret
|
||||||
else return room
|
else
|
||||||
|
return room
|
||||||
|
|
||||||
actualRoomType :: Boundaries Int -> M.Matrix TileState -> TileState
|
actualRoomType :: Boundaries Int -> M.Matrix TileState -> TileState
|
||||||
actualRoomType (Boundaries (minrow, mincol) (maxrow, maxcol)) imat =
|
actualRoomType (Boundaries (minrow, mincol) (maxrow, maxcol)) imat =
|
||||||
|
@ -502,7 +516,7 @@ findNeighbor (dir, _) bnds imat ingraph
|
||||||
(inBounds (V2 row col) . bounds)
|
(inBounds (V2 row col) . bounds)
|
||||||
ingraph
|
ingraph
|
||||||
in
|
in
|
||||||
case A.log A.Debug ("filtered: " ++ show filtered) filtered of
|
case filtered of
|
||||||
[a@(GRoom _ _ _ ts)] -> Just a
|
[a@(GRoom _ _ _ ts)] -> Just a
|
||||||
-- if ts == neighTile row col
|
-- if ts == neighTile row col
|
||||||
-- then Just a
|
-- then Just a
|
||||||
|
|
|
@ -237,16 +237,16 @@ loadMapFork ud ad future progress = do
|
||||||
(Types.connects (head gr) ++ tail gr)
|
(Types.connects (head gr) ++ tail gr)
|
||||||
)
|
)
|
||||||
void $ createEntity $ newEntity
|
void $ createEntity $ newEntity
|
||||||
{ pos = Just (fmap ((+ 0.5) . fromIntegral) (pointCoord cpr))
|
{ pos = Just (fmap ((+ 0.5) . fromIntegral) (pointCoord cpr))
|
||||||
, vel = Just (V2 0 0)
|
, vel = Just (V2 0 0)
|
||||||
, velFact = Just fact
|
, velFact = Just fact
|
||||||
, rot = Just SE
|
, rot = Just SE
|
||||||
, npcMoveState = Just (NPCWalking [pointCoord cpr])
|
, npcMoveState = Just (NPCWalking [pointCoord cpr])
|
||||||
, npcWorkplace = Just cpr
|
, npcWorkplace = Just cpr
|
||||||
, npcActionState = Just ASWork
|
, npcActionState = Just ASWork
|
||||||
, npcStats = Just stats
|
, npcStats = Just stats
|
||||||
, npcClearanceLvl = Just (clearance room)
|
, npcClearanceLvl = Just (clearance room)
|
||||||
, anim = Just $ AnimState (AnimId "jdoem" "standing" SE) 0 0
|
, anim = Just $ AnimState (AnimId "jdoem" "standing" SE) 0 0
|
||||||
}
|
}
|
||||||
) computers
|
) computers
|
||||||
liftIO $ modifyMVar_ progress (return . (\(p, _) ->
|
liftIO $ modifyMVar_ progress (return . (\(p, _) ->
|
||||||
|
|
Loading…
Reference in a new issue