Separate out concrete part of world

This commit is contained in:
2022-07-25 12:10:50 +01:00
parent 3354d108be
commit b2efbd2b3e
134 changed files with 933 additions and 930 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ makeCloudAt
-> Point3 -- start position
-> World
-> World
makeCloudAt drawFunc rad t alt p = clouds .:~ Cloud
makeCloudAt drawFunc rad t alt p = cWorld . clouds .:~ Cloud
--makeCloudAt drawFunc rad t alt p = clouds %~ S.cons Cloud
{ _clPos = p
, _clVel = V3 0 0 0
+1 -1
View File
@@ -14,6 +14,6 @@ damThingHitWith
-> World
-> World
damThingHitWith partDT sp ep mayEiCrWl = case mayEiCrWl of
Just (hitp,Left cr) -> creatures . ix (_crID cr) . crState . csDamage .:~ partDT sp hitp ep
Just (hitp,Left cr) -> cWorld . 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
@@ -58,7 +58,7 @@ makeFlameExplosionAt
-> World
makeFlameExplosionAt p w
= soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing w
& flames .++~ newFlames
& cWorld . flames .++~ newFlames
where
newFlames = zipWith makeFlameWithVelAndTime velocities timers
makeFlameWithVelAndTime vel time = aFlameParticle time p vel
@@ -71,7 +71,7 @@ makeExplosionAt :: Point2 -> World -> World
makeExplosionAt p w = w
& soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing
& addFlames
& tempLightSources .:~ theTLS
& cWorld . 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
@@ -23,7 +23,7 @@ import LensHelp
import System.Random
muzFlareAt :: Color -> Point3 -> Float -> World -> World
muzFlareAt col tranv dir w = w & flares .:~ MuzFlare
muzFlareAt col tranv dir w = w & cWorld . flares .:~ MuzFlare
{ _flarePoly = map (rotateV dir)
[ V2 0 0
, V2 a (-b)
@@ -37,7 +37,7 @@ muzFlareAt col tranv dir w = w & flares .:~ MuzFlare
(a:b:c:d:_) = randomRs (2,20) (_randGen w)
flareCircleAt :: Color -> Float -> Point3 -> World -> World
flareCircleAt col alphax tranv = flares .:~ CircFlare
flareCircleAt col alphax tranv = cWorld . flares .:~ CircFlare
{ _flareTime = 2
, _flareColor = col
, _flareAlpha = alphax
@@ -46,4 +46,4 @@ flareCircleAt col alphax tranv = flares .:~ CircFlare
explosionFlashAt :: Point2 -> World -> World
explosionFlashAt p = tempLightSources .:~ tlsTimeRadFunPos 20 150 (TLSFade 1 10) (addZ 20 p)
explosionFlashAt p = cWorld . tempLightSources .:~ tlsTimeRadFunPos 20 150 (TLSFade 1 10) (addZ 20 p)
+2 -2
View File
@@ -17,7 +17,7 @@ makeShockwaveAt
-> Color -- ^ Color of shockwave.
-> World -- ^ Start world.
-> World
makeShockwaveAt is p rad dam push col = shockwaves .:~ Shockwave
makeShockwaveAt is p rad dam push col = cWorld . shockwaves .:~ Shockwave
{ _swInvulnerableCrs = is
, _swDirection = OutwardShockwave
, _swColor = col
@@ -37,7 +37,7 @@ inverseShockwaveAt
-> Float -- Push amount
-> World
-> World
inverseShockwaveAt p rad dam push = shockwaves .:~ Shockwave
inverseShockwaveAt p rad dam push = cWorld . shockwaves .:~ Shockwave
{ _swDirection = InwardShockwave
, _swInvulnerableCrs = []
, _swColor = cyan
+3 -4
View File
@@ -19,13 +19,13 @@ import LensHelp
-- (thepart,g) = runState (f p) (_randGen w)
randEnergyBallAt :: (Point2 -> State StdGen EnergyBall) -> Point2 -> World -> World
randEnergyBallAt f p w = w
& energyBalls .:~ thepart
& cWorld . energyBalls .:~ thepart
& randGen .~ g
where
(thepart,g) = runState (f p) (_randGen w)
makeStaticBall :: Point2 -> World -> World
makeStaticBall p = randEnergyBallAt aStaticBall p . (posEvents .:~ thesparker)
makeStaticBall p = randEnergyBallAt aStaticBall p . (cWorld . posEvents .:~ thesparker)
where
thesparker = PosEvent SparkSpawner 10 p
@@ -84,8 +84,7 @@ makeGasCloud
-> World
-> World
makeGasCloud pos vel w = w
& clouds .:~ theCloud
-- & clouds %~ S.cons theCloud
& cWorld . clouds .:~ theCloud
& randGen .~ g
where
theCloud = Cloud
+1 -1
View File
@@ -48,7 +48,7 @@ crsHit sp ep w
| sp == ep = mempty
| otherwise = sortOn (dist sp . fst)
. overlap1SegCrs sp ep
. mapMaybe (\cid -> w ^? creatures . ix cid)
. mapMaybe (\cid -> w ^? cWorld . creatures . ix cid)
. IS.toList
. crsNearSeg sp ep
$ w