Add in "linear" lWorld to separate time reversable worlds

This commit is contained in:
2022-10-28 12:24:51 +01:00
parent 5f6bd43599
commit 7e790b7153
130 changed files with 827 additions and 980 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ makeCloudAt ::
World ->
World
makeCloudAt drawFunc rad t alt p =
cWorld . clouds
cWorld . lWorld . clouds
.:~ Cloud
{ --makeCloudAt drawFunc rad t alt p = clouds %~ S.cons Cloud
_clPos = p
+1 -1
View File
@@ -15,6 +15,6 @@ damThingHitWith ::
World ->
World
damThingHitWith partDT sp ep mayEiCrWl = case mayEiCrWl of
Just (hitp, Left cr) -> cWorld . creatures . ix (_crID cr) . crState . csDamage .:~ partDT sp hitp ep
Just (hitp, Left cr) -> cWorld . lWorld . creatures . ix (_crID cr) . crState . csDamage .:~ partDT sp hitp ep
Just (hitp, Right wl) -> damageWall (partDT sp hitp ep) wl
Nothing -> id
+2 -2
View File
@@ -66,7 +66,7 @@ makeFlameExplosionAt ::
World
makeFlameExplosionAt p w =
soundMultiFrom [Explosion 0, Explosion 1] p bangS Nothing w
& cWorld . flames .++~ newFlames
& cWorld . lWorld . flames .++~ newFlames
where
newFlames = zipWith makeFlameWithVelAndTime velocities timers
makeFlameWithVelAndTime vel time = aFlameParticle time p vel
@@ -81,7 +81,7 @@ makeExplosionAt p w =
w
& soundMultiFrom [Explosion 0, Explosion 1] p bangS Nothing
& addFlames
& cWorld . tempLightSources .:~ theTLS
& cWorld . lWorld . tempLightSources .:~ theTLS
& makeShockwaveAt [] p 50 50 1 white
where
theTLS = tlsTimeRadColPos 20 150 (V3 1 0.5 0) (addZ 20 p)
+3 -3
View File
@@ -25,7 +25,7 @@ import System.Random
muzFlareAt :: Color -> Point3 -> Float -> World -> World
muzFlareAt col tranv dir w =
w & cWorld . flares
w & cWorld . lWorld . flares
.:~ MuzFlare
{ _flarePoly =
map
@@ -43,7 +43,7 @@ muzFlareAt col tranv dir w =
flareCircleAt :: Color -> Float -> Point3 -> World -> World
flareCircleAt col alphax tranv =
cWorld . flares
cWorld . lWorld . flares
.:~ CircFlare
{ _flareTime = 2
, _flareColor = col
@@ -52,4 +52,4 @@ flareCircleAt col alphax tranv =
}
explosionFlashAt :: Point2 -> World -> World
explosionFlashAt p = cWorld . tempLightSources .:~ tlsTimeRadFunPos 20 150 (TLSFade 1 10) (addZ 20 p)
explosionFlashAt p = cWorld . lWorld . tempLightSources .:~ tlsTimeRadFunPos 20 150 (TLSFade 1 10) (addZ 20 p)
+2 -2
View File
@@ -26,7 +26,7 @@ makeShockwaveAt ::
World ->
World
makeShockwaveAt is p rad dam push col =
cWorld . shockwaves
cWorld . lWorld . shockwaves
.:~ Shockwave
{ _swInvulnerableCrs = is
, _swDirection = OutwardShockwave
@@ -48,7 +48,7 @@ inverseShockwaveAt ::
World ->
World
inverseShockwaveAt p rad dam push =
cWorld . shockwaves
cWorld . lWorld . shockwaves
.:~ Shockwave
{ _swDirection = InwardShockwave
, _swInvulnerableCrs = []
+3 -9
View File
@@ -11,22 +11,16 @@ import LensHelp
import Picture
import RandomHelp
--randParticleAt :: (Point2 -> State StdGen Particle) -> Point2 -> World -> World
--randParticleAt f p w = w
-- & instantParticles .:~ thepart
-- & randGen .~ g
-- where
-- (thepart,g) = runState (f p) (_randGen w)
randEnergyBallAt :: (Point2 -> State StdGen EnergyBall) -> Point2 -> World -> World
randEnergyBallAt f p w =
w
& cWorld . energyBalls .:~ thepart
& cWorld . lWorld . energyBalls .:~ thepart
& randGen .~ g
where
(thepart, g) = runState (f p) (_randGen w)
makeStaticBall :: Point2 -> World -> World
makeStaticBall p = randEnergyBallAt aStaticBall p . (cWorld . posEvents .:~ thesparker)
makeStaticBall p = randEnergyBallAt aStaticBall p . (cWorld . lWorld . posEvents .:~ thesparker)
where
thesparker = PosEvent SparkSpawner 10 p
@@ -92,7 +86,7 @@ makeGasCloud ::
World
makeGasCloud pos vel w =
w
& cWorld . clouds .:~ theCloud
& cWorld . lWorld . clouds .:~ theCloud
& randGen .~ g
where
theCloud =
+1 -1
View File
@@ -45,7 +45,7 @@ crsHit sp ep w
| otherwise =
sortOn (dist sp . fst)
. overlapSegCrs sp ep
. mapMaybe (\cid -> w ^? cWorld . creatures . ix cid)
. mapMaybe (\cid -> w ^? cWorld . lWorld . creatures . ix cid)
. IS.toList
. crixsNearSeg sp ep
$ w