new: coffee machine and cabinet

This commit is contained in:
nek0 2019-01-14 04:00:34 +01:00
parent 33ff018294
commit da3b7a2b76
8 changed files with 26 additions and 2 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

View file

@ -63,7 +63,7 @@ loadFork
-> MVar (Float, T.Text) -> MVar (Float, T.Text)
-> IO () -> IO ()
loadFork ws win glc nvg future progress = do loadFork ws win glc nvg future progress = do
let stateSteps = 41 let stateSteps = 43
increment = 1 / stateSteps increment = 1 / stateSteps
SDL.glMakeCurrent win glc SDL.glMakeCurrent win glc
modifyMVar_ progress (return . (\(p, _) -> modifyMVar_ progress (return . (\(p, _) ->
@ -211,6 +211,16 @@ loadFork ws win glc nvg future progress = do
, "Loading asset \"vending machine\"" , "Loading asset \"vending machine\""
))) )))
mmiscVending <- createImage nvg (FileName "assets/misc/vending.png") 0 mmiscVending <- createImage nvg (FileName "assets/misc/vending.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"Cabinet with Coffee machine\""
)))
mmiscCabCoffee <- createImage nvg (FileName "assets/cabinet/cabCoffeeSW.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"cabinet SW\""
)))
mmiscCabinetSW <- createImage nvg (FileName "assets/cabinet/cabinetSW.png") 0
let micons = let micons =
[ mcontrblue, mcontrgreen, marrow [ mcontrblue, mcontrgreen, marrow
] ]
@ -227,6 +237,7 @@ loadFork ws win glc nvg future progress = do
, mmiscFlipchart , mmiscFlipchart
, mmiscPlant1, mmiscPlant2 , mmiscPlant1, mmiscPlant2
, mmiscWatercooler, mmiscVending , mmiscWatercooler, mmiscVending
, mmiscCabCoffee, mmiscCabinetSW
] ]
when (any isNothing mimgs) $ do when (any isNothing mimgs) $ do
liftIO $logIO Error "Failed to load image assets" liftIO $logIO Error "Failed to load image assets"
@ -239,7 +250,7 @@ loadFork ws win glc nvg future progress = do
-- (zipWith (\a b -> (a, [b])) [0..] $ [ImgIntrE .. ImgIntrN] ++ [ImgIntrNE]) -- (zipWith (\a b -> (a, [b])) [0..] $ [ImgIntrE .. ImgIntrN] ++ [ImgIntrNE])
let imgs = zipWith (\a b -> (a, fromJust b)) let imgs = zipWith (\a b -> (a, fromJust b))
[ ImgWallAsc [ ImgWallAsc
.. ImgMiscVending .. ImgCabinetSW
] ]
mimgs mimgs
icons = zipWith (\a b -> (a, fromJust b)) icons = zipWith (\a b -> (a, fromJust b))

View file

@ -99,6 +99,8 @@ instance Collidible ImgId where
collisionObstacle ImgMiscVending = collisionObstacle ImgMiscVending =
[ Boundaries (0, 2/36) (24/36, 34/36) [ Boundaries (0, 2/36) (24/36, 34/36)
] ]
collisionObstacle ImgCabinetCoffee = collisionObstacle ImgTableSW
collisionObstacle ImgCabinetSW = collisionObstacle ImgTableSW
collisionObstacle ImgEmptyNoWalk = collisionObstacle ImgEmptyNoWalk =
[ Boundaries (0, 0) (0.99, 0.99) ] [ Boundaries (0, 0) (0.99, 0.99) ]
collisionObstacle _ = [] collisionObstacle _ = []

View file

@ -35,6 +35,8 @@ data ImgId
| ImgMiscPlant2 | ImgMiscPlant2
| ImgMiscWatercooler | ImgMiscWatercooler
| ImgMiscVending | ImgMiscVending
| ImgCabinetCoffee
| ImgCabinetSW
-- | ImgIntrNE -- | ImgIntrNE
-- | ImgIntrE -- | ImgIntrE
-- | ImgIntrSE -- | ImgIntrSE

View file

@ -28,6 +28,7 @@ data Cluster
| ClusterToilet | ClusterToilet
| ClusterWatercooler | ClusterWatercooler
| ClusterVending | ClusterVending
| ClusterCabCoffee
deriving (Enum, Bounded, Show) deriving (Enum, Bounded, Show)
-- row -> NS; col -> WE -- row -> NS; col -> WE
@ -118,6 +119,10 @@ clusterMat ClusterVending _ =
[ [ Just ImgMiscVending ] [ [ Just ImgMiscVending ]
, [ Just ImgEmpty ] , [ Just ImgEmpty ]
] ]
clusterMat ClusterCabCoffee _ =
M.fromLists
[ [ Just ImgEmpty, Just ImgCabinetCoffee ]
]
clusterRoom :: Cluster -> [TileState] clusterRoom :: Cluster -> [TileState]
clusterRoom ClusterBox1 = [Offi] clusterRoom ClusterBox1 = [Offi]
@ -135,6 +140,7 @@ clusterRoom ClusterPlant2 = [Offi]
clusterRoom ClusterToilet = [Toil] clusterRoom ClusterToilet = [Toil]
clusterRoom ClusterWatercooler = [Kitc, Offi] clusterRoom ClusterWatercooler = [Kitc, Offi]
clusterRoom ClusterVending = [Kitc] clusterRoom ClusterVending = [Kitc]
clusterRoom ClusterCabCoffee = [Kitc]
clusterPoints :: Cluster -> (Int, Int) -> [ReachPoint] clusterPoints :: Cluster -> (Int, Int) -> [ReachPoint]
clusterPoints ClusterBox1 _ = [] clusterPoints ClusterBox1 _ = []
@ -177,6 +183,9 @@ clusterPoints ClusterWatercooler _ =
clusterPoints ClusterVending _ = clusterPoints ClusterVending _ =
[ ReachPoint Eat (V2 2 1) NW [ ReachPoint Eat (V2 2 1) NW
] ]
clusterPoints ClusterCabCoffee _ =
[ ReachPoint Drink (V2 1 1) NE
]
clusterPoints _ _ = [] clusterPoints _ _ = []
instance Size (Cluster, (Int, Int)) where instance Size (Cluster, (Int, Int)) where