Refactor, try to limit dependencies
This commit is contained in:
@@ -1,29 +1,19 @@
|
||||
module Dodge.Item.Weapon.Shatter where
|
||||
--import Dodge.WorldEvent.HitEffect
|
||||
--import Dodge.Item.Weapon.BulletGun.Clip
|
||||
import Dodge.Data
|
||||
import Dodge.Wall.Damage
|
||||
--import Dodge.SoundLogic
|
||||
import Dodge.Block.Debris
|
||||
|
||||
import Dodge.Base.Collide
|
||||
--import Dodge.Zone
|
||||
import Dodge.Block.Debris
|
||||
import Dodge.Creature.HandPos
|
||||
--import Dodge.ChainEffect
|
||||
import Dodge.Default.Weapon
|
||||
import Dodge.Data.World
|
||||
import Dodge.Wall.Damage
|
||||
import Geometry
|
||||
import LensHelp
|
||||
|
||||
shatterGun :: Item
|
||||
shatterGun = defaultWeapon
|
||||
& itType . iyBase .~ HELD SHATTERGUN
|
||||
& itUse . useDelay . rateMax .~ 10
|
||||
& itUse . rUse .~ HeldShatter --shootShatter
|
||||
& itUse . useMods .~ ShatterMod
|
||||
& itUse . useAim . aimStance .~ TwoHandFlat
|
||||
|
||||
shootShatter :: Item -> Creature -> World -> World
|
||||
shootShatter it cr w = maybe w (uncurry $ shatterWall w sp ep) $ sequence
|
||||
$ collidePointWallsFilterStream canshatter sp ep w
|
||||
shootShatter it cr w =
|
||||
maybe w (uncurry $ shatterWall w sp ep) $
|
||||
sequence $
|
||||
collidePointWallsFilterStream canshatter sp ep w
|
||||
where
|
||||
canshatter wl = case _wlOpacity wl of
|
||||
Opaque -> True
|
||||
@@ -34,9 +24,15 @@ shootShatter it cr w = maybe w (uncurry $ shatterWall w sp ep) $ sequence
|
||||
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
|
||||
& makeDebrisDirected 1 2 (pi/2) (argV $ vNormal $ uncurry (-.-) $ _wlLine wl) (_wlMaterial wl)
|
||||
(_wlColor wl) p
|
||||
& damageWall (Damage SHATTERING 1000 sp p ep NoDamageEffect) wl
|
||||
|
||||
shatterWall w sp ep p wl =
|
||||
w
|
||||
& makeDebris (_wlMaterial wl) (_wlColor wl) p
|
||||
& makeDebrisDirected
|
||||
1
|
||||
2
|
||||
(pi / 2)
|
||||
(argV $ vNormal $ uncurry (-.-) $ _wlLine wl)
|
||||
(_wlMaterial wl)
|
||||
(_wlColor wl)
|
||||
p
|
||||
& damageWall (Damage SHATTERING 1000 sp p ep NoDamageEffect) wl
|
||||
|
||||
Reference in New Issue
Block a user