This commit is contained in:
2022-06-06 00:36:18 +01:00
parent b0173c3778
commit 384a16851b
6 changed files with 23 additions and 21 deletions
+1 -1
View File
@@ -404,7 +404,7 @@ data Button = Button
, _btID :: Int
, _btText :: String
, _btState :: ButtonState
, _btTerminalParams :: World -> TerminalParams
-- , _btTerminalParams :: World -> TerminalParams
, _btTerminal :: Maybe Int
, _btName :: String
}
-1
View File
@@ -253,7 +253,6 @@ defaultButton = Button
, _btID = 0
, _btText = "Button"
, _btState = BtOff
, _btTerminalParams = const NoTerminalParams
, _btTerminal = Nothing
, _btName = ""
}
-3
View File
@@ -25,7 +25,6 @@ makeButton col eff = defaultButton
. soundFromGeneral (LeverSound 0) (btpos b) click1S Nothing $ w
, _btText = "Button"
, _btState = BtOff
, _btTerminalParams = const NoTerminalParams
}
where
turnOn bt = bt {_btState = BtNoLabel, _btEvent = const id}
@@ -63,7 +62,6 @@ makeSwitchSPic dswitch effOn effOff = defaultButton
, _btEvent = flipSwitch
, _btText = "SWITCH/"
, _btState = BtOff
, _btTerminalParams = const NoTerminalParams
}
where
flipSwitch b w = switchEffect b . soundFromGeneral (LeverSound 0) (bpos b) click1S Nothing $ w
@@ -95,7 +93,6 @@ makeSwitch col1 col2 effOn effOff = defaultButton
, _btEvent = flipSwitch
, _btText = "SWITCH/"
, _btState = BtOff
, _btTerminalParams = const NoTerminalParams
}
where
flipSwitch b w = switchEffect b . soundFromGeneral (LeverSound 0) (bpos b) click1S Nothing $ w
+1 -1
View File
@@ -7,7 +7,7 @@ module Dodge.Placement.Instance.Analyser
--import Dodge.PlacementSpot
import Dodge.Data
import Dodge.Base.You
import Dodge.Default
--import Dodge.Default
import Dodge.Terminal
--import Dodge.Tree
--import Dodge.RoomLink
+19 -13
View File
@@ -30,7 +30,7 @@ putTerminal''
-> Placement
putTerminal'' mc f mcf = ps0PushPSw (PutTerminal theterminal) $ \_ tmpl -> Just $
ps0PushPS (PutButton $ termButton & btTerminal .~ _plMID tmpl)
$ \pl -> Just $ pt0 (PutMachine (reverse $ square 10)
$ \pl -> Just $ pt0 (PutMachine (reverse $ square 10)
(mc & mcUpdate .~ machineAddSound fridgeHumS (mcf (fromJust $ _plMID pl))
& mcDeath %~ (\fd mc' -> (buttons . at (fromJust (_plMID pl)) .~ Nothing) . fd mc')
)
@@ -51,18 +51,25 @@ putTerminal' col = putTerminal'' (defaultMachine & mcColor .~ col)
}
putTerminal :: Color -> (World -> TerminalParams) -> Placement
putTerminal col f = ps0PushPSw (PutTerminal theterminal) $ \_ tmpl -> Just $
ps0PushPS (PutButton $ termButton & btTerminal .~ _plMID tmpl)
$ \pl -> Just $ pt0 (PutMachine (reverse $ square 10) (defaultMachine & mcColor .~ col)
{ _mcDraw = noPic . terminalShape
, _mcHP = 100
, _mcUpdate = basicMachineUpdate $ machineAddSound fridgeHumS (const id)
, _mcDeath = \mc -> (buttons . at (fromJust (_plMID pl)) .~ Nothing)
. makeExplosionAt (_mcPos mc)
})
$ const Nothing
putTerminal col f = putTerminal'' (mc & mcColor .~ col) f (\_ -> basicMachineUpdate $ const id)
where
theterminal = defaultTerminal & tmProgram .~ const f
mc = defaultMachine
{ _mcDraw = noPic . terminalShape
, _mcHP = 100
, _mcDeath = makeExplosionAt . _mcPos
}
-- ps0PushPSw (PutTerminal theterminal) $ \_ tmpl -> Just $
-- ps0PushPS (PutButton $ termButton & btTerminal .~ _plMID tmpl)
-- $ \pl -> Just $ pt0 (PutMachine (reverse $ square 10) (defaultMachine & mcColor .~ col)
-- { _mcDraw = noPic . terminalShape
-- , _mcHP = 100
-- , _mcUpdate = basicMachineUpdate $ machineAddSound fridgeHumS (const id)
-- , _mcDeath = \mc -> (buttons . at (fromJust (_plMID pl)) .~ Nothing)
-- . makeExplosionAt (_mcPos mc)
-- })
-- $ const Nothing
-- where
-- theterminal = defaultTerminal & tmProgram .~ const f
termButton :: Button
termButton = Button
@@ -73,7 +80,6 @@ termButton = Button
, _btID = 0
, _btText = "TERMINAL"
, _btState = BtOff
, _btTerminalParams = const $ TerminalParams [] [] 10 "TERMINAL" Nothing Nothing [] []
, _btTerminal = Nothing
, _btName = ""
}
+2 -2
View File
@@ -54,8 +54,8 @@ addWarningTerminal outplid = (rmName .++~ "warningTerm-")
(atFstLnkOutShiftBy (\(p,a) -> (p +.+ rotateV a (V2 18.5 (-2.5)), a)))
(Just . set plSpot (rprShift moveToSideFirstOutLink) . putTerminal terminalColor . termMessages)
termMessages trid _ = defaultTermParams & addInputLine
[unlockCommand trid,quitCommand]
[helpCommand,infoCommand theinfo,commandsCommand]
[unlockCommand trid,quitCommand]
[helpCommand,infoCommand theinfo,commandsCommand]
unlockCommand trid = singleCommand "OPEN" ["YES","Y"] "OPEN THE CONNECTED DOOR." (toggledoor trid)
toggledoor trid w' = w' & triggers . ix (fromJust $ _plMID trid) .~ const True
theinfo = "DOOR CONTROLABLE WITH THE \"OPEN\" COMMAND. THIS TERMINAL CANNOT CLOSE THE DOOR."