Move bullets into own data type
This commit is contained in:
+34
-13
@@ -141,6 +141,8 @@ data World = World
|
||||
, _gusts :: IM.IntMap Gust
|
||||
, _gsZoning :: Zoning IM.IntMap Gust
|
||||
, _props :: IM.IntMap Prop
|
||||
, _instantBullets :: [Bullet]
|
||||
, _bullets :: [Bullet]
|
||||
, _instantParticles :: [Particle]
|
||||
, _particles :: [Particle]
|
||||
, _radarBlips :: [RadarBlip]
|
||||
@@ -229,7 +231,7 @@ data Magnet = Magnet
|
||||
{ _mgID :: Int
|
||||
, _mgUpdate :: Magnet -> Maybe Magnet
|
||||
, _mgPos :: Point2
|
||||
, _mgField :: Magnet -> Particle -> Particle
|
||||
, _mgField :: Magnet -> Bullet -> Bullet
|
||||
}
|
||||
|
||||
data OptionScreenFlag = NormalOptions | GameOverOptions
|
||||
@@ -522,6 +524,17 @@ data BeamType
|
||||
{_beamCombine :: (Point2 , (Point2,Point2,Beam) , (Point2,Point2,Beam)) -> World -> World}
|
||||
| BeamSimple
|
||||
|
||||
data Bullet = Bullet
|
||||
{ _buUpdate :: World -> Bullet -> (World, Maybe Bullet)
|
||||
, _buVel :: Point2
|
||||
, _buDrag :: Float
|
||||
, _buColor :: Color
|
||||
, _buTrail :: [Point2]
|
||||
, _buWidth :: Float
|
||||
, _buTimer :: Int
|
||||
, _buHitEff :: HitEffect'
|
||||
}
|
||||
|
||||
{- Objects without ids.
|
||||
Update themselves, perhaps with side effects. -}
|
||||
data Particle
|
||||
@@ -540,6 +553,16 @@ data Particle
|
||||
, _ptPhaseV :: Float
|
||||
, _ptPoints :: [Point2]
|
||||
}
|
||||
| PtSpark
|
||||
{ _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
, _ptVel :: Point2
|
||||
, _ptDrag :: Float
|
||||
, _ptColor :: Color
|
||||
, _ptTrail :: [Point2]
|
||||
, _ptWidth :: Float
|
||||
, _ptTimer :: Int
|
||||
, _ptHitEff :: HitEffect
|
||||
}
|
||||
| PtTeslaArc
|
||||
{ _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
, _ptPoints :: [Point2]
|
||||
@@ -551,16 +574,6 @@ data Particle
|
||||
, _ptPoints :: [Point2]
|
||||
, _ptColor :: Color
|
||||
}
|
||||
| BulletPt
|
||||
{ _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
, _ptVel :: Point2
|
||||
, _btDrag :: Float
|
||||
, _ptColor :: Color
|
||||
, _ptTrail :: [Point2]
|
||||
, _ptWidth :: Float
|
||||
, _ptTimer :: Int
|
||||
, _ptHitEff :: HitEffect
|
||||
}
|
||||
| PtFlame
|
||||
{ _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
, _ptVel :: Point2
|
||||
@@ -625,6 +638,11 @@ 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
|
||||
@@ -641,7 +659,7 @@ data AmmoType
|
||||
}
|
||||
| BulletAmmo
|
||||
{ _amString :: String
|
||||
, _amBulEff :: HitEffect
|
||||
, _amBulEff :: HitEffect'
|
||||
, _amBulWth :: Float
|
||||
, _amBulVel :: Point2
|
||||
, _amBulTraj :: BulletTrajectory
|
||||
@@ -1230,9 +1248,11 @@ data DamageEffect
|
||||
}
|
||||
| TorqueDamage { _deTorque :: Float }
|
||||
| PushBackDamage {_dePushBack :: Point2 }
|
||||
| BounceBullet {_bulToBounce :: Particle}
|
||||
| BounceBullet {_bulToBounce :: Bullet}
|
||||
| DamageSpawn {_spawnFunc
|
||||
:: Either Creature Wall -> Damage -> State StdGen Particle}
|
||||
| DamageSpawn' {_spawnFunc'
|
||||
:: Either Creature Wall -> Damage -> State StdGen Bullet}
|
||||
| NoDamageEffect
|
||||
-- deriving (Eq,Ord,Show)
|
||||
|
||||
@@ -1388,6 +1408,7 @@ makeLenses ''TweakParam
|
||||
makeLenses ''Prop
|
||||
makeLenses ''Modification
|
||||
makeLenses ''Particle
|
||||
makeLenses ''Bullet
|
||||
makeLenses ''PressPlate
|
||||
makeLenses ''Button
|
||||
makeLenses ''ActionPlan
|
||||
|
||||
Reference in New Issue
Block a user