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) -> MVar (Float, T.Text)
-> IO () -> IO ()
loadFork ws win glc nvg future progress = do loadFork ws win glc nvg future progress = do
let stateSteps = 40 let stateSteps = 41
increment = 1 / stateSteps increment = 1 / stateSteps
SDL.glMakeCurrent win glc SDL.glMakeCurrent win glc
modifyMVar_ progress (return . (\(p, _) -> modifyMVar_ progress (return . (\(p, _) ->
@ -206,6 +206,11 @@ loadFork ws win glc nvg future progress = do
, "Loading asset \"watercooler\"" , "Loading asset \"watercooler\""
))) )))
mmiscWatercooler <- createImage nvg (FileName "assets/misc/watercooler.png") 0 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 = let micons =
[ mcontrblue, mcontrgreen, marrow [ mcontrblue, mcontrgreen, marrow
] ]
@ -221,7 +226,7 @@ loadFork ws win glc nvg future progress = do
, mtablec1, mtablec2, mtablec3, mtablec4 , mtablec1, mtablec2, mtablec3, mtablec4
, mmiscFlipchart , mmiscFlipchart
, mmiscPlant1, mmiscPlant2 , mmiscPlant1, mmiscPlant2
, mmiscWatercooler , mmiscWatercooler, mmiscVending
] ]
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"
@ -234,7 +239,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
.. ImgMiscWatercooler .. ImgMiscVending
] ]
mimgs mimgs
icons = zipWith (\a b -> (a, fromJust b)) icons = zipWith (\a b -> (a, fromJust b))

View file

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

View file

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

View file

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