more wörk and no pläy
This commit is contained in:
parent
a3d7ba4dd7
commit
3d4e654e66
2 changed files with 27 additions and 18 deletions
13
src/NPC.hs
13
src/NPC.hs
|
@ -117,8 +117,11 @@ updateNPCs imgmat ws rrp dt = do
|
|||
stat <- query anim
|
||||
as <- query npcActionState
|
||||
targetRPs <- case as of
|
||||
ASWork -> (: filter (\p -> pointType p == Copier) rp)
|
||||
<$> query npcWorkplace
|
||||
ASWork ->
|
||||
let fltrd = filter (\p -> pointType p == Copier) rp
|
||||
in
|
||||
((fltrd ++) . replicate (5 * length fltrd)) <$>
|
||||
query npcWorkplace
|
||||
ASToilet -> do
|
||||
let seekRP = filter (\p -> pointType p == Toilet) rp
|
||||
if null seekRP
|
||||
|
@ -225,8 +228,8 @@ updateStats dt =
|
|||
stat
|
||||
{ statAttention =
|
||||
if as == ASWork
|
||||
then max 0 (conc - 0.2 * dt)
|
||||
else min 1 (conc + 0.075 * dt)
|
||||
then max 0 (conc - 0.05 * dt)
|
||||
else min 1 (conc + 0.1 * dt)
|
||||
, statBladder =
|
||||
if food > 0 || drin > 0
|
||||
then min 1 (blad + 0.3 * dt)
|
||||
|
@ -239,7 +242,7 @@ updateStats dt =
|
|||
doCompare ostat nstat as
|
||||
| statAttention nstat == 0 = ASRandWalk
|
||||
| statThirst nstat == 0 = ASDrink
|
||||
| statHunger nstat == 0 = ASDrink -- TODO: Let them eat
|
||||
| statHunger nstat == 0 = ASEat -- TODO: Let them eat
|
||||
| statAttention nstat > statAttention ostat &&
|
||||
statAttention nstat > 0.75 = ASWork
|
||||
| statBladder nstat > 0.9 = ASToilet
|
||||
|
|
|
@ -30,7 +30,7 @@ data Cluster
|
|||
| ClusterConferenceTable
|
||||
| ClusterPlant1
|
||||
| ClusterPlant2
|
||||
| ClusterToilet
|
||||
| ClusterToilets
|
||||
| ClusterWatercooler
|
||||
| ClusterVending
|
||||
| ClusterCabinets
|
||||
|
@ -154,11 +154,13 @@ clusterMatWithRPs ClusterPlant2 dim _ =
|
|||
[ [ Just ImgMiscPlant2 ] ]
|
||||
, clusterPoints ClusterPlant2 dim
|
||||
)
|
||||
clusterMatWithRPs ClusterToilet dim _ =
|
||||
( M.fromLists
|
||||
[ [ Just ImgEmpty, Just ImgEmptyNoWalk] ]
|
||||
, clusterPoints ClusterToilet dim
|
||||
)
|
||||
clusterMatWithRPs ClusterToilets dim@(_, h) _ =
|
||||
let mh = min 3 h
|
||||
in
|
||||
( M.fromLists (replicate mh
|
||||
([ Just ImgEmpty, Just ImgEmptyNoWalk]))
|
||||
, clusterPoints ClusterToilets dim
|
||||
)
|
||||
clusterMatWithRPs ClusterWatercooler dim _ =
|
||||
( M.fromLists
|
||||
[ [ Just ImgMiscWatercooler ]
|
||||
|
@ -221,7 +223,7 @@ clusterMatWithRPs ClusterCabinets (h, w) g =
|
|||
(gf1, Just ImgCabinetSW : lsi, lsr)
|
||||
)
|
||||
(g1, [], [])
|
||||
(reverse [1 .. rh - 1])
|
||||
(reverse [2 .. rh])
|
||||
outmat =
|
||||
(M.fromLists [ses] M.<|> M.fromLists [[ Just ImgCabinetCorner ]])
|
||||
M.<->
|
||||
|
@ -244,7 +246,7 @@ clusterRoom ClusterFlipchart = [Offi]
|
|||
clusterRoom ClusterConferenceTable = [Offi]
|
||||
clusterRoom ClusterPlant1 = [Offi]
|
||||
clusterRoom ClusterPlant2 = [Offi]
|
||||
clusterRoom ClusterToilet = [Toil]
|
||||
clusterRoom ClusterToilets = [Toil]
|
||||
clusterRoom ClusterWatercooler = [Kitc, Offi]
|
||||
clusterRoom ClusterVending = [Kitc]
|
||||
clusterRoom ClusterCabinets = [Kitc]
|
||||
|
@ -270,16 +272,20 @@ clusterPoints ClusterFlipchart _ =
|
|||
[ ReachPoint Table (V2 2 1) NW 0
|
||||
]
|
||||
clusterPoints ClusterConferenceTable (h, w) =
|
||||
let mw = max 4 w
|
||||
mh = max 4 h
|
||||
let iw = max 4 w
|
||||
ih = max 4 h
|
||||
mw = min 7 iw
|
||||
mh = min 7 ih
|
||||
in
|
||||
[ ReachPoint Table (V2 1 c) SE 0 | c <- [2..mw-1] ] ++
|
||||
[ ReachPoint Table (V2 r 1) NE 0 | r <- [2..mh-1] ] ++
|
||||
[ ReachPoint Table (V2 r mw) SW 0 | r <- [2..mh-1] ] ++
|
||||
[ ReachPoint Table (V2 mh c) NW 0 | c <- [2..mw-1] ]
|
||||
clusterPoints ClusterToilet _ =
|
||||
[ ReachPoint Toilet (V2 1 1) NE 0
|
||||
]
|
||||
clusterPoints ClusterToilets (_, h) =
|
||||
let mh = min 3 h
|
||||
in
|
||||
map (\r -> ReachPoint Toilet (V2 r 1) NE 0)
|
||||
[1 .. mh]
|
||||
clusterPoints ClusterWatercooler _ =
|
||||
[ ReachPoint Drink (V2 2 1) NW 0
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue