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, _) ->
( 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
, AnimationConfig (0, 0) (64, 74) (64, 0) 2 2 APLoop
)
]
modifyMVar_ progress (return . (\(p, _) ->
( 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
, AnimationConfig (128, 0) (64, 74) (0, 0) 1 0 APLoop
)
]
modifyMVar_ progress (return . (\(p, _) ->
( 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
, 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, _) ->
( p + increment
, "Loading Animation \"toilet: free\""
@ -405,9 +432,12 @@ loadFork ws win glc nvg future progress = do
jdoemWalking ++
copierStand ++
copierCopy ++
computerOff ++
computerOn ++
computerHack ++
cornerComputerOff ++
cornerComputerOn ++
cornerComputerHack ++
neComputerOff ++
neComputerOn ++
neComputerHack ++
toiletFree ++
toiletOccupied
)

View file

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

View file

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

View file

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