Work on terminals
This commit is contained in:
+18
-20
@@ -1,9 +1,9 @@
|
||||
module Dodge.WorldEffect
|
||||
( doWdWd
|
||||
, accessTerminal
|
||||
, doTmWdWd
|
||||
, lineOutputTerminal
|
||||
) where
|
||||
module Dodge.WorldEffect (
|
||||
doWdWd,
|
||||
accessTerminal,
|
||||
doTmWdWd,
|
||||
lineOutputTerminal,
|
||||
) where
|
||||
|
||||
import Data.Foldable
|
||||
import qualified Data.Map.Strict as M
|
||||
@@ -46,20 +46,20 @@ doItCrWdWd icww = case icww of
|
||||
ItCrWdItemEffect -> flip itemEffect
|
||||
|
||||
accessTerminal :: Maybe Int -> World -> World
|
||||
accessTerminal mtmid w = case mtmid of
|
||||
Nothing -> w
|
||||
Just tmid ->
|
||||
accessTerminal mtmid w = fromMaybe w $ do
|
||||
tmid <- mtmid
|
||||
return $
|
||||
w & hud . hudElement . subInventory .~ DisplayTerminal tmid
|
||||
& cWorld . lWorld . terminals . ix tmid . tmInput . tiFocus .~ True
|
||||
& cWorld . lWorld . terminals . ix tmid %~ tryToBoot
|
||||
where
|
||||
tryToBoot tm = case _tmStatus tm of
|
||||
TerminalReady -> tm
|
||||
TerminalBusy -> tm
|
||||
TerminalOff ->
|
||||
tm
|
||||
& tmFutureLines .~ doTerminalBootProgram (_tmBootProgram tm) tm w
|
||||
& tmStatus .~ TerminalBusy
|
||||
where
|
||||
tryToBoot tm = case _tmStatus tm of
|
||||
TerminalReady -> tm
|
||||
TerminalBusy -> tm
|
||||
TerminalOff ->
|
||||
tm
|
||||
& tmFutureLines .~ doTerminalBootProgram (_tmBootProgram tm) tm w
|
||||
& tmStatus .~ TerminalBusy
|
||||
|
||||
torqueCr :: Float -> Int -> World -> World
|
||||
torqueCr x cid w
|
||||
@@ -82,9 +82,7 @@ lineOutputTerminal tls =
|
||||
}
|
||||
|
||||
doDeathTriggers :: Terminal -> World -> World
|
||||
doDeathTriggers tm w =
|
||||
w
|
||||
& cWorld . lWorld . triggers %~ flip (foldl' $ flip doDeathToggle) xs
|
||||
doDeathTriggers tm = cWorld . lWorld . triggers %~ flip (foldl' $ flip doDeathToggle) xs
|
||||
where
|
||||
xs = M.elems $ _tmToggles tm
|
||||
|
||||
|
||||
Reference in New Issue
Block a user