From 3d4e654e66e16bb67712580a4f8ec9de0251f8a4 Mon Sep 17 00:00:00 2001 From: nek0 Date: Thu, 14 Feb 2019 00:20:26 +0100 Subject: [PATCH] =?UTF-8?q?more=20w=C3=B6rk=20and=20no=20pl=C3=A4y?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/NPC.hs | 13 ++++++++----- src/Types/Interior.hs | 32 +++++++++++++++++++------------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/NPC.hs b/src/NPC.hs index e48caa5..daef8da 100644 --- a/src/NPC.hs +++ b/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 diff --git a/src/Types/Interior.hs b/src/Types/Interior.hs index d0b3d8f..d5dfb32 100644 --- a/src/Types/Interior.hs +++ b/src/Types/Interior.hs @@ -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 ]