Cleanup
This commit is contained in:
@@ -196,12 +196,16 @@ updateRBList :: World -> World
|
||||
updateRBList w
|
||||
| w ^? rbOptions . opCurInvPos == Just curinvid
|
||||
= w & setEquipAllocation & setEquipActivation
|
||||
| otherwise = case cr ^? crInv . ix (_crInvSel cr) . itUse . eqSite of
|
||||
| otherwise = case cr ^? crInv . ix curinvid . itUse . eqSite of
|
||||
Just esite -> w
|
||||
& rbOptions .~ EquipOptions (equipSiteToPositions esite) (chooseEquipmentPosition cr (equipSiteToPositions esite)) curinvid DoNotMoveEquipment NoChangeActivateEquipment
|
||||
& rbOptions .~ EquipOptions (equipSiteToPositions esite)
|
||||
(chooseEquipmentPosition cr (equipSiteToPositions esite))
|
||||
curinvid
|
||||
DoNotMoveEquipment
|
||||
NoChangeActivateEquipment
|
||||
& setEquipAllocation & setEquipActivation
|
||||
Nothing -> w & rbOptions .~ NoRightButtonOptions
|
||||
| otherwise = w & rbOptions .~ NoRightButtonOptions
|
||||
-- | otherwise = w & rbOptions .~ NoRightButtonOptions
|
||||
where
|
||||
curinvid = _crInvSel cr
|
||||
cr = you w
|
||||
|
||||
+17
-11
@@ -20,7 +20,7 @@ quitCommand = TerminalCommand
|
||||
disconnectTerminal :: World -> World
|
||||
disconnectTerminal = hud . hudElement . subInventory . termParams %~
|
||||
( (termInput .~ Nothing)
|
||||
. (termFutureLines ++.~ [TerminalLineDisplay 0 $ const ("DISCONNECTION COMPLETE",white)] )
|
||||
. (termFutureLines ++.~ [makeTermLine "DISCONNECTION COMPLETE"] )
|
||||
)
|
||||
helpCommand :: TerminalCommand
|
||||
helpCommand = TerminalCommand
|
||||
@@ -39,8 +39,8 @@ helpf (str:_) w = maybe (Left "") Right $ do
|
||||
commands <- getCommands w
|
||||
command <- find (\tc -> _tcString tc == str || str `elem` _tcAlias tc) commands
|
||||
return $ w & infoClearInput
|
||||
([TerminalLineDisplay 0 $ const ("COMMAND:" ++ _tcString command,white)
|
||||
,TerminalLineDisplay 0 $ const ("ALIASES:" ++ unwords (_tcAlias command),white) ]
|
||||
([makeTermLine ("COMMAND:" ++ _tcString command)
|
||||
,makeTermLine ("ALIASES:" ++ unwords (_tcAlias command)) ]
|
||||
++ stringToTermPara (_tcHelp command ++ " " ++ argumentHelp (_tcArgumentType command))
|
||||
)
|
||||
getCommands :: World -> Maybe [TerminalCommand]
|
||||
@@ -56,15 +56,20 @@ infoClearInput tls = hud . hudElement . subInventory . termParams %~
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
argumentHelp :: Maybe String -> String
|
||||
argumentHelp mstr = case mstr of
|
||||
Nothing -> "ANY ARGUMENTS PROVIDED TO THIS COMMAND ARE IGNORED."
|
||||
Just str -> "EXPECTS " ++ str ++ " AS ARGUMENT."
|
||||
|
||||
stringToTermPara :: String -> [TerminalLine]
|
||||
stringToTermPara str = map (\s -> TerminalLineDisplay 0 $ const (s,white))
|
||||
(makeParagraph 60 str)
|
||||
stringToTermPara = map makeTermLine . makeParagraph 60
|
||||
|
||||
makeColorTermLine :: Color -> String -> TerminalLine
|
||||
makeColorTermLine col str = TerminalLineDisplay 0 $ const (str,col)
|
||||
|
||||
makeTermLine :: String -> TerminalLine
|
||||
makeTermLine = makeColorTermLine white
|
||||
|
||||
|
||||
infoCommand :: String -> TerminalCommand
|
||||
infoCommand str = TerminalCommand
|
||||
@@ -85,7 +90,7 @@ commandsCommand = TerminalCommand
|
||||
, _tcArgumentType = Nothing
|
||||
, _tcArguments = const []
|
||||
, _tcEffect = const $ \w -> Right $ w & infoClearInput
|
||||
(TerminalLineDisplay 0 (const ("AVAILABLE COMMANDS:",white))
|
||||
( makeTermLine "AVAILABLE COMMANDS:"
|
||||
: stringToTermPara (unwords (maybe [""] (map _tcString) $ getCommands w))
|
||||
)
|
||||
}
|
||||
@@ -104,7 +109,8 @@ doTerminalEffect :: World -> World
|
||||
doTerminalEffect w = fromMaybe w $ do
|
||||
s <- fmap T.unpack $ w ^? hud . hudElement . subInventory . termParams . termInput . _Just
|
||||
return $ doTerminalEffect' s $ w
|
||||
& hud . hudElement . subInventory . termParams . termFutureLines .~ [TerminalLineDisplay 0 (const ('>':s,greyN 0.9))]
|
||||
& hud . hudElement . subInventory . termParams . termFutureLines
|
||||
.~ [makeColorTermLine (greyN 0.9) ('>':s)]
|
||||
|
||||
doTerminalEffect' :: String -> World -> World
|
||||
doTerminalEffect' s w = fromMaybe (w & badinput) $ do
|
||||
@@ -117,15 +123,15 @@ doTerminalEffect' s w = fromMaybe (w & badinput) $ do
|
||||
Left err -> return $ w & hud . hudElement . subInventory . termParams %~
|
||||
( (termInput ?~ T.empty)
|
||||
. (termFutureLines ++.~
|
||||
[TerminalLineDisplay 0
|
||||
$ const ("^ INVALID ARGUMENT: EXPECTS "++fromJust (_tcArgumentType command)++ err ,red)
|
||||
[makeColorTermLine red
|
||||
("^ INVALID ARGUMENT: EXPECTS "++fromJust (_tcArgumentType command)++ err)
|
||||
]
|
||||
)
|
||||
)
|
||||
where
|
||||
badinput = hud . hudElement . subInventory . termParams %~
|
||||
( (termInput ?~ T.empty)
|
||||
. (termFutureLines ++.~ [TerminalLineDisplay 0 $ const ("^ INVALID INPUT",red)
|
||||
. (termFutureLines ++.~ [makeColorTermLine red ("^ INVALID INPUT")
|
||||
]
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user