Remove ptCrIgnore

This commit is contained in:
2022-07-13 11:26:13 +01:00
parent 6c50021f04
commit cede677560
17 changed files with 42 additions and 58 deletions
+1 -3
View File
@@ -14,21 +14,19 @@ aBulAt
:: Maybe Float -- ^ Start velocity step factor
-> (Particle -> Particle)
-> Maybe Color
-> Maybe Int -- ^ Pass-through creature id
-> Point2 -- ^ Start position
-> Point2 -- ^ Velocity
-> Float -- ^ Drag
-> HitEffect
-> Float -- ^ Bullet width
-> Particle
aBulAt vfact updatemod mcol maycid pos vel drag hiteff width = BulletPt
aBulAt vfact updatemod mcol pos vel drag hiteff width = BulletPt
{ _ptUpdate = theupdate
, _ptVel = fromMaybe 1 vfact *.* vel
, _btDrag = drag
, _ptColor = fromMaybe (V4 200 200 200 2) mcol
-- , _ptColor = V4 2 2 2 2
, _ptTrail = [pos]
, _ptCrIgnore = maycid
, _ptWidth = width
, _ptTimer = 100
, _ptHitEff = hiteff
+1 -2
View File
@@ -16,12 +16,11 @@ mvBullet :: World -> Particle -> (World, Maybe Particle)
mvBullet w bt'
| t <= 0 || magV (_ptVel bt) < 1 = (w,Nothing)
| otherwise = second (fmap dodrag) $
hiteff bt (thingsHitExceptCr mcr p (p +.+ vel) w) w
hiteff bt (thingsHit p (p +.+ vel) w) w
where
bt = foldr (\mg b -> _mgField mg mg b) bt' $ _magnets w
dodrag = ptVel .*.*~ drag
drag = _btDrag bt
mcr = _ptCrIgnore bt
(p:_) = _ptTrail bt
vel = _ptVel bt
hiteff = _ptHitEff bt
+2 -1
View File
@@ -7,7 +7,8 @@ import LensHelp
import System.Random
makeFlame :: Point2 -> Point2 -> World -> World
makeFlame pos vel w = w & instantParticles .:~ aFlameParticle t pos vel Nothing
makeFlame pos vel w = w
& instantParticles .:~ aFlameParticle t pos vel
& randGen .~ g
where
(t,g) = randomR (99,101) (_randGen w)
+2 -5
View File
@@ -18,14 +18,13 @@ import Control.Monad.State
import System.Random
--import Control.Lens
-- TODO remove/simplify this function
createBarrelSpark :: Point2 -> Float -> Maybe Int -> Int -> Int -> World -> World
createBarrelSpark pos dir maycid time colid = instantParticles .:~ BulletPt
createBarrelSpark :: Point2 -> Float -> Int -> Int -> World -> World
createBarrelSpark pos dir time colid = instantParticles .:~ BulletPt
{ _ptUpdate = mvBullet
, _ptVel = rotateV dir (V2 5 0)
, _btDrag = 0.9
, _ptColor = numColor colid
, _ptTrail = [pos]
, _ptCrIgnore = maycid
, _ptWidth = 1
, _ptTimer = time
, _ptHitEff = expireAndDamage basicSparkDams
@@ -55,7 +54,6 @@ randColDirTimeSpark randcol randdir randtime pos w = w
, _ptVel = rotateV dir (V2 5 0)
, _ptColor = col
, _ptTrail = [pos]
, _ptCrIgnore = Nothing
, _ptWidth = 1
, _ptTimer = time
, _ptHitEff = expireAndDamage basicSparkDams
@@ -74,7 +72,6 @@ colSparkRandDir randDir time col pos baseDir w = w
, _ptVel = rotateV dir (V2 5 0)
, _ptColor = col
, _ptTrail = [pos]
, _ptCrIgnore = Nothing
, _ptWidth = 1
, _ptTimer = time
, _ptHitEff = expireAndDamage basicSparkDams
-1
View File
@@ -7,7 +7,6 @@ mvPt :: Particle -> Maybe Particle
mvPt pt = Just $ pt
& ptTrail %~ f
& ptTimer -~ 1
& ptCrIgnore .~ Nothing
where
f trl = head trl +.+ _ptVel pt : trl