Remove old datatypes, change ammomag inv text colour

This commit is contained in:
2024-06-22 12:15:10 +01:00
parent 8e127f0603
commit e977673aa2
8 changed files with 13 additions and 22 deletions
+1 -1
View File
@@ -1 +1 @@
All good (615 modules, at 12:03:22) All good (615 modules, at 12:12:25)
+1 -1
View File
@@ -22,7 +22,7 @@ digraph {
28 [shape=box 28 [shape=box
,label="EQUIP {_ibtEquip = TARGETINGHAT TargetCursor}"]; ,label="EQUIP {_ibtEquip = TARGETINGHAT TargetCursor}"];
31 [shape=box 31 [shape=box
,label="ATTACH {_ibtAttach = AMMOATTACH TINMAG}"]; ,label="AMMOMAG {_ibtAmmoMag = TINMAG}"];
35 [shape=box 35 [shape=box
,label="HELD {_ibtHeld = BANGSTICK {_xNum = 1}}"]; ,label="HELD {_ibtHeld = BANGSTICK {_xNum = 1}}"];
39 [shape=box 39 [shape=box
+1 -1
View File
@@ -56,7 +56,7 @@ data ItemUse
| AttachUse | AttachUse
{_attachParams :: AttachParams} {_attachParams :: AttachParams}
| AmmoMagUse | AmmoMagUse
{ _amagLoadStatus :: InternalAmmo { _amagLoadStatus :: ReloadStatus
, _amagParams :: AmmoParams } , _amagParams :: AmmoParams }
--deriving (Eq, Show, Read) --Generic, Flat) --deriving (Eq, Show, Read) --Generic, Flat)
+3 -12
View File
@@ -25,14 +25,7 @@ data HeldConsumption
| NoConsumption | NoConsumption
deriving (Eq, Show, Read) --Generic, Flat) deriving (Eq, Show, Read) --Generic, Flat)
data AmmoSource data ReloadStatus = ReloadStatus
= InternalSource InternalAmmo
| AboveSource
| BelowSource
| EitherSource
deriving (Eq, Show, Read) --Generic, Flat)
data InternalAmmo = InternalAmmo
{ _iaMax :: Int { _iaMax :: Int
, _iaLoaded :: Int , _iaLoaded :: Int
, _iaPrimed :: Bool , _iaPrimed :: Bool
@@ -64,10 +57,8 @@ newtype ItAmount = ItAmount {_getItAmount :: Int}
makeLenses ''HeldConsumption makeLenses ''HeldConsumption
makeLenses ''LeftConsumption makeLenses ''LeftConsumption
makeLenses ''ItAmount makeLenses ''ItAmount
makePrisms ''AmmoSource makeLenses ''ReloadStatus
makeLenses ''InternalAmmo deriveJSON defaultOptions ''ReloadStatus
deriveJSON defaultOptions ''InternalAmmo
deriveJSON defaultOptions ''AmmoSource
deriveJSON defaultOptions ''HeldConsumption deriveJSON defaultOptions ''HeldConsumption
deriveJSON defaultOptions ''LeftConsumption deriveJSON defaultOptions ''LeftConsumption
deriveJSON defaultOptions ''ItAmount deriveJSON defaultOptions ''ItAmount
+2 -2
View File
@@ -15,7 +15,7 @@ tinMag =
.~ AmmoMagUse .~ AmmoMagUse
{ _amagParams = BulletParams defaultBullet { _amagParams = BulletParams defaultBullet
, _amagLoadStatus = , _amagLoadStatus =
InternalAmmo ReloadStatus
{ _iaMax = 15 { _iaMax = 15
, _iaLoaded = 15 , _iaLoaded = 15
, _iaPrimed = True , _iaPrimed = True
@@ -51,7 +51,7 @@ shellMag =
.~ AmmoMagUse .~ AmmoMagUse
{ _amagParams = BulletParams defaultBullet { _amagParams = BulletParams defaultBullet
, _amagLoadStatus = , _amagLoadStatus =
InternalAmmo ReloadStatus
{ _iaMax = 15 { _iaMax = 15
, _iaLoaded = 15 , _iaLoaded = 15
, _iaPrimed = True , _iaPrimed = True
+1 -1
View File
@@ -171,7 +171,7 @@ showReloadProgress _ itm = fromMaybe [] $ do
-- where -- where
-- ic = itm ^?! itUse . heldConsumption -- ic = itm ^?! itUse . heldConsumption
showLoadActionType :: LoadAction -> InternalAmmo -> String showLoadActionType :: LoadAction -> ReloadStatus -> String
showLoadActionType la as = case la of showLoadActionType la as = case la of
LoadEject{} -> "E" LoadEject{} -> "E"
LoadInsert{} -> "L" LoadInsert{} -> "L"
+1 -1
View File
@@ -12,4 +12,4 @@ itemInvColor itm = case itm ^. itType . iyBase of
CONSUMABLE {} -> blue CONSUMABLE {} -> blue
CRAFT {} -> green CRAFT {} -> green
ATTACH {} -> orange ATTACH {} -> orange
AMMOMAG {} -> greyN 0.5 AMMOMAG {} -> greyN 0.8
+3 -3
View File
@@ -56,7 +56,7 @@ tryStartLoading cr = fromMaybe cr $ do
-- InternalSource ia -> return $ startLoading ia cr -- InternalSource ia -> return $ startLoading ia cr
-- AboveSource -> return cr -- AboveSource -> return cr
startLoading :: InternalAmmo -> Creature -> Creature startLoading :: ReloadStatus -> Creature -> Creature
startLoading ic cr = case ic ^? iaProgress . _Just . ix 0 of startLoading ic cr = case ic ^? iaProgress . _Just . ix 0 of
Just la -> cr & startLoadingStep la Just la -> cr & startLoadingStep la
Nothing -> case ic ^. iaCycle of Nothing -> case ic ^. iaCycle of
@@ -71,13 +71,13 @@ startLoading ic cr = case ic ^? iaProgress . _Just . ix 0 of
startLoadingStep :: LoadAction -> Creature -> Creature startLoadingStep :: LoadAction -> Creature -> Creature
startLoadingStep la cr = cr & crManipulation . manObject . inInventory . iselAction .~ ReloadAction (_actionTime la) la startLoadingStep la cr = cr & crManipulation . manObject . inInventory . iselAction .~ ReloadAction (_actionTime la) la
rotateActionProgress :: InternalAmmo -> InternalAmmo rotateActionProgress :: ReloadStatus -> ReloadStatus
rotateActionProgress ic = case ic ^. iaProgress of rotateActionProgress ic = case ic ^. iaProgress of
Just (_ : la : las) -> ic & iaProgress . _Just .~ (la : las) Just (_ : la : las) -> ic & iaProgress . _Just .~ (la : las)
_ | _iaLoaded ic < _iaMax ic -> ic & iaProgress ?~ _iaCycle ic _ | _iaLoaded ic < _iaMax ic -> ic & iaProgress ?~ _iaCycle ic
_ -> ic & iaProgress .~ Nothing _ -> ic & iaProgress .~ Nothing
doLoadAction :: LoadAction -> InternalAmmo -> InternalAmmo doLoadAction :: LoadAction -> ReloadStatus -> ReloadStatus
doLoadAction la ic = case la of doLoadAction la ic = case la of
LoadEject{} -> ic & iaLoaded .~ 0 & iaPrimed .~ False LoadEject{} -> ic & iaLoaded .~ 0 & iaPrimed .~ False
LoadInsert{} -> ic & iaLoaded .~ _iaMax ic LoadInsert{} -> ic & iaLoaded .~ _iaMax ic