This commit is contained in:
2025-10-29 12:18:55 +00:00
parent c9ec962575
commit 40c1907689
5 changed files with 11 additions and 16 deletions
+1 -2
View File
@@ -31,8 +31,7 @@ makeDoorDebris dr w = w & makeDebris mt p
mt = fromMaybe Stone $ do
wlids <- w ^? cWorld . lWorld . doors . ix (_drID dr) . drFootPrint
((wlid,_),_) <- IM.minViewWithKey wlids
wl <- w ^? cWorld . lWorld . walls . ix wlid
return $ wl ^. wlMaterial
w ^? cWorld . lWorld . walls . ix wlid . wlMaterial
makeBlockDebris :: Block -> World -> World
makeBlockDebris bl w = foldl' (flip $ makeDebris mt) w ps
-1
View File
@@ -128,7 +128,6 @@ tryThrust pj = fromMaybe id $ do
doThrust :: Projectile -> Maybe RocketSmoke -> World -> World
doThrust pj smoke w =
--doThrust pj _ w =
w
& randGen .~ g
& cWorld . lWorld . projectiles . ix i . pjVel . _xy %~ (\v -> accel + frict *^ v)
+6 -7
View File
@@ -94,13 +94,12 @@ addSouthPillars x h r = do
return $ r & rmPmnts .++~ pillars
addButtonSlowDoor :: RandomGen g => Float -> Float -> Room -> State g Room
addButtonSlowDoor x h rm = do
shuffleLinks $
setOutLinksPD (f (> h + 40)) $
setInLinksPD (f (< h - 40)) $
rm
& rmPmnts <>~ [butDoor, theterminal]
& rmBound .:~ openDoorBound
addButtonSlowDoor x h =
shuffleLinks
. setOutLinksPD (f (> h + 40))
. setInLinksPD (f (< h - 40))
. (rmPmnts <>~ [butDoor, theterminal])
. (rmBound .:~ openDoorBound)
where
f g y = g $ y ^. _1 . _y
theterminal =
+2 -1
View File
@@ -14,6 +14,7 @@ doWdBl wb w = case wb of
WdBlDoorMoving i -> fromMaybe False $ do
dr <- w ^? cWorld . lWorld . doors . ix i
return (0 /= _drLerp dr && 1 /= _drLerp dr)
WdBlCrFilterNearPoint r p t -> any (crNearPoint r p) (IM.filter (doCrBl t) (w ^. cWorld . lWorld . creatures))
WdBlCrFilterNearPoint r p t
-> any (crNearPoint r p) (IM.filter (doCrBl t) (w ^. cWorld . lWorld . creatures))
WdBlBtOn btid -> w ^?! cWorld . lWorld . buttons . ix btid . btEvent . btOn -- unsafe
WdBlNegate x -> not $ doWdBl x w
+2 -5
View File
@@ -8,6 +8,7 @@ module Dodge.WorldEvent.Explosion (
makeTeslaExplosionAt,
) where
import Linear
import Control.Monad
import Data.List
import Dodge.Data.World
@@ -19,8 +20,6 @@ import Geometry
import LensHelp
import Picture
import RandomHelp
import Linear.V3
import Linear.Metric
makePoisonExplosionAt ::
-- | Position
@@ -72,19 +71,17 @@ makeFlameExplosionAt p w =
makeExplosionAt :: Point3 -> Point3 -> World -> World
makeExplosionAt p vel w =
--makeExplosionAt p _ w =
w
& soundStart (Explosion (w ^. cWorld . lWorld . lClock)) (p ^. _xy) bangS Nothing
& addFlames
& cWorld . lWorld . worldEvents
.:~ MakeTempLight (LSParam p 150 (V3 1 0.5 0)) 20
& makeShockwaveAt [] p 50 100 1 white
-- & makeShockwaveAt [] p 50 5000 1 white
where
fVs = fmap (`v2z` 0) $ replicateM 100 (randInCirc 1) & evalState $ _randGen w
fPs' = fmap (`v2z` 0) $ replicateM 100 (randInCirc 5) & evalState $ _randGen w
fdamps = replicateM 100 (state $ randomR (0,1)) & evalState $ _randGen w
inversePushOut v = (15 - norm v) * 0.01 *.*.* v
inversePushOut v = (15 - norm v) * 0.01 *^ v
fVs' = zipWith (+.+.+) fVs $ map inversePushOut fPs'
sizes = randomRs (2, 9) $ _randGen w
times = randomRs (15, 20) $ _randGen w