Commit before apply different damage amounts to different materials
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user