Cleanup
This commit is contained in:
@@ -3,7 +3,6 @@ module Dodge.Placement.Instance.Terminal
|
||||
( putTerminal
|
||||
, putTerminal'
|
||||
, simpleTermMessage
|
||||
, genTermMessage
|
||||
, topFlushStrings
|
||||
, terminalColor
|
||||
) where
|
||||
@@ -25,10 +24,10 @@ import Data.Maybe
|
||||
|
||||
putTerminal''
|
||||
:: Machine
|
||||
-> (World -> Terminal)
|
||||
-> Terminal
|
||||
-> (Int -> Machine -> World -> World) -- | machine update, takes button id as input
|
||||
-> Placement
|
||||
putTerminal'' mc f mcf = ps0PushPS (PutTerminal theterminal) $ \tmpl -> Just $
|
||||
putTerminal'' mc tm mcf = ps0PushPS (PutTerminal tm) $ \tmpl -> Just $
|
||||
ps0PushPS (PutButton $ termButton)
|
||||
$ \btpl -> Just $ pt0 (PutMachine (reverse $ square 10)
|
||||
(mc & mcUpdate .~ machineAddSound fridgeHumS (mcf (fromJust $ _plMID btpl))
|
||||
@@ -46,11 +45,10 @@ putTerminal'' mc f mcf = ps0PushPS (PutTerminal theterminal) $ \tmpl -> Just $
|
||||
tmid = fromJust (_plMID tmpl)
|
||||
btid = fromJust (_plMID btpl)
|
||||
mcid = fromJust (_plMID mcpl)
|
||||
theterminal = defaultTerminal & tmProgram .~ (\_ w -> _tmFutureLines (f w))
|
||||
|
||||
putTerminal'
|
||||
:: Color
|
||||
-> (World -> Terminal)
|
||||
-> Terminal
|
||||
-> (Int -> Machine -> World -> World) -- | machine update, takes button id as input
|
||||
-> Placement
|
||||
putTerminal' col = putTerminal'' (defaultMachine & mcColor .~ col)
|
||||
@@ -59,7 +57,7 @@ putTerminal' col = putTerminal'' (defaultMachine & mcColor .~ col)
|
||||
, _mcSensor = SensorCloseToggle NotClose False
|
||||
}
|
||||
|
||||
putTerminal :: Color -> (World -> Terminal) -> Placement
|
||||
putTerminal :: Color -> Terminal -> Placement
|
||||
putTerminal col f = putTerminal'' (mc & mcColor .~ col) f (\_ -> basicMachineUpdate $ const id)
|
||||
where
|
||||
mc = defaultMachine
|
||||
@@ -103,14 +101,14 @@ terminalShape mc = colorSH col (prismPoly
|
||||
bootTerminal :: Maybe Int -> World -> World
|
||||
bootTerminal mtmid w = case mtmid of
|
||||
Nothing -> w
|
||||
Just tmid -> w & hud . hudElement .~ DisplayInventory (DisplayTerminal tmid False)
|
||||
Just tmid -> w & hud . hudElement .~ DisplayInventory (DisplayTerminal tmid)
|
||||
& terminals . ix tmid . tmFutureLines ++.~ _tmProgram tm tm w
|
||||
& terminals . ix tmid . tmStatus .~ Connected
|
||||
where
|
||||
tm = w ^?! terminals . ix tmid
|
||||
|
||||
simpleTermMessage :: [String] -> World -> Terminal
|
||||
simpleTermMessage = genTermMessage . const
|
||||
simpleTermMessage :: [String] -> Terminal
|
||||
simpleTermMessage strs = defaultTerminal & tmFutureLines .~ map makeTermLine strs
|
||||
--simpleTermMessage ss = const $ TerminalParams
|
||||
-- {_termDisplayedLines = []
|
||||
-- ,_termFutureLines = TerminalLineEffect 0 termsound
|
||||
@@ -132,5 +130,3 @@ topFlushStrings = topFlush . maximum . map length
|
||||
topFlush :: Int -> [String]
|
||||
topFlush twidth = [replicate i ' ' ++ "*" | i <- [0, max 1 $ twidth `div` 5 .. twidth]]
|
||||
|
||||
genTermMessage :: (World -> [String]) -> World -> Terminal
|
||||
genTermMessage f w = defaultTermParams & tmFutureLines ++.~ map makeTermLine (f w)
|
||||
|
||||
Reference in New Issue
Block a user