From 14d50c424291445d38e75fd3a9b622021e2a8950 Mon Sep 17 00:00:00 2001 From: justin Date: Tue, 2 Dec 2025 22:40:17 +0000 Subject: [PATCH] Cleanup --- src/Dodge/Update.hs | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/Dodge/Update.hs b/src/Dodge/Update.hs index 2bdd9e6b5..2186fe245 100644 --- a/src/Dodge/Update.hs +++ b/src/Dodge/Update.hs @@ -831,7 +831,8 @@ updateGas w c newVel@(V3 _ _ nvz) = (0.95 *^ springVels) + V3 0 0 (0.01 * vertVel) newVel2 = stripZ newVel vertVel = min 5 $ 20 - opz - springVels = foldl' (gasGasSpringVel c) (_gsVel c) (gassesNearPoint oldPos2 w) + springVels = c ^. gsPos + + alaf Sum foldMap (radiusSpring 10 oldPos . _gsPos) (gassesNearPoint oldPos2 w) oldPos@(V3 _ _ opz) = _gsPos c oldPos2 = stripZ oldPos newPos@(V3 _ _ npz) = oldPos + newVel @@ -846,35 +847,25 @@ updateDust w c | otherwise = Just $ c - & dsPos .~ finalpos + & dsPos +~ newvel + & dsPos . _z %~ max 1 & dsVel .~ newvel & dsTimer -~ 1 where - v@(V3 _ _ vz) = c ^. dsVel + sum (map (radiusSpring 10 oldPos . _dsPos) - (dssNearPoint oldPos2 w)) + v@(V3 _ _ vz) = c ^. dsVel + + alaf Sum foldMap (radiusSpring 10 oldPos . _dsPos) (dssNearPoint oldPos2 w) newvel = 0.95 * (maybe v (addZ vz . snd) hitWl - V3 0 0 0.05) oldPos = _dsPos c oldPos2 = stripZ oldPos - newPos@(V3 _ _ npz) = oldPos + v + newPos = oldPos + v newPos2 = stripZ newPos hitWl = bouncePoint (const True) 1 oldPos2 newPos2 w - --finalpos = addZ (max 1 npz) $ maybe newPos2 fst hitWl - finalpos = oldPos + newvel & _z %~ max 1 radiusSpring :: Float -> Point3 -> Point3 -> Point3 radiusSpring r a b | dist3 a b < r = 0.1 *^ normalizeV3 (a - b) | otherwise = 0 -gasGasSpringVel :: Gas -> Point3 -> Gas -> Point3 -gasGasSpringVel a v b - | dist3 pa pb < radDist = v + 0.1 *^ normalizeV3 (pa - pb) - | otherwise = v - where - pa = _gsPos a - pb = _gsPos b - radDist = 10 - simpleCrSprings :: World -> World simpleCrSprings w = IM.foldl' (flip crSpring) w $