Make world booleans (triggers) non-functional

This commit is contained in:
2022-07-19 21:21:32 +01:00
parent 6b398b4bb6
commit 0edc1cfe11
6 changed files with 21 additions and 22 deletions
+12 -12
View File
@@ -15,16 +15,16 @@ import Control.Lens
import qualified Data.IntMap.Strict as IM
triggerSwitchSPic :: (Button -> SPic) -> PlacementSpot -> Placement
triggerSwitchSPic sdraw ps = psPtCont ps (PutTrigger (const False))
triggerSwitchSPic sdraw ps = psPtCont ps (PutTrigger False)
$ \tp -> Just $ pContID ps (PutButton (makeSwitchSPic sdraw (oneff $ trigid tp) (offeff $ trigid tp)))
(const Nothing)
where
trigid tp = fromJust $ _plMID tp
oneff tid = triggers . ix tid .~ const True
offeff tid = triggers . ix tid .~ const False
oneff tid = triggers . ix tid .~ True
offeff tid = triggers . ix tid .~ False
triggerSwitchSPicLight :: (Button -> SPic) -> PlacementSpot -> Placement
triggerSwitchSPicLight sdraw ps = psPtCont ps (PutTrigger (const False))
triggerSwitchSPicLight sdraw ps = psPtCont ps (PutTrigger False)
$ \tp -> Just $ pContID atFstLnkOut (PutLS thels)
$ \lsid -> Just
$ pContID ps (PutButton (makeSwitchSPic sdraw (oneff lsid $ trigid tp) (offeff lsid $ trigid tp)))
@@ -32,19 +32,19 @@ triggerSwitchSPicLight sdraw ps = psPtCont ps (PutTrigger (const 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 .~ const b)
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)
triggerSwitch :: Color -> PlacementSpot -> Placement
triggerSwitch col ps = psPtCont ps (PutTrigger (const False))
triggerSwitch col ps = psPtCont ps (PutTrigger False)
$ \tp -> Just $ pContID ps (PutButton (makeSwitch col col (oneff $ trigid tp) (offeff $ trigid tp)))
(const Nothing)
where
trigid tp = fromJust $ _plMID tp
oneff tid = triggers . ix tid .~ const True
offeff tid = triggers . ix tid .~ const False
oneff tid = triggers . ix tid .~ True
offeff tid = triggers . ix tid .~ False
putLitButOnPos :: Color
-> PlacementSpot
@@ -59,7 +59,7 @@ putLitButOnPos col theps subpl
-- creates a lit external trigger, passes the trigger placement forward
extTrigLitPos :: PlacementSpot -> (Placement -> Maybe Placement) -> Placement
extTrigLitPos ps f = psPtCont ps (PutTrigger (const False))
extTrigLitPos ps f = psPtCont ps (PutTrigger False)
$ \tp -> Just $ pContID (ps' tp) (PutLS thels)
$ \lsid -> Just $ pContID (ps' tp) (PutMod $ themod lsid tp)
$ const (f tp)
@@ -69,7 +69,7 @@ extTrigLitPos ps f = psPtCont ps (PutTrigger (const False))
{_mdID = 0
,_mdExternalID1 = lsid
,_mdExternalID2 = fromJust $ _plMID tp
,_mdUpdate = \md w -> if (_triggers w IM.! _mdExternalID2 md) w
,_mdUpdate = \md w -> if (_triggers w IM.! _mdExternalID2 md)
then w & lightSources . ix (_mdExternalID1 md) . lsParam . lsCol .~ V3 0 0.5 0
else w & lightSources . ix (_mdExternalID1 md) . lsParam . lsCol .~ V3 0.5 0 0
}
@@ -83,7 +83,7 @@ putLitButOnPosExtTrig' :: Color
-> (Placement -> Placement -> Placement -> Maybe Placement)
-> Placement
putLitButOnPosExtTrig' col thePS cnt
= psPtCont thePS (PutTrigger (const False))
= 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)))
@@ -91,6 +91,6 @@ putLitButOnPosExtTrig' col thePS cnt
(cnt tp plmnt) <&> plSpot .~ _plSpot plmnt
where
trigid tp = fromJust $ _plMID tp
oneff tid = triggers . ix tid .~ const True
oneff tid = triggers . ix tid .~ True
changeLight lsid = lightSources . ix lsid . lsParam . lsCol .~ V3 0 0.5 0
ls = lsRadCol 75 (V3 0.5 0 0)