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