Commit before apply different damage amounts to different materials

This commit is contained in:
2025-10-24 09:28:09 +01:00
parent 8f17582889
commit b2265297b5
6 changed files with 71 additions and 104 deletions
+34 -32
View File
@@ -1,38 +1,40 @@
module Dodge.Item.Weapon.Shatter (shootShatter) where
import Linear
import Dodge.Base.Collide
import Dodge.Block.Debris
--import Linear
--import Dodge.Base.Collide
--import Dodge.Block.Debris
import Dodge.Data.World
import Dodge.Wall.Damage
import Geometry
import LensHelp
--import Dodge.Wall.Damage
--import Geometry
--import LensHelp
shootShatter :: Item -> Creature -> World -> World
shootShatter _ cr w =
maybe w (uncurry $ shatterWall w sp ep) $
sequence $
collidePointWallsFilter canshatter sp ep w
where
canshatter wl = case _wlOpacity wl of
Opaque {} -> True
SeeThrough -> True
_ -> False
sp = cr ^. crPos ._xy +.+ 10 *.* unitVectorAtAngle dir
-- the 10 is arbtrary and should be changed to a muzzle position
dir = _crDir cr
ep = sp +.+ 200 *.* unitVectorAtAngle dir
shatterWall :: World -> Point2 -> Point2 -> Point2 -> Wall -> World
shatterWall w sp ep p wl =
w
-- & makeDebris (_wlMaterial wl) (_wlColor wl) p
& makeDebris (_wlMaterial wl) p
& makeDebrisDirected
(pi / 2)
(argV $ vNormal $ uncurry (-) $ _wlLine wl)
(_wlMaterial wl)
-- (_wlColor wl)
p
& damageWall (Shattering 1000 p (ep - sp)) wl
shootShatter _ _ w = w
--shootShatter _ cr w =
-- maybe w (uncurry $ shatterWall w sp ep) $
-- sequence $
-- collidePointWallsFilter canshatter sp ep w
-- where
-- canshatter wl = case _wlOpacity wl of
-- Opaque {} -> True
-- SeeThrough -> True
-- _ -> False
-- sp = cr ^. crPos ._xy +.+ 10 *.* unitVectorAtAngle dir
-- -- the 10 is arbtrary and should be changed to a muzzle position
-- dir = _crDir cr
-- ep = sp +.+ 200 *.* unitVectorAtAngle dir
--
--shatterWall :: World -> Point2 -> Point2 -> Point2 -> Wall -> World
----shatterWall w sp ep p wl =
--shatterWall w sp ep p wl =
-- w
---- & makeDebris (_wlMaterial wl) (_wlColor wl) p
-- & makeDebris (_wlMaterial wl) p
-- & makeDebrisDirected
-- (pi / 2)
-- (argV $ vNormal $ uncurry (-) $ _wlLine wl)
-- (_wlMaterial wl)
---- (_wlColor wl)
-- p
---- & damageWall (Shattering 1000 p (ep - sp)) wl