Start restructuring Item datatype

This commit is contained in:
2021-11-27 12:48:23 +00:00
parent fe37f208da
commit bfdac2fad5
16 changed files with 56 additions and 55 deletions
+15 -14
View File
@@ -289,19 +289,20 @@ data FloorItem = FlIt { _flIt :: Item , _flItPos :: Point2 , _flItRot :: Float,
data ItemPos
= InInv { _itCrId :: Int , _itInvId :: Int }
| OnFloor { _itFlID :: Int }
data Item' = Item'
{ _iName :: String
, _iIdentity :: ItemIdentity
, _iType :: Item
, _iID :: Int
, _itPos :: ItemPos
}
data ItemUse
= RightUse { _rUse :: Item -> Creature -> World -> World }
| LeftUse { _lUse :: Creature -> Int -> World -> World }
| NoUse
data ItemAmmo
= LoadbleAmmo
{ _aoType :: AmmoType
}
data Item
= Weapon
{ _itName :: String
, _wpMaxAmmo :: Int
, _wpLoadedAmmo :: Int
, _wpAmmo :: Ammo
, _wpAmmo :: AmmoType
, _wpReloadTime :: Int
, _wpReloadState :: Int
, _wpReloadType :: ReloadType
@@ -311,8 +312,7 @@ data Item
, _wpCurCoolDown :: Int
, _itUseRate :: Int
, _itUseTime :: Int
, _itUse :: Either (Creature -> Int -> World -> World)
(Item -> Creature -> World -> World)
, _itUse :: ItemUse
, _itUseModifiers :: [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
--, _itLeftClickUse :: Maybe (Creature -> Int -> World -> World)
, _wpSpread :: Float
@@ -394,8 +394,7 @@ data Item
, _itFloorPict :: Item -> SPic
, _twMaxRange :: Float
, _twAccuracy :: Float
, _itUse :: Either (Creature -> Int -> World -> World)
(Item -> Creature -> World -> World)
, _itUse :: ItemUse
, _itUseRate :: Int
, _itUseTime :: Int
, _itUseModifiers :: [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
@@ -509,7 +508,7 @@ type HitEffect = Particle
-> World
-> (World,Maybe Particle)
data Ammo
data AmmoType
= ShellAmmo
{ _amPayload :: Point2 -> World -> World
, _amString :: String
@@ -858,11 +857,13 @@ makeLenses ''Creature
makeLenses ''LightSource
makeLenses ''TempLightSource
makeLenses ''Item
makeLenses ''ItemUse
makeLenses ''ItemPos
makeLenses ''ItEffect
makeLenses ''ItZoom
makeLenses ''FloorItem
makeLenses ''Ammo
makeLenses ''ItemAmmo
makeLenses ''AmmoType
makeLenses ''PjParam
makeLenses ''Prop
makeLenses ''Modification