diff --git a/src/MainGame/WorldMap.hs b/src/MainGame/WorldMap.hs index 750b12c..f2670a7 100644 --- a/src/MainGame/WorldMap.hs +++ b/src/MainGame/WorldMap.hs @@ -348,7 +348,7 @@ drawMap = do _ -> do dt <- getDelta (_, (playerPos, posanims, posActions)) <- yieldSystemT (worldState ud) $ do - pc <- fmap head $ efor allEnts $ do + [pc] <- efor allEnts $ do with player with pos query pos @@ -407,7 +407,7 @@ drawMap = do let delimiter (V2 nr nc, _, _) = floor nr == r && floor nc == c in L.partition delimiter list - liftIO $ do -- draw floor + liftIO $ do beginPath ctx moveTo ctx (x + realToFrac tileWidth / 2) y lineTo ctx diff --git a/src/NPC.hs b/src/NPC.hs index b482d2d..e9197c5 100644 --- a/src/NPC.hs +++ b/src/NPC.hs @@ -234,7 +234,7 @@ updateStats dt = where doUpdate stat@(NPCStats conc blad thir hung food drin) as = stat - { statConcentration = + { statAttention = if as == ASWork then max 0 (conc - 0.2 * dt) else min 1 (conc + 0.075 * dt) @@ -248,11 +248,11 @@ updateStats dt = , statDrink = max 0 (drin - 0.2 * dt) } doCompare ostat nstat as - | statConcentration nstat == 0 = ASRandWalk + | statAttention nstat == 0 = ASRandWalk | statThirst nstat == 0 = ASDrink | statHunger nstat == 0 = ASDrink -- TODO: Let them eat - | statConcentration nstat > statConcentration ostat && - statConcentration nstat > 0.75 = ASWork + | statAttention nstat > statAttention ostat && + statAttention nstat > 0.75 = ASWork | statBladder nstat > 0.9 = ASToilet | otherwise = as diff --git a/src/Types/NPCState.hs b/src/Types/NPCState.hs index 4c29473..314b1fb 100644 --- a/src/Types/NPCState.hs +++ b/src/Types/NPCState.hs @@ -21,10 +21,10 @@ data NPCActionState deriving (Eq) data NPCStats = NPCStats - { statConcentration :: Double - , statBladder :: Double - , statThirst :: Double - , statHunger :: Double - , statFood :: Double - , statDrink :: Double + { statAttention :: Double + , statBladder :: Double + , statThirst :: Double + , statHunger :: Double + , statFood :: Double + , statDrink :: Double }