Move button data
This commit is contained in:
@@ -13,16 +13,15 @@ import ShapePicture
|
||||
import Data.Maybe
|
||||
import Control.Lens
|
||||
|
||||
triggerSwitchSPic :: (Button -> SPic) -> PlacementSpot -> Placement
|
||||
triggerSwitchSPic :: ButtonDraw -> PlacementSpot -> Placement
|
||||
triggerSwitchSPic sdraw ps = psPtCont ps (PutTrigger False)
|
||||
$ \tp -> Just $ pContID ps (PutButton (makeSwitchSPic sdraw (oneff $ trigid tp) (offeff $ trigid tp)))
|
||||
$ \tp -> Just $ pContID ps (PutButton (makeSwitchSPic sdraw (SetTrigger True $ trigid tp)
|
||||
(SetTrigger False $ trigid tp)))
|
||||
(const Nothing)
|
||||
where
|
||||
trigid tp = fromJust $ _plMID tp
|
||||
oneff tid = triggers . ix tid .~ True
|
||||
offeff tid = triggers . ix tid .~ False
|
||||
|
||||
triggerSwitchSPicLight :: (Button -> SPic) -> PlacementSpot -> Placement
|
||||
triggerSwitchSPicLight :: ButtonDraw -> PlacementSpot -> Placement
|
||||
triggerSwitchSPicLight sdraw ps = psPtCont ps (PutTrigger False)
|
||||
$ \tp -> Just $ pContID atFstLnkOut (PutLS thels)
|
||||
$ \lsid -> Just
|
||||
@@ -31,19 +30,17 @@ triggerSwitchSPicLight sdraw ps = psPtCont ps (PutTrigger False)
|
||||
where
|
||||
thels = lsColPosRad (V3 0.5 0 0) (V3 0 0 78) 75
|
||||
trigid tp = fromJust $ _plMID tp
|
||||
eff lsid tid b c = (triggers . ix tid .~ b)
|
||||
. (lightSources . ix lsid . lsParam . lsCol .~ c)
|
||||
oneff lsid tid = eff lsid tid True (V3 0 0.5 0)
|
||||
offeff lsid tid = eff lsid tid False (V3 0.5 0 0)
|
||||
eff lsid tid b c = (triggers . ix tid .~ b)
|
||||
oneff lsid tid = WorldEffects [SetLSCol (V3 0 0.5 0) lsid, SetTrigger True tid]
|
||||
offeff lsid tid = WorldEffects [SetLSCol (V3 0.5 0 0) lsid, SetTrigger False tid]
|
||||
|
||||
triggerSwitch :: Color -> PlacementSpot -> Placement
|
||||
triggerSwitch col ps = psPtCont ps (PutTrigger False)
|
||||
$ \tp -> Just $ pContID ps (PutButton (makeSwitch col col (oneff $ trigid tp) (offeff $ trigid tp)))
|
||||
$ \tp -> Just $ pContID ps (PutButton (makeSwitch col col (SetTrigger True $ trigid tp)
|
||||
(SetTrigger False $ trigid tp)))
|
||||
(const Nothing)
|
||||
where
|
||||
trigid tp = fromJust $ _plMID tp
|
||||
oneff tid = triggers . ix tid .~ True
|
||||
offeff tid = triggers . ix tid .~ False
|
||||
|
||||
putLitButOnPos :: Color
|
||||
-> PlacementSpot
|
||||
@@ -53,7 +50,7 @@ putLitButOnPos col theps subpl
|
||||
$ \plmnt -> jps0' (PutButton (makeButton col (changeLight . fromJust $ _plMID plmnt)) {_btPos = V2 0 (-1), _btRot = pi})
|
||||
subpl <&> plSpot .~ _plSpot plmnt
|
||||
where
|
||||
changeLight lsid = lightSources . ix lsid . lsParam . lsCol .~ V3 0 0.5 0
|
||||
changeLight lsid = SetLSCol (V3 0 0.5 0) lsid
|
||||
ls = lsRadCol 75 (V3 0.5 0 0)
|
||||
|
||||
-- creates a lit external trigger, passes the trigger placement forward
|
||||
@@ -85,11 +82,11 @@ putLitButOnPosExtTrig' col thePS cnt
|
||||
= psPtCont thePS (PutTrigger False)
|
||||
$ \tp -> Just $ plSpot .~ _plSpot tp $ mntLSOn aShape (Just col) ls 0 (V3 0 (-40) 40)
|
||||
$ \plmnt -> jps0' (PutButton
|
||||
(makeButton col (changeLight (fromJust $ _plMID plmnt) . oneff (trigid tp)))
|
||||
(makeButton col (WorldEffects [changeLight (fromJust $ _plMID plmnt), oneff (trigid tp)]))
|
||||
{_btPos = V2 0 (-1), _btRot = pi})
|
||||
(cnt tp plmnt) <&> plSpot .~ _plSpot plmnt
|
||||
where
|
||||
trigid tp = fromJust $ _plMID tp
|
||||
oneff tid = triggers . ix tid .~ True
|
||||
changeLight lsid = lightSources . ix lsid . lsParam . lsCol .~ V3 0 0.5 0
|
||||
oneff tid = SetTrigger True tid
|
||||
changeLight = SetLSCol (V3 0 0.5 0)
|
||||
ls = lsRadCol 75 (V3 0.5 0 0)
|
||||
|
||||
@@ -63,7 +63,8 @@ putAutoDoor a b = PlacementUsingPos (addZ 0 a)
|
||||
. IM.filter isAnimate . _creatures
|
||||
|
||||
switchDoor :: Point2 -> Float -> Point2 -> Point2 -> Color -> Placement
|
||||
switchDoor btpos btrot dra drb col = pContID (PS btpos btrot) (PutButton $ makeSwitch col red id id)
|
||||
switchDoor btpos btrot dra drb col = pContID (PS btpos btrot)
|
||||
(PutButton $ makeSwitch col red NoWorldEffect NoWorldEffect)
|
||||
$ \btid -> jsps0J (doorbetween btid dra drc)
|
||||
$ sps0 (doorbetween btid drb drc)
|
||||
where
|
||||
|
||||
@@ -5,6 +5,7 @@ module Dodge.Placement.Instance.Terminal
|
||||
, simpleTermMessage
|
||||
, terminalColor
|
||||
, terminalSPic
|
||||
, accessTerminal
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.LevelGen.Data
|
||||
@@ -52,10 +53,10 @@ putMessageTerminal col = putTerminal $ defaultMachine
|
||||
|
||||
termButton :: Button
|
||||
termButton = Button
|
||||
{ _btPict = const mempty
|
||||
{ _btPict = DrawNoButton
|
||||
, _btPos = 0
|
||||
, _btRot = 0
|
||||
, _btEvent = accessTerminal . _btTermMID
|
||||
, _btEvent = ButtonAccessTerminal
|
||||
, _btID = 0
|
||||
, _btText = "TERMINAL"
|
||||
, _btState = BtOff
|
||||
|
||||
Reference in New Issue
Block a user