Cleanup tesla arcs

This commit is contained in:
2022-03-24 08:05:58 +00:00
parent 64be9ee7a8
commit 11d954674c
8 changed files with 111 additions and 196 deletions
+3 -31
View File
@@ -6,42 +6,14 @@ module Dodge.Wall.Damage
, damageWall
) where
import Dodge.Data
import Dodge.Wall.Reflect
import Dodge.Wall.Dust
import Dodge.Particle.Spark
import Geometry
import Color
import LensHelp
damageWall :: Damage -> Wall -> World -> World
damageWall dt wl = case _wlStructure wl of
MachinePart mcid -> wallEff dt wl . (machines . ix mcid . mcDamage .:~ dt)
BlockPart blid -> wallEff dt wl . (blocks . ix blid %~ damageBlockWith dt)
MachinePart mcid -> _wlDamageEff wl dt wl . (machines . ix mcid . mcDamage .:~ dt)
BlockPart blid -> _wlDamageEff wl dt wl . (blocks . ix blid %~ damageBlockWith dt)
CreaturePart crid f -> f dt wl crid
_ -> wallEff dt wl
{- | Damage effects on indestructible walls -}
-- TODO take into account damage amount for amount of dust/sparks?
wallEff :: Damage -> Wall -> World -> World
wallEff dm wl = case _dmType dm of
Lasering -> colSpark 8 lSparkCol outTo (reflDirWall sp p wl)
Piercing -> colSparkRandDir 0.2 8 pSparkCol outTo (reflDirWall sp p wl)
. wlDustAt wl outTo
Blunt -> wlDustAt wl outTo
Explosive-> id
Cutting -> id
SparkDam -> id
Flaming -> id
Electrical -> id
Concussive -> id
TorqueDam -> id
PushDam -> id
PoisonDam -> id
where
sp = _dmFrom dm
p = _dmTo dm
outTo = p +.+ squashNormalizeV (sp -.- p)
pSparkCol = brightX 100 1.5 white
lSparkCol = V4 20 (-5) 0 1
_ -> _wlDamageEff wl dt wl
damageBlockWith :: Damage -> Block -> Block
damageBlockWith dm = case _dmType dm of