Start simplifying buttons
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -27,8 +27,8 @@ flipSwitch oneff offeff bt
|
||||
doWdWd offeff . dosound
|
||||
. over (cWorld . lWorld . buttons . ix (_btID bt)) turnoff
|
||||
where
|
||||
turnon = (btState .~ BtOn) . (btText .~ "SWITCH\\")
|
||||
turnoff = (btState .~ BtOff) . (btText .~ "SWITCH/")
|
||||
turnon = (btState .~ BtOn)
|
||||
turnoff = (btState .~ BtOff)
|
||||
dosound = soundWithStatus ToStart (LeverSound 0) (_btPos bt) click1S Nothing
|
||||
|
||||
-- switchEffect b = case _btState b of
|
||||
|
||||
@@ -51,7 +51,7 @@ data Button = Button
|
||||
, _btRot :: Float
|
||||
, _btEvent :: ButtonEvent --Button -> World -> World
|
||||
, _btID :: Int
|
||||
, _btText :: String
|
||||
-- , _btText :: String
|
||||
, _btState :: ButtonState
|
||||
, _btTermMID :: Maybe Int
|
||||
, _btName :: String
|
||||
|
||||
@@ -54,7 +54,6 @@ defaultButton =
|
||||
, _btRot = 0
|
||||
, _btEvent = ButtonPress BtInactive ButtonDoNothing click1S NoWorldEffect
|
||||
, _btID = 0
|
||||
, _btText = "Button"
|
||||
, _btState = BtOff
|
||||
, _btTermMID = Nothing
|
||||
, _btName = ""
|
||||
|
||||
@@ -221,7 +221,7 @@ closeButtonToSelectionItem w i = do
|
||||
bt <- w ^? cWorld . lWorld . buttons . ix i
|
||||
return
|
||||
SelectionItem
|
||||
{ _siPictures = [_btText bt]
|
||||
{ _siPictures = [btText bt]
|
||||
, _siHeight = 1
|
||||
, _siWidth = 15
|
||||
, _siIsSelectable = True
|
||||
@@ -230,6 +230,16 @@ closeButtonToSelectionItem w i = do
|
||||
, _siPayload = ()
|
||||
}
|
||||
|
||||
btText :: Button -> String
|
||||
btText bt = case _btEvent bt of
|
||||
ButtonDoNothing -> "UNPRESSABLE BUTTON"
|
||||
ButtonPress {} -> "BUTTON"
|
||||
ButtonSimpleSwith {} -> case _btState bt of
|
||||
BtOn -> "SWITCH\\"
|
||||
BtOff -> "SWITCH/"
|
||||
BtInactive -> "INACTIVE SWITCH"
|
||||
ButtonAccessTerminal -> "TERMINAL"
|
||||
|
||||
closeItemToTextPictures :: FloorItem -> ([String], Color)
|
||||
closeItemToTextPictures flit = (basicItemDisplay it, itemInvColor $ baseCI it)
|
||||
where
|
||||
|
||||
@@ -20,7 +20,6 @@ makeButton
|
||||
makeButton col eff = defaultButton
|
||||
{ _btPict = DefaultDrawButton col
|
||||
, _btEvent = ButtonPress BtInactive ButtonDoNothing click1S eff
|
||||
, _btText = "Button"
|
||||
, _btState = BtOff
|
||||
}
|
||||
|
||||
@@ -45,7 +44,6 @@ makeSwitchSPic
|
||||
makeSwitchSPic dswitch effOn effOff = defaultButton
|
||||
{ _btPict = dswitch
|
||||
, _btEvent = ButtonSimpleSwith effOn effOff
|
||||
, _btText = "SWITCH/"
|
||||
, _btState = BtOff
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,6 @@ termButton =
|
||||
, _btRot = 0
|
||||
, _btEvent = ButtonAccessTerminal
|
||||
, _btID = 0
|
||||
, _btText = "TERMINAL"
|
||||
, _btState = BtOff
|
||||
, _btTermMID = Nothing
|
||||
, _btName = ""
|
||||
|
||||
+1
-2
@@ -774,8 +774,7 @@ updateDust w c
|
||||
& dsVel .~ newvel
|
||||
& dsTimer -~ 1
|
||||
where
|
||||
springvel = foldl' (dustSpringVel c) (_dsVel c) (dssNearPoint oldPos2 w)
|
||||
v@(V3 _ _ vz) = springvel
|
||||
v@(V3 _ _ vz) = foldl' (dustSpringVel c) (_dsVel c) (dssNearPoint oldPos2 w)
|
||||
newvel = 0.95 * (maybe v (addZ vz . snd) hitWl - V3 0 0 0.05)
|
||||
oldPos = _dsPos c
|
||||
oldPos2 = stripZ oldPos
|
||||
|
||||
Reference in New Issue
Block a user