Add bullet damages field, move bullet data into own file

This commit is contained in:
2022-07-17 21:45:26 +01:00
parent 6c6fe43bc0
commit bf023a61ce
11 changed files with 137 additions and 180 deletions
+3 -76
View File
@@ -10,6 +10,7 @@ circular imports are probably not a good idea.
{-# LANGUAGE DerivingStrategies #-}
module Dodge.Data
( module Dodge.Data
, module Dodge.Data.Bullet
, module Dodge.Data.Door
, module Dodge.Data.Item
, module Dodge.Data.HUD
@@ -46,6 +47,7 @@ module Dodge.Data
, module Dodge.Data.RadarBlip
, module Dodge.Data.PathGraph
) where
import Dodge.Data.Bullet
import Dodge.Data.Door
import Dodge.Data.Item
import Dodge.Data.HUD
@@ -524,34 +526,6 @@ data BeamType
{_beamCombine :: (Point2 , (Point2,Point2,Beam) , (Point2,Point2,Beam)) -> World -> World}
| BeamSimple
data BulletState = NormalBulletState
| DyingBulletState
| DelayedBullet Float
data BulletUpdateMod = NoBulletUpdateMod
data BulletEffect = DestroyBullet
| BounceBullet
| PenetrateBullet
data BulletSpawn = BulBall EnergyBall | BulSpark
data Bullet = Bullet
{ _buState :: BulletState
, _buEffect :: BulletEffect
, _buSpawn :: BulletSpawn
, _buUpdateMod :: BulletUpdateMod
, _buTrajectory :: BulletTrajectory
, _buVel :: Point2
, _buDrag :: Float
, _buPos :: Point2
, _buOldPos :: Point2
, _buWidth :: Float
, _buTimer :: Int
-- , _buEffect :: BulletEffect
-- , _buHitEff :: HitEffect'
}
data EnergyBall = IncBall | TeslaBall | ConcBall
{- Objects without ids.
Update themselves, perhaps with side effects. -}
data Particle
@@ -655,17 +629,6 @@ type HitEffect = Particle
-> World
-> (World,Maybe Particle)
--type HitEffect' = Bullet
-- -> Stream (Of (Point2, Either Creature Wall)) Identity ()
-- -> World
-- -> (World,Maybe Bullet)
data BulletTrajectory
= BasicBulletTrajectory
| BezierTrajectory Point2 Point2 Point2
| FlechetteTrajectory Point2
| MagnetTrajectory Point2
data AmmoType
= ProjectileAmmo
{ _amPayload :: Point2 -> World -> World
@@ -677,7 +640,7 @@ data AmmoType
| BulletAmmo
{ _amString :: String
-- , _amBulEff :: HitEffect'
, _amBulDams :: Bullet -> Point2 -> [Damage]
, _amBulDams :: [Damage]
, _amBulWth :: Float
, _amBulVel :: Point2
, _amBulTraj :: BulletTrajectory
@@ -1260,39 +1223,6 @@ data Goal
| SentinelAt Point2 Float
deriving (Show)
data DamageEffect
= PushDamage
{ _dePush :: Float
, _dePushExp :: Float
, _dePushRadius :: Float
}
| TorqueDamage { _deTorque :: Float }
| PushBackDamage {_dePushBack :: Point2 }
| DamageSpawn {_spawnFunc
:: Either Creature Wall -> Damage -> State StdGen Particle}
| DamageSpawn' {_spawnFunc'
:: Either Creature Wall -> Damage -> State StdGen Bullet}
| NoDamageEffect
-- deriving (Eq,Ord,Show)
data Damage = Damage
{ _dmType :: DamageType
, _dmAmount :: Int , _dmFrom :: Point2 , _dmAt :: Point2 , _dmTo :: Point2
, _dmEffect :: DamageEffect
}
-- deriving (Eq,Ord,Show)
isElectrical :: Damage -> Bool
isElectrical dm = case _dmType dm of
ELECTRICAL -> True
_ -> False
isMovementDam :: Damage -> Bool
isMovementDam dm = case _dmType dm of
TORQUEDAM -> True
PUSHDAM -> True
_ -> False
data CreatureState = CrSt
{ _csDamage :: [Damage]
, _csSpState :: CrSpState
@@ -1413,8 +1343,6 @@ data InPlacement = InPlacement
}
makeLenses ''CreatureState
makeLenses ''Damage
makeLenses ''DamageEffect
makeLenses ''World
makeLenses ''Creature
makeLenses ''Item
@@ -1427,7 +1355,6 @@ makeLenses ''TweakParam
makeLenses ''Prop
makeLenses ''Modification
makeLenses ''Particle
makeLenses ''Bullet
makeLenses ''PressPlate
makeLenses ''Button
makeLenses ''ActionPlan