Refactor items, suspect a leak

This commit is contained in:
2022-07-21 00:50:50 +01:00
parent e2ccf7296a
commit 22787abf8f
5 changed files with 165 additions and 136 deletions
+2 -104
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.Item.Params
, module Dodge.Data.Beam
, module Dodge.Data.Targeting
, module Dodge.Data.ItEffect
@@ -67,6 +68,7 @@ module Dodge.Data
, module Dodge.Data.RadarBlip
, module Dodge.Data.PathGraph
) where
import Dodge.Data.Item.Params
import Dodge.Data.Beam
import Dodge.Data.Targeting
import Dodge.Data.ItEffect
@@ -417,25 +419,6 @@ data PressPlate = PressPlate
}
data FloorItem = FlIt { _flIt :: Item , _flItPos :: Point2 , _flItRot :: Float, _flItID :: Int}
data Item = Item
{ _itConsumption :: ItemConsumption
, _itUse :: ItemUse
, _itType :: ItemType
, _itAttachment :: ItAttachment
, _itID :: Maybe Int
, _itPos :: ItemPos
, _itIsHeld :: Bool
, _itEffect :: ItEffect
, _itInvSize :: Float
, _itInvColor :: Color
, _itTargeting :: Targeting
, _itDimension :: ItemDimension
, _itCurseStatus :: CurseStatus
, _itTweaks :: ItemTweaks
, _itScope :: Scope
, _itValue :: ItemValue
, _itParams :: ItemParams
}
data IntID a = IntID Int a
@@ -504,87 +487,6 @@ type HitEffect' = Flame
-> World
-> (World,Maybe Flame)
data ItemTweaks
= NoTweaks
| Tweakable
{ _tweakParams :: IM.IntMap TweakParam
, _tweakSel :: Int
}
data TweakParam = TweakParam
{ _doTweak :: Int -> Item -> Item
, _curTweak :: Int
, _maxTweak :: Int
, _showTweak :: Int -> String
, _nameTweak :: String
}
data Nozzle = Nozzle
{ _nzPressure :: Float
, _nzDir :: Float
, _nzMaxWalkAngle :: Float
, _nzCurrentWalkAngle :: Float
, _nzWalkSpeed :: Float
, _nzLength :: Float
}
data GunBarrels
= MultiBarrel
{ _brlSpread :: BarrelSpread
, _brlNum :: Int
, _brlInaccuracy :: Float
}
| RotBarrel
{ _brlNum :: Int
, _brlInaccuracy :: Float
}
| SingleBarrel {_brlInaccuracy :: Float}
data ItemParams
= NoParams
| ShellLauncher
{ _shellSpinDrag :: Int
, _shellSpinAmount :: Int
, _shellThrustDelay :: Int
}
| Refracting
{ _phaseV :: Float
, _lasColor :: Color
, _lasColor2 :: Color
, _lasCycle :: Int
, _lasDamage :: Int
}
| DualBeam
{ _phaseV :: Float
, _lasColor :: Color
, _lasColor2 :: Color
, _lasCycle :: Int
, _lasDamage :: Int
, _lasBeam :: BeamType
, _subParams :: Maybe ItemParams
, _dbGap :: Float
}
| Attracting {_attractionPower :: Point2}
| BulletShooter
{ _muzVel :: Float
, _rifling :: Float
, _bore :: Float
, _gunBarrels :: GunBarrels
, _recoil :: Float
, _torqueAfter :: Float
, _randomOffset :: Float
}
| Sprayer { _sprayNozzles :: [Nozzle] }
| AngleWalk
{ _maxWalkAngle :: Float
, _currentWalkAngle :: Float
, _walkSpeed :: Float
}
| Arcing
{ _currentArc :: Maybe [ArcStep]
, _arcSize :: Float
, _arcNumber :: Int
, _newArcStep :: NextArcStep --ItemParams -> World -> ArcStep -> State StdGen (Maybe ArcStep)
, _previousArcEffect :: PreviousArcEffect
}
| ParamMID {_paramMID :: Maybe Int}
data PreviousArcEffect = NoPreviousArcEffect | PerturbTillBreakPreviousArc
data Modification
= ModIDTimerPoint3Bool
{ _mdID :: Int
@@ -1175,9 +1077,7 @@ data InPlacement = InPlacement
makeLenses ''CreatureState
makeLenses ''World
makeLenses ''Creature
makeLenses ''Item
makeLenses ''FloorItem
makeLenses ''TweakParam
makeLenses ''Prop
makeLenses ''Proj
makeLenses ''Modification
@@ -1194,8 +1094,6 @@ makeLenses ''Terminal
makeLenses ''Machine
makeLenses ''MachineType
makeLenses ''Universe
makeLenses ''ItemParams
makeLenses ''ItemTweaks
makeLenses ''Gust
makeLenses ''GunBarrels
makeLenses ''Nozzle