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