Implement terminals

This commit is contained in:
2022-03-14 20:39:23 +00:00
parent 1b6f11709c
commit f16f32d9d3
30 changed files with 313 additions and 119 deletions
+6 -2
View File
@@ -20,7 +20,7 @@ import qualified Data.IntMap.Strict as IM
data PSType = PutCrit {_unPutCrit :: Creature}
| PutMachine { _putMachineColor :: Color, _putMachinePoly :: [Point2], _unPutMachine :: Machine }
| PutLS LightSource
| PutButton Button
| PutButton {_pstPutButton :: Button}
| PutProp Prop
| PutFlIt Item
| PutPPlate PressPlate
@@ -52,6 +52,7 @@ data PlacementSpot
{ _psRoomRandPointNum :: Int
, _psRandShift :: (Point2,Float) -> PlacementSpot
}
-- TODO attempt to unify/simplify this union type
data Placement
= Placement
{ _plSpot :: PlacementSpot
@@ -59,7 +60,10 @@ data Placement
, _plMID :: Maybe Int
, _plIDCont :: Placement -> Maybe Placement
}
| PlacementGenUpdate (GenParams -> Placement -> (GenParams, Placement)) Placement
| PlacementGenUpdate
{_plGenUpdate :: (GenParams -> Placement -> (GenParams, Placement))
,_plGenPL :: Placement
}
| PlacementUsingPos Point3 (Point3 -> Placement) -- allows a placement to use a shifted position
| RandomPlacement {_unRandomPlacement :: State StdGen Placement}
| PickOnePlacement Int Placement
+3
View File
@@ -28,6 +28,7 @@ makeButton col eff = Button
, _btID = 0
, _btText = "Button"
, _btState = BtOff
, _btTerminalParams = NoTerminalParams
}
where
turnOn bt = bt {_btState = BtNoLabel, _btEvent = const id}
@@ -68,6 +69,7 @@ makeSwitchSPic dswitch effOn effOff = Button
, _btID = 0
, _btText = "SWITCH/"
, _btState = BtOff
, _btTerminalParams = NoTerminalParams
}
where
flipSwitch b w = switchEffect b . soundFromGeneral (LeverSound 0) (bpos b) click1S Nothing $ w
@@ -102,6 +104,7 @@ makeSwitch col1 col2 effOn effOff = Button
, _btID = 0
, _btText = "SWITCH/"
, _btState = BtOff
, _btTerminalParams = NoTerminalParams
}
where
flipSwitch b w = switchEffect b . soundFromGeneral (LeverSound 0) (bpos b) click1S Nothing $ w