new computers

This commit is contained in:
nek0 2019-02-09 15:19:16 +01:00
parent e5a519495d
commit 78b4ef0eeb
6 changed files with 66 additions and 21 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -346,31 +346,58 @@ loadFork ws win glc nvg future progress = do
] ]
modifyMVar_ progress (return . (\(p, _) -> modifyMVar_ progress (return . (\(p, _) ->
( p + increment ( p + increment
, "Loading Animation \"computer: off\"" , "Loading Animation \"cornerComputer: off\""
))) )))
computerOff <- loadAnimationSprites "assets/misc/tableCornerComputer.png" nvg cornerComputerOff <- loadAnimationSprites "assets/misc/tableCornerComputer.png" nvg
[ ( AnimId "computer" "off" N [ ( AnimId "computer" "off" N
, AnimationConfig (0, 0) (64, 74) (64, 0) 2 2 APLoop , AnimationConfig (0, 0) (64, 74) (64, 0) 2 2 APLoop
) )
] ]
modifyMVar_ progress (return . (\(p, _) -> modifyMVar_ progress (return . (\(p, _) ->
( p + increment ( p + increment
, "Loading Animation \"computer: on\"" , "Loading Animation \"cornerComputer: on\""
))) )))
computerOn <- loadAnimationSprites "assets/misc/tableCornerComputer.png" nvg cornerComputerOn <- loadAnimationSprites "assets/misc/tableCornerComputer.png" nvg
[ ( AnimId "computer" "on" N [ ( AnimId "computer" "on" N
, AnimationConfig (128, 0) (64, 74) (0, 0) 1 0 APLoop , AnimationConfig (128, 0) (64, 74) (0, 0) 1 0 APLoop
) )
] ]
modifyMVar_ progress (return . (\(p, _) -> modifyMVar_ progress (return . (\(p, _) ->
( p + increment ( p + increment
, "Loading Animation \"computer: hack\"" , "Loading Animation \"cornerComputer: hack\""
))) )))
computerHack <- loadAnimationSprites "assets/misc/tableCornerComputer.png" nvg cornerComputerHack <- loadAnimationSprites "assets/misc/tableCornerComputer.png" nvg
[ ( AnimId "computer" "hack" N [ ( AnimId "computer" "hack" N
, AnimationConfig (0, 74) (64, 74) (64, 0) 4 2 APLoop , AnimationConfig (0, 74) (64, 74) (64, 0) 4 2 APLoop
) )
] ]
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading Animation \"neComputer: off\""
)))
neComputerOff <- loadAnimationSprites "assets/misc/tableSWComputer.png" nvg
[ ( AnimId "computer" "off" NE
, AnimationConfig (0, 0) (64, 74) (64, 0) 2 2 APLoop
)
]
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading Animation \"neComputer: on\""
)))
neComputerOn <- loadAnimationSprites "assets/misc/tableSWComputer.png" nvg
[ ( AnimId "computer" "on" NE
, AnimationConfig (128, 0) (64, 74) (0, 0) 1 0 APLoop
)
]
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading Animation \"neComputer: hack\""
)))
neComputerHack <- loadAnimationSprites "assets/misc/tableSWComputer.png" nvg
[ ( AnimId "computer" "hack" NE
, AnimationConfig (0, 74) (64, 74) (64, 0) 4 2 APLoop
)
]
modifyMVar_ progress (return . (\(p, _) -> modifyMVar_ progress (return . (\(p, _) ->
( p + increment ( p + increment
, "Loading Animation \"toilet: free\"" , "Loading Animation \"toilet: free\""
@ -405,9 +432,12 @@ loadFork ws win glc nvg future progress = do
jdoemWalking ++ jdoemWalking ++
copierStand ++ copierStand ++
copierCopy ++ copierCopy ++
computerOff ++ cornerComputerOff ++
computerOn ++ cornerComputerOn ++
computerHack ++ cornerComputerHack ++
neComputerOff ++
neComputerOn ++
neComputerHack ++
toiletFree ++ toiletFree ++
toiletOccupied toiletOccupied
) )

View file

@ -158,12 +158,14 @@ loadMapFork ud ad future progress = do
let !computers = Prelude.filter (\a -> pointType a == Computer) rps let !computers = Prelude.filter (\a -> pointType a == Computer) rps
mapM_ (\(ReachPoint _ icoord dir _) -> do mapM_ (\(ReachPoint _ icoord dir _) -> do
let reachCoord = fmap ((+ 0.5) . fromIntegral) icoord let reachCoord = fmap ((+ 0.5) . fromIntegral) icoord
void $ createEntity $ newEntity access = case dir of
{ pos = Just $ reachCoord - case dir of
N -> V2 1 (-1) N -> V2 1 (-1)
NE -> V2 0 (-1)
_ -> error "not yet defined" _ -> error "not yet defined"
, anim = Just $ AnimState (AnimId "computer" "off" N) 0 0 void $ createEntity $ newEntity
, objAccess = Just (V2 1 (-1), dir) { pos = Just $ reachCoord - fmap fromIntegral access
, anim = Just $ AnimState (AnimId "computer" "off" dir) 0 0
, objAccess = Just (access, dir)
, objType = Just ObjComputer , objType = Just ObjComputer
, objState = Just "off" , objState = Just "off"
} }

View file

@ -147,11 +147,12 @@ instance ObjectAction ObjType ObjState where
objectTransition ObjComputer "off" pa ent (Just aent) = do objectTransition ObjComputer "off" pa ent (Just aent) = do
e <- efor (anEnt ent) $ do e <- efor (anEnt ent) $ do
solved <- queryMaybe objSolved solved <- queryMaybe objSolved
(_, dir) <- query objAccess
if pa if pa
then if not (fromMaybe False solved) then if not (fromMaybe False solved)
then do then do
let nstat = AnimState let nstat = AnimState
(AnimId "computer" "hack" N) (AnimId "computer" "hack" dir)
0 0
0 0
return unchanged return unchanged
@ -162,7 +163,7 @@ instance ObjectAction ObjType ObjState where
} }
else do else do
let nstat = AnimState let nstat = AnimState
(AnimId "computer" "on" N) (AnimId "computer" "on" dir)
0 0
0 0
return unchanged return unchanged
@ -173,7 +174,7 @@ instance ObjectAction ObjType ObjState where
} }
else do else do
let nstat = AnimState let nstat = AnimState
(AnimId "computer" "on" N) (AnimId "computer" "on" dir)
0 0
0 0
return unchanged return unchanged
@ -186,8 +187,9 @@ instance ObjectAction ObjType ObjState where
objectTransition ObjComputer "on" _ ent _ = do objectTransition ObjComputer "on" _ ent _ = do
e <- efor (anEnt ent) $ do e <- efor (anEnt ent) $ do
(_, dir) <- query objAccess
let nstat = AnimState let nstat = AnimState
(AnimId "computer" "off" N) (AnimId "computer" "off" dir)
0 0
0 0
return unchanged return unchanged
@ -203,8 +205,9 @@ instance ObjectAction ObjType ObjState where
if pa if pa
then do then do
e <- efor (anEnt ent) $ do e <- efor (anEnt ent) $ do
(_, dir) <- query objAccess
let nstat = AnimState let nstat = AnimState
(AnimId "computer" "off" N) (AnimId "computer" "off" dir)
0 0
0 0
ost <- query objStateTime ost <- query objStateTime

View file

@ -23,6 +23,7 @@ data Cluster
| ClusterTableNW | ClusterTableNW
| ClusterTableNE | ClusterTableNE
| ClusterTableSE | ClusterTableSE
| ClusterComputerTableSW
| ClusterCornerTable | ClusterCornerTable
| ClusterTableGroup | ClusterTableGroup
| ClusterCopier | ClusterCopier
@ -68,6 +69,12 @@ clusterMatWithRPs ClusterTableNW dim@(_, w) _ =
] ]
, clusterPoints ClusterTableNW dim , clusterPoints ClusterTableNW dim
) )
clusterMatWithRPs ClusterComputerTableSW dim _ =
( M.fromLists [
[Just ImgEmpty, Just ImgTableSW]
]
, clusterPoints ClusterComputerTableSW dim
)
clusterMatWithRPs ClusterCornerTable dim _ = clusterMatWithRPs ClusterCornerTable dim _ =
( M.fromLists ( M.fromLists
[ [Just ImgTableSE, Just ImgTableCorner] [ [Just ImgTableSE, Just ImgTableCorner]
@ -155,7 +162,7 @@ clusterMatWithRPs ClusterVending dim _ =
] ]
, clusterPoints ClusterVending dim , clusterPoints ClusterVending dim
) )
clusterMatWithRPs ClusterCabinets dim@(h, w) g = clusterMatWithRPs ClusterCabinets (h, w) g =
let iw = max 2 w let iw = max 2 w
ih = max 2 h ih = max 2 h
rw = min 5 iw rw = min 5 iw
@ -219,6 +226,7 @@ clusterRoom ClusterTableSW = [Offi]
clusterRoom ClusterTableNW = [Offi] clusterRoom ClusterTableNW = [Offi]
clusterRoom ClusterTableNE = [Offi] clusterRoom ClusterTableNE = [Offi]
clusterRoom ClusterTableSE = [Offi] clusterRoom ClusterTableSE = [Offi]
clusterRoom ClusterComputerTableSW = [Offi]
clusterRoom ClusterCornerTable = [Offi] clusterRoom ClusterCornerTable = [Offi]
clusterRoom ClusterTableGroup = [Offi] clusterRoom ClusterTableGroup = [Offi]
clusterRoom ClusterCopier = [Offi] clusterRoom ClusterCopier = [Offi]
@ -241,6 +249,8 @@ clusterPoints ClusterTableSW (h, _) =
[ ReachPoint Table (V2 r 1) NE 0 | r <- [1..h] ] [ ReachPoint Table (V2 r 1) NE 0 | r <- [1..h] ]
clusterPoints ClusterTableSE (_, w) = clusterPoints ClusterTableSE (_, w) =
[ ReachPoint Table (V2 2 c) NW 0 | c <- [1..w] ] [ ReachPoint Table (V2 2 c) NW 0 | c <- [1..w] ]
clusterPoints ClusterComputerTableSW _ =
[ ReachPoint Computer (V2 1 1) NE 0 ]
clusterPoints ClusterCornerTable _ = clusterPoints ClusterCornerTable _ =
[ ReachPoint Computer (V2 2 1) N 0 [ ReachPoint Computer (V2 2 1) N 0
] ]