Commit before removing "un-input-able" terminals
This commit is contained in:
@@ -41,19 +41,14 @@ import Data.Maybe
|
||||
--import System.Random
|
||||
|
||||
analyser
|
||||
:: [String] -- | initial text
|
||||
-> String -- | succeed text
|
||||
-> String -- | fail text
|
||||
-> [String] -- | after text
|
||||
-> (Machine -> World -> World)
|
||||
:: (Machine -> World -> World)
|
||||
-> PlacementSpot
|
||||
-> PlacementSpot
|
||||
-> Placement
|
||||
analyser starts sucs _ afters upf pslight psmc = extTrigLitPos pslight $ \tp ->
|
||||
analyser upf pslight psmc = extTrigLitPos pslight $ \tp ->
|
||||
Just $ plSpot .~ psmc $ putTerminal' aquamarine tparams (termupdate tp)
|
||||
where
|
||||
tparams = defaultTermParams & tmFutureLines ++.~
|
||||
(map makeTermLine starts ++ [makeTermLine sucs] ++ map makeTermLine afters)
|
||||
tparams = defaultTermParams & tmScrollCommands .:~ sensorCommand
|
||||
termupdate tp _ mc = upf mc . (triggers . ix (fromJust $ _plMID tp) .~ const (_sensToggle $ _mcSensor mc))
|
||||
|
||||
analyserTest :: (World -> Bool) -> Machine -> World -> World
|
||||
|
||||
@@ -27,13 +27,12 @@ putTerminal''
|
||||
-> Terminal
|
||||
-> (Int -> Machine -> World -> World) -- | machine update, takes button id as input
|
||||
-> Placement
|
||||
putTerminal'' mc tm mcf = ps0PushPS (PutTerminal tm) $ \tmpl -> Just $
|
||||
ps0PushPS (PutButton termButton)
|
||||
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))
|
||||
& mcDeath %~ (\fd mc' -> (buttons . at (fromJust (_plMID btpl)) .~ Nothing) . fd mc')
|
||||
)
|
||||
)
|
||||
& mcDeath %~ (\fd mc' -> mcKillTerm mc . (buttons . at (fromJust (_plMID btpl)) .~ Nothing) . fd mc')
|
||||
) )
|
||||
$ \mcpl -> Just $ sps0 $ PutWorldUpdate (const $ setids tmpl btpl mcpl)
|
||||
where
|
||||
setids tmpl btpl mcpl w = w
|
||||
@@ -46,6 +45,13 @@ putTerminal'' mc tm mcf = ps0PushPS (PutTerminal tm) $ \tmpl -> Just $
|
||||
btid = fromJust (_plMID btpl)
|
||||
mcid = fromJust (_plMID mcpl)
|
||||
|
||||
mcKillTerm :: Machine -> World -> World
|
||||
mcKillTerm mc w = fromMaybe w $ do
|
||||
tmid <- _mcTermMID mc
|
||||
tm <- w ^? terminals . ix tmid
|
||||
return $ w
|
||||
& _tmDeathEffect tm tm
|
||||
|
||||
putTerminal'
|
||||
:: Color
|
||||
-> Terminal
|
||||
|
||||
Reference in New Issue
Block a user