add vending machine

This commit is contained in:
nek0 2019-01-10 18:31:36 +01:00
parent d107b6f76c
commit c9d1f668cc
6 changed files with 22 additions and 3 deletions

BIN
assets/misc/vending.kra Normal file

Binary file not shown.

BIN
assets/misc/vending.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -63,7 +63,7 @@ loadFork
-> MVar (Float, T.Text)
-> IO ()
loadFork ws win glc nvg future progress = do
let stateSteps = 40
let stateSteps = 41
increment = 1 / stateSteps
SDL.glMakeCurrent win glc
modifyMVar_ progress (return . (\(p, _) ->
@ -206,6 +206,11 @@ loadFork ws win glc nvg future progress = do
, "Loading asset \"watercooler\""
)))
mmiscWatercooler <- createImage nvg (FileName "assets/misc/watercooler.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"vending machine\""
)))
mmiscVending <- createImage nvg (FileName "assets/misc/vending.png") 0
let micons =
[ mcontrblue, mcontrgreen, marrow
]
@ -221,7 +226,7 @@ loadFork ws win glc nvg future progress = do
, mtablec1, mtablec2, mtablec3, mtablec4
, mmiscFlipchart
, mmiscPlant1, mmiscPlant2
, mmiscWatercooler
, mmiscWatercooler, mmiscVending
]
when (any isNothing mimgs) $ do
liftIO $logIO Error "Failed to load image assets"
@ -234,7 +239,7 @@ loadFork ws win glc nvg future progress = do
-- (zipWith (\a b -> (a, [b])) [0..] $ [ImgIntrE .. ImgIntrN] ++ [ImgIntrNE])
let imgs = zipWith (\a b -> (a, fromJust b))
[ ImgWallAsc
.. ImgMiscWatercooler
.. ImgMiscVending
]
mimgs
icons = zipWith (\a b -> (a, fromJust b))

View file

@ -96,6 +96,9 @@ instance Collidible ImgId where
collisionObstacle ImgMiscWatercooler =
[ Boundaries (14/36, 14/36) (22/36, 22/36)
]
collisionObstacle ImgMiscVending =
[ Boundaries (0, 2/36) (24/36, 34/36)
]
collisionObstacle ImgEmptyNoWalk =
[ Boundaries (0, 0) (0.99, 0.99) ]
collisionObstacle _ = []

View file

@ -34,6 +34,7 @@ data ImgId
| ImgMiscPlant1
| ImgMiscPlant2
| ImgMiscWatercooler
| ImgMiscVending
-- | ImgIntrNE
-- | ImgIntrE
-- | ImgIntrSE

View file

@ -27,6 +27,7 @@ data Cluster
| ClusterPlant2
| ClusterToilet
| ClusterWatercooler
| ClusterVending
deriving (Enum, Bounded, Show)
-- row -> NS; col -> WE
@ -112,6 +113,11 @@ clusterMat ClusterWatercooler _ =
[ [ Just ImgMiscWatercooler ]
, [ Just ImgEmpty ]
]
clusterMat ClusterVending _ =
M.fromLists
[ [ Just ImgMiscVending ]
, [ Just ImgEmpty ]
]
clusterRoom :: Cluster -> [TileState]
clusterRoom ClusterBox1 = [Offi]
@ -128,6 +134,7 @@ clusterRoom ClusterPlant1 = [Offi]
clusterRoom ClusterPlant2 = [Offi]
clusterRoom ClusterToilet = [Toil]
clusterRoom ClusterWatercooler = [Kitc, Offi]
clusterRoom ClusterVending = [Kitc]
clusterPoints :: Cluster -> (Int, Int) -> [ReachPoint]
clusterPoints ClusterBox1 _ = []
@ -167,6 +174,9 @@ clusterPoints ClusterToilet _ =
clusterPoints ClusterWatercooler _ =
[ ReachPoint Drink (V2 2 1) NW
]
clusterPoints ClusterVending _ =
[ ReachPoint Eat (V2 2 1) NW
]
clusterPoints _ _ = []
instance Size (Cluster, (Int, Int)) where