From 62a37388e7a7c001b66db8ac0452063b4a18ed4c Mon Sep 17 00:00:00 2001 From: justin Date: Thu, 26 Mar 2026 19:33:02 +0000 Subject: [PATCH] Remove recursive WdWd --- src/Dodge/Data/WorldEffect.hs | 2 +- src/Dodge/Placement/Instance/Button.hs | 5 ++--- src/Dodge/WorldEffect.hs | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Dodge/Data/WorldEffect.hs b/src/Dodge/Data/WorldEffect.hs index dce636865..e98ec4d57 100644 --- a/src/Dodge/Data/WorldEffect.hs +++ b/src/Dodge/Data/WorldEffect.hs @@ -25,8 +25,8 @@ data SoundFilter data WdWd = NoWorldEffect | SetTrigger Bool Int - | WorldEffects [WdWd] -- probably best to avoid recursive types if possible... | SetLSCol Point3 Int + | SetTriggerAndSetLSCol Bool Int Point3 Int | AccessTerminal Int | UnlockInv | SoundStart SoundOrigin Point2 SoundID (Maybe Int) diff --git a/src/Dodge/Placement/Instance/Button.hs b/src/Dodge/Placement/Instance/Button.hs index 4a2a4c9b2..5440f7255 100644 --- a/src/Dodge/Placement/Instance/Button.hs +++ b/src/Dodge/Placement/Instance/Button.hs @@ -110,7 +110,7 @@ putLitButOnPosExtTrig' col thePS cnt = \plmnt -> jps0' ( PutButton - (makeButton col (WorldEffects [changeLight (fromJust $ _plMID plmnt), oneff (trigid tp)])) + (makeButton col (buteff (trigid tp) (fromJust $ _plMID plmnt))) { _btPos = V2 0 (-1) , _btRot = pi } @@ -119,8 +119,7 @@ putLitButOnPosExtTrig' col thePS cnt = <&> plSpot .~ _plSpot plmnt where + buteff i j = SetTriggerAndSetLSCol True i (V3 0 0.5 0) j shp = fmap (fmap $ colorSH col) aShape trigid tp = fromJust $ _plMID tp - oneff = SetTrigger True - changeLight = SetLSCol (V3 0 0.5 0) ls = lsColPosRad (V3 0.5 0 0) (V3 0 0 50) 50 diff --git a/src/Dodge/WorldEffect.hs b/src/Dodge/WorldEffect.hs index fa13d54e6..d2ccfd1c4 100644 --- a/src/Dodge/WorldEffect.hs +++ b/src/Dodge/WorldEffect.hs @@ -36,8 +36,9 @@ doWdWd = \case NoWorldEffect -> id SetTrigger bool tid -> cWorld . lWorld . triggers . ix tid .~ bool SetLSCol col lsid -> cWorld . lWorld . lightSources . ix lsid . lsParam . lsCol .~ col + SetTriggerAndSetLSCol bool tid col lsid -> (cWorld . lWorld . lightSources . ix lsid . lsParam . lsCol .~ col) + . (cWorld . lWorld . triggers . ix tid .~ bool) AccessTerminal mtmid -> accessTerminal mtmid - WorldEffects wes -> \w -> foldr doWdWd w wes UnlockInv -> unlockInv MakeStartCloudAt p -> makeCloudAt CryoReleaseCloud 400 p TorqueCr x cid -> torqueCr x cid