Work on connecting pathfinding grid

This commit is contained in:
2022-07-09 12:36:17 +01:00
parent 9c352e4a83
commit fb66a45495
11 changed files with 16 additions and 32 deletions
+1 -5
View File
@@ -63,7 +63,7 @@ applyTerminalCommandArguments :: String -> [String] -> Universe -> Universe
applyTerminalCommandArguments command args u = case command of
"ITEM" -> fromMaybe u $ do
(ibt,n) <- parseItem args
return $ u & uvWorld %~ (flip (foldr ($)) $ replicate n (snd . createPutItem (itemFromBase ibt)))
return $ u & uvWorld %~ flip (foldr ($)) (replicate n (snd . createPutItem (itemFromBase ibt)))
_ -> u
parseItem :: [String] -> Maybe (ItemBaseType,Int)
@@ -77,10 +77,6 @@ parseItem [] = Nothing
parseNum :: [String] -> Int
parseNum xs = fromMaybe 1 $ xs ^? ix 0 >>= readMaybe
safeTake2 :: [a] -> Maybe [a]
safeTake2 (x:y:_) = Just (x:y:[])
safeTake2 _ = Nothing
showTerminalError :: String -> String -> Universe -> Universe
showTerminalError cmd s = menuLayers .:~ InputScreen (T.pack cmd) s