Cleanup constructors FooUse -> UseFoo

This commit is contained in:
2024-10-03 20:39:41 +01:00
parent 6b4cf596b1
commit 127d85e7ce
10 changed files with 49 additions and 92 deletions
+9 -11
View File
@@ -11,7 +11,6 @@ import Dodge.Data.ComposedItem
import Dodge.Data.DoubleTree
import Control.Lens
import Control.Monad
--import Data.Foldable
import Data.Maybe
import Dodge.Cuse
import Dodge.Data.World
@@ -33,20 +32,20 @@ useRootItem crid w = fromMaybe w $ do
& worldEventFlags . at InventoryChange ?~ ()
itemUseEffect :: Creature -> LabelDoubleTree ComposeLinkType Item -> World -> World
itemUseEffect cr it w = case it ^. ldtValue . itUse of
UseHeld{} -> heldEffect it cr w
itemUseEffect cr itmtree w = case itmtree ^. ldtValue . itUse of
UseHeld{} -> heldEffect itmtree cr w
& pointerToItem itm . itUse . heldHammer .~ HammerDown
UseHotkey{} -> doequipmentchange
UseEquip{} -> doequipmentchange
(UseConsume eff) -> useC eff (_ldtValue it) cr w
CraftUse{} -> w
UseAttach{} -> selectUse it cr w
TargetingUse {} -> w
(UseConsume eff) -> useC eff (_ldtValue itmtree) cr w
UseCraft{} -> w
UseAttach{} -> selectUse itmtree cr w
UseTargeting {} -> w
UseAmmoMag{} -> w
ScopeUse{} -> w
BulletModUse{} -> w
UseScope{} -> w
UseBulletMod{} -> w
where
itm = it ^. ldtValue
itm = itmtree ^. ldtValue
doequipmentchange = fromMaybe w $ do
guard (_crHammerPosition cr == HammerUp)
invid <- itm ^? itLocation . ilInvID
@@ -111,7 +110,6 @@ useItemLeftClick cr w = fromMaybe w $ do
_ -> Nothing
useItemLeftClick' :: Creature -> World -> World
--useItemLeftClick' cr' w = fromMaybe (f w) $ do
useItemLeftClick' cr' w = fromMaybe w $ do
cr <- w ^? cWorld . lWorld . creatures . ix (_crID cr')
itRef <- cr ^? crManipulation . manObject . imSelectedItem