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
+14 -22
View File
@@ -31,42 +31,39 @@ aFlameParticle
:: Int -- ^ Timer
-> Point2 -- ^ Position
-> Point2 -- ^ Velocity
-> Maybe Int -- ^ Creature id
-> Particle
aFlameParticle t pos vel maycid = PtFlame
{ _ptUpdate = moveFlame vel
aFlameParticle t pos vel = PtFlame
{ _ptUpdate = moveFlame
, _ptVel = vel
, _ptColor = red
, _ptPos = pos
, _ptCrIgnore = maycid
, _ptWidth = 4
, _ptTimer = t
, _ptHitEff = expireAndDamage $ simpleDam FLAMING 20
, _ptHitEff = expireAndDamage $ simpleDam FLAMING 1
, _ptZ = 20
, _ptOriginalVel = vel
}
{- TODO: add generalised area damage particles/hiteffects. -}
moveFlame :: Point2 -- ^ Rotation direction
-> World
moveFlame :: World
-> Particle
-> (World, Maybe Particle)
moveFlame rotd w pt
moveFlame w pt
| time <= 0 = (makeFlamerSmokeAt (addZ 20 ep) w, Nothing)
| otherwise = case runIdentity . S.head_ $ thingsHitExceptCr (_ptCrIgnore pt) sp ep w of
| otherwise = case runIdentity . S.head_ $ thingsHit sp ep w of
Just (_,Left _) -> (doSound $ dodamage w , mvPt' 0.7)
Just (p,Right wl) -> (doSound $ dodamage w , rfl wl p)
_ -> (ptFlicker pt $ doSound $ dodamage w , mvPt' 0.98)
where
rotd = _ptOriginalVel pt
time = _ptTimer pt
doSound = soundContinue Flame (V2 x y) fireLoudS (Just 2)
sp@(V2 x y) = _ptPos pt
vel = _ptVel pt
ep = sp +.+ vel
mvPt' speed = Just $ pt
{ _ptTimer = time - 1
, _ptPos = ep
, _ptCrIgnore = Nothing
, _ptVel = speed *.* vel }
mvPt' drag = Just $ pt
& ptTimer -~ 1
& ptPos .~ ep
& ptVel %~ (drag *.*)
dodamage = damageInArea closeCrs closeWls pt
closeWls wl = uncurry segOnCirc (_wlLine wl) ep 5
closeCrs cr = dist ep (_crPos cr)
@@ -102,7 +99,6 @@ aStaticBall p = return PtStaticBall
, _ptVel = 0
, _ptColor = blue
, _ptPos = p
, _ptCrIgnore = Nothing
, _ptWidth = 3
, _ptTimer = 20
, _ptHitEff = expireAndDamage $ simpleDam ELECTRICAL 20
@@ -113,22 +109,20 @@ makeFlamelet
:: Point2 -- ^ Position
-> Float -- ^ z position
-> Point2 -- ^ Velocity
-> Maybe Int -- ^ Ignore creature id
-> Float -- ^ Size
-> Int -- ^ Timer
-> World
-> World
makeFlamelet (V2 x y) z vel maycid size time w = w
makeFlamelet (V2 x y) z vel size time w = w
& randGen .~ g
& instantParticles .:~ PtIncBall
{ _ptUpdate = moveFlamelet
, _ptVel = vel
, _ptColor = red
, _ptPos = V2 x y
, _ptCrIgnore = maycid
, _ptWidth = size
, _ptTimer = time
, _ptHitEff = expireAndDamage $ simpleDam FLAMING 20
, _ptHitEff = expireAndDamage $ simpleDam FLAMING 1
, _ptZ = z
, _ptRot = rot
}
@@ -218,10 +212,9 @@ incBall p = do
, _ptVel = 0
, _ptColor = red
, _ptPos = p
, _ptCrIgnore = Nothing
, _ptWidth = 3
, _ptTimer = 20
, _ptHitEff = expireAndDamage $ simpleDam FLAMING 20
, _ptHitEff = expireAndDamage $ simpleDam FLAMING 1
, _ptZ = 20
, _ptRot = rot
}
@@ -237,5 +230,4 @@ moveFlamelet w pt
mvPt' = pt
& ptTimer -~ 1
& ptPos .~ _ptPos pt +.+ _ptVel pt
& ptCrIgnore .~ Nothing
& ptVel .*.*~ 0.8