Continue reload removal
This commit is contained in:
+1
-86
@@ -1,86 +1 @@
|
||||
/home/justin/Haskell/loop/src/Dodge/Creature/State.hs:26:1-22: warning: [-Wunused-imports]
|
||||
The import of ‘Dodge.Reloading’ is redundant
|
||||
|
|
||||
26 | import Dodge.Reloading
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
/home/justin/Haskell/loop/src/Dodge/Creature/Impulse/UseItem.hs:20:1-22: warning: [-Wunused-imports]
|
||||
The import of ‘Dodge.Reloading’ is redundant
|
||||
|
|
||||
20 | import Dodge.Reloading
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
/home/justin/Haskell/loop/src/Dodge/Creature/Impulse/UseItem.hs:118:5-14: warning: [-Wunused-local-binds]
|
||||
Defined but not used: ‘hammerTest’
|
||||
|
|
||||
118 | hammerTest f = case _crHammerPosition cr of
|
||||
| ^^^^^^^^^^
|
||||
/home/justin/Haskell/loop/src/Dodge/Creature/Impulse/UseItem.hs:121:5-15: warning: [-Wunused-local-binds]
|
||||
Defined but not used: ‘setuhamdown’
|
||||
|
|
||||
121 | setuhamdown = cWorld . lWorld . creatures . ix (_crID cr) . crHammerPosition .~ HammerDown
|
||||
| ^^^^^^^^^^^
|
||||
/home/justin/Haskell/loop/src/Dodge/Inventory.hs:28:1-22: warning: [-Wunused-imports]
|
||||
The import of ‘Dodge.Reloading’ is redundant
|
||||
|
|
||||
28 | import Dodge.Reloading
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
/home/justin/Haskell/loop/src/Dodge/Item/Ammo.hs:7:1-29: warning: [-Wunused-imports]
|
||||
The import of ‘Dodge.Reloading.Action’ is redundant
|
||||
|
|
||||
7 | import Dodge.Reloading.Action
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
/home/justin/Haskell/loop/src/Dodge/Reloading/Action.hs:3:1-49: warning: [-Wunused-imports]
|
||||
The import of ‘Dodge.Data.Item.Use.Consumption.LoadAction’ is redundant
|
||||
|
|
||||
3 | import Dodge.Data.Item.Use.Consumption.LoadAction
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
/home/justin/Haskell/loop/src/Dodge/Reloading/Action.hs:4:1-49: warning: [-Wunused-imports]
|
||||
The import of ‘Dodge.SoundLogic.ExternallyGeneratedSounds’ is redundant
|
||||
|
|
||||
4 | import Dodge.SoundLogic.ExternallyGeneratedSounds
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
/home/justin/Haskell/loop/src/Dodge/CreatureEffect.hs:(50,13)-(54,28): warning: [-Wincomplete-patterns]
|
||||
Pattern match(es) are non-exhaustive
|
||||
In a case alternative: Patterns not matched: CrIsReloading
|
||||
|
|
||||
50 | doCrBl cb = case cb of
|
||||
| ^^^^^^^^^^...
|
||||
/home/justin/Haskell/loop/src/Dodge/Creature/Statistics.hs:8:1-26: warning: [-Wunused-imports]
|
||||
The import of ‘Dodge.Creature.Test’ is redundant
|
||||
|
|
||||
8 | import Dodge.Creature.Test
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
/home/justin/Haskell/loop/src/Dodge/Item/Weapon/TriggerType.hs:72:1-22: warning: [-Wunused-imports]
|
||||
The import of ‘Dodge.Reloading’ is redundant
|
||||
|
|
||||
72 | import Dodge.Reloading
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
/home/justin/Haskell/loop/src/Dodge/Projectile/Create.hs:4:1-22: warning: [-Wunused-imports]
|
||||
The import of ‘Dodge.Reloading’ is redundant
|
||||
|
|
||||
4 | import Dodge.Reloading
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
/home/justin/Haskell/loop/src/Dodge/Reloading.hs:7:1-19: warning: [-Wunused-imports]
|
||||
The import of ‘Control.Lens’ is redundant
|
||||
|
|
||||
7 | import Control.Lens
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
/home/justin/Haskell/loop/src/Dodge/Reloading.hs:8:1-17: warning: [-Wunused-imports]
|
||||
The import of ‘Data.Maybe’ is redundant
|
||||
|
|
||||
8 | import Data.Maybe
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
/home/justin/Haskell/loop/src/Dodge/Reloading.hs:9:1-26: warning: [-Wunused-imports]
|
||||
The import of ‘Dodge.Data.Creature’ is redundant
|
||||
|
|
||||
9 | import Dodge.Data.Creature
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
/home/justin/Haskell/loop/src/Dodge/Reloading.hs:10:1-20: warning: [-Wunused-imports]
|
||||
The import of ‘Control.Monad’ is redundant
|
||||
|
|
||||
10 | import Control.Monad
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
/home/justin/Haskell/loop/src/Dodge/Data/Item/Use/Consumption/LoadAction.hs:11:1-17: warning: [-Wunused-imports]
|
||||
The import of ‘Sound.Data’ is redundant
|
||||
|
|
||||
11 | import Sound.Data
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
All good (613 modules, at 10:30:52)
|
||||
|
||||
@@ -17,7 +17,6 @@ import Dodge.Hotkey
|
||||
import Dodge.Inventory
|
||||
import Dodge.Item.Location
|
||||
import Dodge.Luse
|
||||
import Dodge.Reloading
|
||||
import qualified IntMapHelp as IM
|
||||
|
||||
useItemRightClick :: Creature -> World -> World
|
||||
@@ -115,10 +114,10 @@ useItemLeftClick cr w = fromMaybe w $ do
|
||||
--AmmoMagUse{} -> return $ hammerTest (cWorld . lWorld . creatures . ix (_crID cr) %~ crReloadToggle)
|
||||
_ -> Nothing
|
||||
where
|
||||
hammerTest f = case _crHammerPosition cr of
|
||||
HammerUp -> f w & setuhamdown
|
||||
_ -> w & setuhamdown
|
||||
setuhamdown = cWorld . lWorld . creatures . ix (_crID cr) . crHammerPosition .~ HammerDown
|
||||
--hammerTest f = case _crHammerPosition cr of
|
||||
-- HammerUp -> f w & setuhamdown
|
||||
-- _ -> w & setuhamdown
|
||||
--setuhamdown = cWorld . lWorld . creatures . ix (_crID cr) . crHammerPosition .~ HammerDown
|
||||
|
||||
useItemHotkey :: Int -> Int -> World -> World
|
||||
useItemHotkey crid invid w = fromMaybe w $ do
|
||||
|
||||
@@ -4,7 +4,6 @@ module Dodge.Creature.ReaderUpdate (
|
||||
targetYouWhenCognizant,
|
||||
overrideMeleeCloseTarget,
|
||||
watchUpdateStrat,
|
||||
reloadOverride,
|
||||
overrideInternal,
|
||||
searchIfDamaged,
|
||||
goToTarget,
|
||||
@@ -24,7 +23,7 @@ import LensHelp
|
||||
import Data.Bifunctor
|
||||
import Data.Maybe
|
||||
import Dodge.Base
|
||||
import Dodge.Creature.Volition
|
||||
--import Dodge.Creature.Volition
|
||||
import Dodge.Data.CreatureEffect
|
||||
import Dodge.Data.World
|
||||
import Dodge.Zoning.Creature
|
||||
@@ -170,22 +169,6 @@ doStrategyActions cr = case cr ^? crActionPlan . apStrategy of
|
||||
& crActionPlan . apStrategy .~ strat
|
||||
_ -> cr
|
||||
|
||||
reloadOverride :: Creature -> Creature
|
||||
reloadOverride cr = fromMaybe cr $ do
|
||||
guard $ cr ^. crStance . posture == Aiming
|
||||
itRef <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
guard $ cr ^? crInv . ix (itRef + 1) . itUse . amagLoadStatus . iaLoaded == Just 0
|
||||
return $ cr & crActionPlan . apStrategy .~ StrategyActions Reload reloadActions
|
||||
where
|
||||
reloadActions =
|
||||
[ holsterWeapon
|
||||
, 1
|
||||
`WaitThen` DoActionWhileInterrupt
|
||||
NoAction
|
||||
(WdCrBlfromCrBl CrIsReloading)
|
||||
(DoImpulses [ChangeStrategy WatchAndWait])
|
||||
]
|
||||
|
||||
overrideInternal :: (Creature -> Bool) -> (Creature -> Creature) -> Creature -> Creature
|
||||
overrideInternal test update cr
|
||||
| test cr = update cr
|
||||
|
||||
@@ -19,8 +19,7 @@ import Geometry.Data
|
||||
|
||||
sentinelAI :: World -> Creature -> Creature
|
||||
sentinelAI w =
|
||||
reloadOverride
|
||||
. sentinelExtraWatchUpdate
|
||||
sentinelExtraWatchUpdate
|
||||
[
|
||||
( crHasTargetLOS
|
||||
, \_ cr ->
|
||||
@@ -66,7 +65,6 @@ sentinelFireType f =
|
||||
, perceptionUpdate [0]
|
||||
, -- , Left $ perceptionUp 0
|
||||
const doStrategyActions
|
||||
, const reloadOverride
|
||||
, targetYouWhenCognizant
|
||||
, const $
|
||||
overrideInternal
|
||||
|
||||
@@ -23,7 +23,6 @@ import Dodge.Hammer
|
||||
import Dodge.ItEffect
|
||||
import Dodge.LightSource.Torch
|
||||
import Dodge.Prop.Gib
|
||||
import Dodge.Reloading
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.Targeting
|
||||
import Geometry
|
||||
|
||||
@@ -5,7 +5,7 @@ module Dodge.Creature.Statistics (
|
||||
|
||||
import Data.IntMap.Merge.Strict
|
||||
import Data.Maybe
|
||||
import Dodge.Creature.Test
|
||||
--import Dodge.Creature.Test
|
||||
import Dodge.Data.Creature
|
||||
import qualified IntMapHelp as IM
|
||||
import LensHelp
|
||||
|
||||
@@ -38,7 +38,6 @@ data WdCrBl
|
||||
|
||||
data CrBl
|
||||
= CrCanShoot
|
||||
| CrIsReloading
|
||||
| CrIsAiming
|
||||
| CrIsAnimate
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
@@ -8,7 +8,7 @@ module Dodge.Data.Item.Use.Consumption.LoadAction where
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Sound.Data
|
||||
--import Sound.Data
|
||||
|
||||
data Manipulation -- should be ManipulatedObject?
|
||||
-- = InvSel {_isel :: SelPos}
|
||||
|
||||
@@ -45,7 +45,6 @@ updateHumanoid cr = case cr ^?! crType . humanoidAI of
|
||||
]
|
||||
, perceptionUpdate [0]
|
||||
, const doStrategyActions
|
||||
, const reloadOverride
|
||||
, targetYouWhenCognizant
|
||||
, const $
|
||||
overrideInternal
|
||||
@@ -68,7 +67,6 @@ updateHumanoid cr = case cr ^?! crType . humanoidAI of
|
||||
]
|
||||
, perceptionUpdate [0]
|
||||
, const doStrategyActions
|
||||
, const reloadOverride
|
||||
, targetYouWhenCognizant
|
||||
, const $
|
||||
overrideInternal
|
||||
@@ -95,7 +93,6 @@ updateHumanoid cr = case cr ^?! crType . humanoidAI of
|
||||
]
|
||||
, perceptionUpdate [0]
|
||||
, const doStrategyActions
|
||||
, const reloadOverride
|
||||
, targetYouWhenCognizant
|
||||
, const $
|
||||
overrideInternal
|
||||
@@ -112,7 +109,6 @@ updateHumanoid cr = case cr ^?! crType . humanoidAI of
|
||||
]
|
||||
, perceptionUpdate [0]
|
||||
, const doStrategyActions
|
||||
, const reloadOverride
|
||||
, targetYouWhenCognizant
|
||||
, const $
|
||||
overrideInternal
|
||||
@@ -178,7 +174,8 @@ updateHumanoid cr = case cr ^?! crType . humanoidAI of
|
||||
drawwp = DoActionIfElse NoAction (WdCrBlfromCrBl CrIsAiming) (DoActionThen drawWeapon (WaitThen 50 NoAction))
|
||||
reloadActions =
|
||||
[ holsterWeapon
|
||||
, WaitThen 1 $ DoActionWhileInterrupt NoAction (WdCrBlfromCrBl CrIsReloading) (DoImpulses [ChangeStrategy WatchAndWait])
|
||||
--, WaitThen 1 $ DoActionWhileInterrupt NoAction (WdCrBlfromCrBl CrIsReloading) (DoImpulses [ChangeStrategy WatchAndWait])
|
||||
, WaitThen 1 $ (DoImpulses [ChangeStrategy WatchAndWait])
|
||||
]
|
||||
|
||||
humanoidAIList ::
|
||||
|
||||
@@ -25,7 +25,6 @@ import Dodge.Euse
|
||||
import Dodge.Inventory.CheckSlots
|
||||
import Dodge.Inventory.CloseObject
|
||||
import Dodge.ItEffect
|
||||
import Dodge.Reloading
|
||||
import Dodge.SelectionSections
|
||||
import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
|
||||
@@ -4,7 +4,6 @@ import Control.Lens
|
||||
import Dodge.Data.World
|
||||
import Dodge.Default.Item
|
||||
import Dodge.Item.Weapon.Bullet
|
||||
import Dodge.Reloading.Action
|
||||
|
||||
tinMag :: Item
|
||||
tinMag =
|
||||
|
||||
@@ -69,7 +69,6 @@ import Dodge.Creature.Test
|
||||
import Dodge.Data.World
|
||||
import Dodge.Inventory.Lock
|
||||
import Dodge.LightSource
|
||||
import Dodge.Reloading
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.WorldEvent
|
||||
import Geometry
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
module Dodge.Projectile.Create where
|
||||
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.Reloading
|
||||
import Control.Monad
|
||||
import Data.Maybe
|
||||
import Dodge.Data.World
|
||||
|
||||
@@ -16,7 +16,6 @@ import Dodge.Item.Weapon.Shell
|
||||
import Dodge.Item.Weapon.TriggerType
|
||||
import Dodge.Movement.Turn
|
||||
import Dodge.Payload
|
||||
import Dodge.Reloading.Action
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.WorldEvent.Cloud
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
module Dodge.Reloading (
|
||||
-- crCancelReloading,
|
||||
-- crReloadToggle,
|
||||
-- stepReloading,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
import Dodge.Data.Creature
|
||||
import Control.Monad
|
||||
--import Data.Monoid
|
||||
|
||||
----crCancelReloading :: Creature -> Creature
|
||||
--crCancelReloading cr =
|
||||
-- cr
|
||||
-- & updateProgress
|
||||
-- & crManipulation . manObject . inInventory . iselAction .~ NoInvSelAction
|
||||
-- where
|
||||
-- updateProgress = fromMaybe id $ do
|
||||
-- InInventory (SelItem i _) <- cr ^? crManipulation . manObject
|
||||
-- return $
|
||||
-- crInv . ix (i + 1) . itUse . amagLoadStatus . iaProgress
|
||||
-- %~ const Nothing
|
||||
--
|
||||
--stepReloading :: Creature -> Creature
|
||||
--stepReloading cr = case cr ^? crManipulation . manObject . inInventory of
|
||||
-- Just (SelItem _ (ReloadAction x la j))
|
||||
-- | x > 0 ->
|
||||
-- cr & crManipulation . manObject . inInventory . iselAction . actionProgress -~ 1
|
||||
-- | otherwise ->
|
||||
-- cr
|
||||
-- & crInv . ix j . itUse . amagLoadStatus %~ doLoadAction la
|
||||
-- & crInv . ix j . itUse . amagLoadStatus %~ rotateActionProgress
|
||||
-- & tryNextLoadAction
|
||||
-- _ -> cr
|
||||
--
|
||||
--tryNextLoadAction :: Creature -> Creature
|
||||
--tryNextLoadAction cr = case cr ^? crManipulation . manObject . inInventory of
|
||||
-- Just (SelItem i _) -> case cr ^? crInv . ix (i + 1) . itUse . amagLoadStatus . iaProgress . _Just . ix 0 of
|
||||
-- Nothing -> cr & crManipulation . manObject . inInventory . iselAction .~ NoInvSelAction
|
||||
-- Just la ->
|
||||
-- cr & crManipulation . manObject . inInventory . iselAction . actionProgress .~ _actionTime la
|
||||
-- & crManipulation . manObject . inInventory . iselAction . reloadAction .~ la
|
||||
-- _ -> cr
|
||||
--
|
||||
--crReloadToggle :: Creature -> Creature
|
||||
--crReloadToggle cr = case cr ^? crManipulation . manObject . inInventory . iselAction of
|
||||
-- Just NoInvSelAction -> cr & tryStartLoading
|
||||
-- _ -> cr & crManipulation . manObject . inInventory . iselAction .~ NoInvSelAction
|
||||
--
|
||||
--tryStartLoading :: Creature -> Creature
|
||||
--tryStartLoading cr = fromMaybe cr $ do
|
||||
-- i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
-- magtypes <- cr ^? crInv . ix i . itUse . heldConsumption
|
||||
-- --let mags = cr ^.. crInv . dropping (i + 1) traverse -- note this gets all items below the manipulated
|
||||
-- let mags = cr ^.. crInv . dropping i traverse
|
||||
-- iaj <- listToMaybe . catMaybes $ zipWith tryStartLoadMagazine mags magtypes
|
||||
-- return $ startLoading iaj cr
|
||||
--
|
||||
--tryStartLoadMagazine :: Item -> AmmoType -> Maybe (ReloadStatus, Int)
|
||||
--tryStartLoadMagazine mag atype = do
|
||||
-- magat <- mag ^? itUse . amagType
|
||||
-- guard $ magat == atype
|
||||
-- ia <- mag ^? itUse . amagLoadStatus
|
||||
-- maxammo <- ia ^? iaMax
|
||||
-- loadedammo <- ia ^? iaLoaded
|
||||
-- guard $ loadedammo < maxammo
|
||||
-- j <- mag ^? itLocation . ipInvID
|
||||
-- return (ia, j)
|
||||
--
|
||||
---- case as of
|
||||
---- InternalSource ia -> return $ startLoading ia cr
|
||||
---- AboveSource -> return cr
|
||||
--
|
||||
--startLoading :: (ReloadStatus,Int) -> Creature -> Creature
|
||||
--startLoading (ic,j) cr = case ic ^? iaProgress . _Just . ix 0 of
|
||||
-- Just la -> cr & startLoadingStep la j
|
||||
-- Nothing -> case ic ^. iaCycle of
|
||||
-- [] -> error "item has empty load cycle"
|
||||
-- _ | _iaLoaded ic >= _iaMax ic -> cr -- THIS SHOULD TRY PUSHING TO THE NEXT MAGAZINE
|
||||
-- (la : las) -> fromMaybe (error "item loading error") $ do
|
||||
-- i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
-- return $
|
||||
-- cr & startLoadingStep la i
|
||||
-- & crInv . ix i . itUse . amagLoadStatus . iaProgress ?~ (la : las)
|
||||
--
|
||||
--startLoadingStep :: LoadAction
|
||||
-- -> Int -- i think this is the inventory position?
|
||||
-- -> Creature -> Creature
|
||||
--startLoadingStep la j cr = cr & crManipulation . manObject . inInventory . iselAction .~ ReloadAction (_actionTime la) la j
|
||||
--
|
||||
--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 -> ReloadStatus -> ReloadStatus
|
||||
--doLoadAction la ic = case la of
|
||||
-- LoadEject{} -> ic & iaLoaded .~ 0 & iaPrimed .~ False
|
||||
-- LoadInsert{} -> ic & iaLoaded .~ _iaMax ic
|
||||
-- LoadAdd{_insertMax = x} ->
|
||||
-- ic & iaLoaded +~ min x (_iaMax ic - _iaLoaded ic)
|
||||
-- LoadPrime{} -> ic & iaPrimed .~ True
|
||||
--
|
||||
----{- | Start reloading if clip is empty. -}
|
||||
----crAutoReload :: Creature -> Creature
|
||||
----crAutoReload cr = case cr ^? ptrItConsumption' . ammoLoaded of
|
||||
---- Just 0 | _posture (_crStance cr) /= Aiming
|
||||
---- -> cr & ptrItConsumption . reloadState .~ strictify reloadT
|
||||
---- & ptrItConsumption . ammoLoaded %~ (`fromMaybe` maxA)
|
||||
---- _ -> cr
|
||||
---- where
|
||||
---- ptrItConsumption = crInv . ix (_crInvSel cr) . itConsumption
|
||||
---- ptrItConsumption' = crInv . ix (_crInvSel cr) . itConsumption
|
||||
---- reloadT = cr ^? ptrItConsumption' . reloadTime
|
||||
---- maxA = fmap itMaxAmmo $ cr ^? crInv . ix (_crInvSel cr)
|
||||
@@ -1,16 +0,0 @@
|
||||
module Dodge.Reloading.Action where
|
||||
|
||||
import Dodge.Data.Item.Use.Consumption.LoadAction
|
||||
import Dodge.SoundLogic.ExternallyGeneratedSounds
|
||||
|
||||
--loadInsert :: Int -> LoadAction
|
||||
--loadInsert x = LoadInsert x insertS
|
||||
--
|
||||
--loadPartialInsert :: Int -> Int -> LoadAction
|
||||
--loadPartialInsert x = LoadAdd x insertOneS
|
||||
--
|
||||
--loadEject :: Int -> LoadAction
|
||||
--loadEject x = LoadEject x ejectS
|
||||
--
|
||||
--loadPrime :: Int -> LoadAction
|
||||
--loadPrime x = LoadPrime x primeS
|
||||
Reference in New Issue
Block a user