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