Rethink item ammo to item consumables, start item type datatype

This commit is contained in:
2021-11-29 16:22:31 +00:00
parent 3a605b8156
commit f40d486d68
31 changed files with 238 additions and 193 deletions
+26 -15
View File
@@ -133,7 +133,7 @@ data ScreenLayer
= OptionScreen
{ _scTitle :: Universe -> String
, _scOptions :: [MenuOption]
, _scDefaultEff :: Universe -> IO (Maybe Universe) -- IO (Maybe Universe)?
, _scDefaultEff :: Universe -> IO (Maybe Universe)
, _scOptionFlag :: OptionScreenFlag
}
| ColumnsScreen String [(String,String)]
@@ -148,19 +148,19 @@ data ScreenLayer
data MenuOption
= Toggle
{ _moKey :: Scancode
, _moEff :: Universe -> Maybe Universe
, _moEff :: Universe -> IO (Maybe Universe)
, _moString :: Universe -> String
}
| Toggle2
{ _moKey1 :: Scancode
, _moEff1 :: Universe -> Maybe Universe
, _moEff1 :: Universe -> IO (Maybe Universe)
, _moKey2 :: Scancode
, _moEff2 :: Universe -> Maybe Universe
, _moEff2 :: Universe -> IO (Maybe Universe)
, _moString :: Universe -> String
}
| InvisibleToggle
{ _moKey :: Scancode
, _moEff :: Universe -> Maybe Universe
, _moEff :: Universe -> IO (Maybe Universe)
}
data InventoryMode
= TopInventory
@@ -332,9 +332,9 @@ data AimParams = AimParams
}
_itUseAimStance :: Item -> AimStance
_itUseAimStance = _aimStance . _useAim . _itUse
data ItemAmmo
data ItemConsumption
= LoadableAmmo
{ _aoType :: AmmoType
{ _aoType :: AmmoType
, _wpMaxAmmo :: Int
, _wpLoadedAmmo :: Int
, _wpReloadTime :: Int
@@ -345,28 +345,38 @@ data ItemAmmo
{ _wpMaxCharge :: Int
, _wpCharge :: Int
}
| ItemItselfConsumable
{ _itMaxStack' :: Int
, _itAmount' :: Int
}
data ItemType
= Weapon'
{ _wpSpread :: Float
, _wpRange :: Float
, _wpNumBarrels :: Int
}
| UtilityItem
| ConsumableItem
data Item
= Weapon
{ _itName :: String
, _wpAmmo :: ItemAmmo
{ _itName :: String
, _itConsumption :: ItemConsumption
, _itUse :: ItemUse
, _wpSpread :: Float
, _wpRange :: Float
, _itFloorPict :: Item -> SPic
, _itZoom :: ItZoom
, _itZoom :: ItZoom
, _itEquipPict :: Creature -> Int -> SPic
, _itScroll :: Float -> Creature -> Item -> Item
, _itIdentity :: ItemIdentity
, _itAttachment :: ItAttachment
, _itID :: Maybe Int
, _itID :: Maybe Int
, _itEffect :: ItEffect
, _itInvDisplay :: Item -> String
, _itInvColor :: Color
, _itTargeting :: Maybe (World -> Maybe Point2, Int -> Item -> Creature -> World -> Picture)
, _itWorldTrigger :: Maybe (Int -> World -> Bool)
, _wpNumBarrels :: Int
, _itDimension :: ItemDimension
, _itCurseStatus :: CurseStatus
, _itType :: ItemType
}
| Consumable
{ _itName :: String
@@ -880,7 +890,7 @@ makeLenses ''ItemPos
makeLenses ''ItEffect
makeLenses ''ItZoom
makeLenses ''FloorItem
makeLenses ''ItemAmmo
makeLenses ''ItemConsumption
makeLenses ''AmmoType
makeLenses ''PjParam
makeLenses ''Prop
@@ -907,3 +917,4 @@ makeLenses ''UseDelay
makeLenses ''AimParams
makeLenses ''Universe
makeLenses ''LSParam
makeLenses ''ItemType