Partial removal of reloading

This commit is contained in:
2024-09-08 10:21:35 +01:00
parent 581d2494dc
commit e03c8dd830
16 changed files with 256 additions and 187 deletions
-10
View File
@@ -19,9 +19,6 @@ tinMag =
ReloadStatus
{ _iaMax = 15
, _iaLoaded = 15
, _iaPrimed = True
, _iaCycle = [loadEject 10, loadInsert 10, loadPrime 10]
, _iaProgress = Nothing
}
}
@@ -31,7 +28,6 @@ revolveMag =
& itType . iyBase .~ AMMOMAG REVOLVEMAG
& itUse . amagLoadStatus . iaMax .~ 6
& itUse . amagLoadStatus . iaLoaded .~ 6
& itUse . amagLoadStatus . iaCycle .~ [loadPartialInsert 10 1]
drumMag :: Item
drumMag =
@@ -59,9 +55,6 @@ shellMag =
ReloadStatus
{ _iaMax = 1
, _iaLoaded = 1
, _iaPrimed = True
, _iaCycle = [loadEject 10, loadInsert 10, loadPrime 10]
, _iaProgress = Nothing
}
, _amagType = ProjectileAmmo
}
@@ -77,8 +70,5 @@ battery =
ReloadStatus
{ _iaMax = 100
, _iaLoaded = 100
, _iaPrimed = True
, _iaCycle = [loadEject 10, loadInsert 10, loadPrime 10]
, _iaProgress = Nothing
}
}
+19 -16
View File
@@ -123,8 +123,8 @@ itemNumberDisplay cr itm = case iu of
EquipUse{} -> showEquipmentNumber cr itm
CraftUse x -> [show $ x ^. getItAmount]
ConsumeUse {_useAmount = x} -> [show $ x ^. getItAmount]
AttachUse {} -> [showReloadProgress cr itm]
AmmoMagUse {} -> [showReloadProgress cr itm]
AttachUse {} -> [] --[showReloadProgress cr itm]
AmmoMagUse {} -> [showLoadedAmount itm]
-- this could be cleaner here...
where
iu = itm ^?! itUse
@@ -152,12 +152,15 @@ showEquipmentNumber _ itm = case _eeUse ee of
-- )
-- <|> Just [x]
showReloadProgress :: Creature -> Item -> String
showReloadProgress _ itm = fromMaybe [] $ do
ia <- itm ^? itUse . amagLoadStatus
return $ case ia ^? iaProgress . _Just . ix 0 of
Nothing -> maybe "" show $ ia ^? iaLoaded
Just la -> showLoadActionType la ia
showLoadedAmount :: Item -> String
showLoadedAmount itm = fromMaybe [] $ fmap show $ itm ^? itUse . amagLoadStatus . iaLoaded
--showReloadProgress :: Creature -> Item -> String
--showReloadProgress _ itm = fromMaybe [] $ do
-- ia <- itm ^? itUse . amagLoadStatus
-- return $ case ia ^? iaProgress . _Just . ix 0 of
-- Nothing -> maybe "" show $ ia ^? iaLoaded
-- Just la -> showLoadActionType la ia
--showReloadProgress :: Creature -> Item -> String
--showReloadProgress cr itm = case ic ^? laSource of
-- Just (InternalSource ia) -> case ia ^? iaProgress . _Just . ix 0 of
@@ -171,14 +174,14 @@ showReloadProgress _ itm = fromMaybe [] $ do
-- where
-- ic = itm ^?! itUse . heldConsumption
showLoadActionType :: LoadAction -> ReloadStatus -> String
showLoadActionType la as = case la of
LoadEject{} -> "E"
LoadInsert{} -> "L"
LoadAdd{} -> "A" ++ x
LoadPrime{} -> "P"
where
x = maybe "" show $ as ^? iaLoaded
--showLoadActionType :: LoadAction -> ReloadStatus -> String
--showLoadActionType la as = case la of
-- LoadEject{} -> "E"
-- LoadInsert{} -> "L"
-- LoadAdd{} -> "A" ++ x
-- LoadPrime{} -> "P"
-- where
-- x = maybe "" show $ as ^? iaLoaded
maybeWarmupStatus :: Item -> Maybe String
maybeWarmupStatus it = case it ^? itUse . heldDelay . warmMax of
+1 -1
View File
@@ -148,7 +148,7 @@ ammoCheckI eff ams itm cr w = fromMaybe (failsound w) $ do
matype <- ams ^? ix 0 . itUse . amagType
iatype <- itm ^? itUse . heldConsumption . ix 0
guard $ matype == iatype
return $ eff ams itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
return $ eff ams itm cr $ w -- & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
where
failsound = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
Just 0 -> soundStart (CrReloadSound (_crID cr)) (_crPos cr) click1S Nothing