Improve scroll selection/inventory modification

This commit is contained in:
2026-03-24 19:21:04 +00:00
parent 5b297643db
commit 8ff2f37af5
16 changed files with 532 additions and 432 deletions
+49 -45
View File
@@ -1,4 +1,8 @@
module Dodge.Placement.Instance.Button where
module Dodge.Placement.Instance.Button (
putLitButOnPos,
extTrigLitPos,
putLitButOnPosExtTrig,
) where
import Color
import Control.Lens
@@ -8,54 +12,54 @@ import Dodge.LevelGen.PlacementHelper
import Dodge.LevelGen.Switch
import Dodge.LightSource
import Dodge.Placement.Instance.LightSource
import Dodge.PlacementSpot
--import Dodge.PlacementSpot
import Geometry
import Shape
triggerSwitchSPic :: Color -> Color -> PlacementSpot -> Placement
triggerSwitchSPic c1 c2 ps = psPtCont ps (PutTrigger False) $
\tp ->
Just $
pContID
ps
( PutButton
( makeSwitch
c1
c2
(SetTrigger True $ trigid tp)
(SetTrigger False $ trigid tp)
)
)
(const Nothing)
where
trigid tp = fromJust $ _plMID tp
--triggerSwitchSPic :: Color -> Color -> PlacementSpot -> Placement
--triggerSwitchSPic c1 c2 ps = psPtCont ps (PutTrigger False) $
-- \tp ->
-- Just $
-- pContID
-- ps
-- ( PutButton
-- ( makeSwitch
-- c1
-- c2
-- (SetTrigger True $ trigid tp)
-- (SetTrigger False $ trigid tp)
-- )
-- )
-- (const Nothing)
-- where
-- trigid tp = fromJust $ _plMID tp
--
--triggerSwitchSPicLight :: Color -> Color -> PlacementSpot -> Placement
--triggerSwitchSPicLight c1 c2 ps = psPtCont ps (PutTrigger False) $
-- \tp -> Just $
-- pContID atFstLnkOut (PutLS thels) $
-- \lsid ->
-- Just $
-- pContID
-- ps
-- (PutButton (makeSwitch c1 c2 (oneff lsid $ trigid tp) (offeff lsid $ trigid tp)))
-- (const Nothing)
-- where
-- thels = lsColPosRad (V3 0.5 0 0) (V3 0 0 78) 75
-- trigid tp = fromJust $ _plMID tp
-- 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]
triggerSwitchSPicLight :: Color -> Color -> PlacementSpot -> Placement
triggerSwitchSPicLight c1 c2 ps = psPtCont ps (PutTrigger False) $
\tp -> Just $
pContID atFstLnkOut (PutLS thels) $
\lsid ->
Just $
pContID
ps
(PutButton (makeSwitch c1 c2 (oneff lsid $ trigid tp) (offeff lsid $ trigid tp)))
(const Nothing)
where
thels = lsColPosRad (V3 0.5 0 0) (V3 0 0 78) 75
trigid tp = fromJust $ _plMID tp
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 (SetTrigger True $ trigid tp) (SetTrigger False $ trigid tp)))
(const Nothing)
where
trigid tp = fromJust $ _plMID tp
--triggerSwitch :: Color -> PlacementSpot -> Placement
--triggerSwitch col ps = psPtCont ps (PutTrigger False) $
-- \tp ->
-- Just $
-- pContID
-- ps
-- (PutButton (makeSwitch col col (SetTrigger True $ trigid tp) (SetTrigger False $ trigid tp)))
-- (const Nothing)
-- where
-- trigid tp = fromJust $ _plMID tp
putLitButOnPos :: Color -> PlacementSpot -> (Placement -> Maybe Placement) -> Placement
putLitButOnPos col theps subpl =