more wörk and no pläy

This commit is contained in:
Nek0 - 2019-02-14 00:20:26 +01:00
parent a3d7ba4dd7
commit 3d4e654e66
2 changed files with 27 additions and 18 deletions

View File

@ -117,8 +117,11 @@ updateNPCs imgmat ws rrp dt = do
stat <- query anim stat <- query anim
as <- query npcActionState as <- query npcActionState
targetRPs <- case as of targetRPs <- case as of
ASWork -> (: filter (\p -> pointType p == Copier) rp) ASWork ->
<$> query npcWorkplace let fltrd = filter (\p -> pointType p == Copier) rp
in
((fltrd ++) . replicate (5 * length fltrd)) <$>
query npcWorkplace
ASToilet -> do ASToilet -> do
let seekRP = filter (\p -> pointType p == Toilet) rp let seekRP = filter (\p -> pointType p == Toilet) rp
if null seekRP if null seekRP
@ -225,8 +228,8 @@ updateStats dt =
stat stat
{ statAttention = { statAttention =
if as == ASWork if as == ASWork
then max 0 (conc - 0.2 * dt) then max 0 (conc - 0.05 * dt)
else min 1 (conc + 0.075 * dt) else min 1 (conc + 0.1 * dt)
, statBladder = , statBladder =
if food > 0 || drin > 0 if food > 0 || drin > 0
then min 1 (blad + 0.3 * dt) then min 1 (blad + 0.3 * dt)
@ -239,7 +242,7 @@ updateStats dt =
doCompare ostat nstat as doCompare ostat nstat as
| statAttention nstat == 0 = ASRandWalk | statAttention nstat == 0 = ASRandWalk
| statThirst nstat == 0 = ASDrink | 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 > statAttention ostat &&
statAttention nstat > 0.75 = ASWork statAttention nstat > 0.75 = ASWork
| statBladder nstat > 0.9 = ASToilet | statBladder nstat > 0.9 = ASToilet

View File

@ -30,7 +30,7 @@ data Cluster
| ClusterConferenceTable | ClusterConferenceTable
| ClusterPlant1 | ClusterPlant1
| ClusterPlant2 | ClusterPlant2
| ClusterToilet | ClusterToilets
| ClusterWatercooler | ClusterWatercooler
| ClusterVending | ClusterVending
| ClusterCabinets | ClusterCabinets
@ -154,11 +154,13 @@ clusterMatWithRPs ClusterPlant2 dim _ =
[ [ Just ImgMiscPlant2 ] ] [ [ Just ImgMiscPlant2 ] ]
, clusterPoints ClusterPlant2 dim , clusterPoints ClusterPlant2 dim
) )
clusterMatWithRPs ClusterToilet dim _ = clusterMatWithRPs ClusterToilets dim@(_, h) _ =
( M.fromLists let mh = min 3 h
[ [ Just ImgEmpty, Just ImgEmptyNoWalk] ] in
, clusterPoints ClusterToilet dim ( M.fromLists (replicate mh
) ([ Just ImgEmpty, Just ImgEmptyNoWalk]))
, clusterPoints ClusterToilets dim
)
clusterMatWithRPs ClusterWatercooler dim _ = clusterMatWithRPs ClusterWatercooler dim _ =
( M.fromLists ( M.fromLists
[ [ Just ImgMiscWatercooler ] [ [ Just ImgMiscWatercooler ]
@ -221,7 +223,7 @@ clusterMatWithRPs ClusterCabinets (h, w) g =
(gf1, Just ImgCabinetSW : lsi, lsr) (gf1, Just ImgCabinetSW : lsi, lsr)
) )
(g1, [], []) (g1, [], [])
(reverse [1 .. rh - 1]) (reverse [2 .. rh])
outmat = outmat =
(M.fromLists [ses] M.<|> M.fromLists [[ Just ImgCabinetCorner ]]) (M.fromLists [ses] M.<|> M.fromLists [[ Just ImgCabinetCorner ]])
M.<-> M.<->
@ -244,7 +246,7 @@ clusterRoom ClusterFlipchart = [Offi]
clusterRoom ClusterConferenceTable = [Offi] clusterRoom ClusterConferenceTable = [Offi]
clusterRoom ClusterPlant1 = [Offi] clusterRoom ClusterPlant1 = [Offi]
clusterRoom ClusterPlant2 = [Offi] clusterRoom ClusterPlant2 = [Offi]
clusterRoom ClusterToilet = [Toil] clusterRoom ClusterToilets = [Toil]
clusterRoom ClusterWatercooler = [Kitc, Offi] clusterRoom ClusterWatercooler = [Kitc, Offi]
clusterRoom ClusterVending = [Kitc] clusterRoom ClusterVending = [Kitc]
clusterRoom ClusterCabinets = [Kitc] clusterRoom ClusterCabinets = [Kitc]
@ -270,16 +272,20 @@ clusterPoints ClusterFlipchart _ =
[ ReachPoint Table (V2 2 1) NW 0 [ ReachPoint Table (V2 2 1) NW 0
] ]
clusterPoints ClusterConferenceTable (h, w) = clusterPoints ClusterConferenceTable (h, w) =
let mw = max 4 w let iw = max 4 w
mh = max 4 h ih = max 4 h
mw = min 7 iw
mh = min 7 ih
in in
[ ReachPoint Table (V2 1 c) SE 0 | c <- [2..mw-1] ] ++ [ 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 1) NE 0 | r <- [2..mh-1] ] ++
[ ReachPoint Table (V2 r mw) SW 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] ] [ ReachPoint Table (V2 mh c) NW 0 | c <- [2..mw-1] ]
clusterPoints ClusterToilet _ = clusterPoints ClusterToilets (_, h) =
[ ReachPoint Toilet (V2 1 1) NE 0 let mh = min 3 h
] in
map (\r -> ReachPoint Toilet (V2 r 1) NE 0)
[1 .. mh]
clusterPoints ClusterWatercooler _ = clusterPoints ClusterWatercooler _ =
[ ReachPoint Drink (V2 2 1) NW 0 [ ReachPoint Drink (V2 2 1) NW 0
] ]