diff --git a/assets/misc/tableSWComputer.kra b/assets/misc/tableSWComputer.kra new file mode 100644 index 0000000..c902e60 Binary files /dev/null and b/assets/misc/tableSWComputer.kra differ diff --git a/assets/misc/tableSWComputer.png b/assets/misc/tableSWComputer.png new file mode 100644 index 0000000..a4a961d Binary files /dev/null and b/assets/misc/tableSWComputer.png differ diff --git a/src/Load.hs b/src/Load.hs index 7ebd169..d7f9d3f 100644 --- a/src/Load.hs +++ b/src/Load.hs @@ -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 ) diff --git a/src/MainGame/WorldMap.hs b/src/MainGame/WorldMap.hs index d05c7e0..2fc47ae 100644 --- a/src/MainGame/WorldMap.hs +++ b/src/MainGame/WorldMap.hs @@ -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" } diff --git a/src/Object.hs b/src/Object.hs index fd1debe..83d0893 100644 --- a/src/Object.hs +++ b/src/Object.hs @@ -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 diff --git a/src/Types/Interior.hs b/src/Types/Interior.hs index 21c27e5..57ed8a6 100644 --- a/src/Types/Interior.hs +++ b/src/Types/Interior.hs @@ -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 ]