Cleanup constructors FooUse -> UseFoo
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
|||||||
All good (601 modules, at 11:42:53)
|
All good (601 modules, at 20:39:35)
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import Dodge.Data.ComposedItem
|
|||||||
import Dodge.Data.DoubleTree
|
import Dodge.Data.DoubleTree
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
--import Data.Foldable
|
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Dodge.Cuse
|
import Dodge.Cuse
|
||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
@@ -33,20 +32,20 @@ useRootItem crid w = fromMaybe w $ do
|
|||||||
& worldEventFlags . at InventoryChange ?~ ()
|
& worldEventFlags . at InventoryChange ?~ ()
|
||||||
|
|
||||||
itemUseEffect :: Creature -> LabelDoubleTree ComposeLinkType Item -> World -> World
|
itemUseEffect :: Creature -> LabelDoubleTree ComposeLinkType Item -> World -> World
|
||||||
itemUseEffect cr it w = case it ^. ldtValue . itUse of
|
itemUseEffect cr itmtree w = case itmtree ^. ldtValue . itUse of
|
||||||
UseHeld{} -> heldEffect it cr w
|
UseHeld{} -> heldEffect itmtree cr w
|
||||||
& pointerToItem itm . itUse . heldHammer .~ HammerDown
|
& pointerToItem itm . itUse . heldHammer .~ HammerDown
|
||||||
UseHotkey{} -> doequipmentchange
|
UseHotkey{} -> doequipmentchange
|
||||||
UseEquip{} -> doequipmentchange
|
UseEquip{} -> doequipmentchange
|
||||||
(UseConsume eff) -> useC eff (_ldtValue it) cr w
|
(UseConsume eff) -> useC eff (_ldtValue itmtree) cr w
|
||||||
CraftUse{} -> w
|
UseCraft{} -> w
|
||||||
UseAttach{} -> selectUse it cr w
|
UseAttach{} -> selectUse itmtree cr w
|
||||||
TargetingUse {} -> w
|
UseTargeting {} -> w
|
||||||
UseAmmoMag{} -> w
|
UseAmmoMag{} -> w
|
||||||
ScopeUse{} -> w
|
UseScope{} -> w
|
||||||
BulletModUse{} -> w
|
UseBulletMod{} -> w
|
||||||
where
|
where
|
||||||
itm = it ^. ldtValue
|
itm = itmtree ^. ldtValue
|
||||||
doequipmentchange = fromMaybe w $ do
|
doequipmentchange = fromMaybe w $ do
|
||||||
guard (_crHammerPosition cr == HammerUp)
|
guard (_crHammerPosition cr == HammerUp)
|
||||||
invid <- itm ^? itLocation . ilInvID
|
invid <- itm ^? itLocation . ilInvID
|
||||||
@@ -111,7 +110,6 @@ useItemLeftClick cr w = fromMaybe w $ do
|
|||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
|
|
||||||
useItemLeftClick' :: Creature -> World -> World
|
useItemLeftClick' :: Creature -> World -> World
|
||||||
--useItemLeftClick' cr' w = fromMaybe (f w) $ do
|
|
||||||
useItemLeftClick' cr' w = fromMaybe w $ do
|
useItemLeftClick' cr' w = fromMaybe w $ do
|
||||||
cr <- w ^? cWorld . lWorld . creatures . ix (_crID cr')
|
cr <- w ^? cWorld . lWorld . creatures . ix (_crID cr')
|
||||||
itRef <- cr ^? crManipulation . manObject . imSelectedItem
|
itRef <- cr ^? crManipulation . manObject . imSelectedItem
|
||||||
|
|||||||
@@ -229,14 +229,10 @@ itemInvSideEffect cr itm = case _itType itm of
|
|||||||
-- this probably needs to be set to null when dropped as well?
|
-- this probably needs to be set to null when dropped as well?
|
||||||
updateItemTargeting :: TargetingType -> Creature -> Item -> World -> World
|
updateItemTargeting :: TargetingType -> Creature -> Item -> World -> World
|
||||||
updateItemTargeting tt cr itm w = case tt of
|
updateItemTargeting tt cr itm w = case tt of
|
||||||
_
|
_ | not isattached -> w
|
||||||
| not isattached ->
|
|
||||||
w
|
|
||||||
& pointItUse . tgPos .~ Nothing
|
& pointItUse . tgPos .~ Nothing
|
||||||
& pointItUse . tgActive .~ False
|
& pointItUse . tgActive .~ False
|
||||||
TARGETLASER
|
TARGETLASER | crIsAiming cr -> w
|
||||||
| crIsAiming cr ->
|
|
||||||
w
|
|
||||||
& cWorld . lWorld . lasers
|
& cWorld . lWorld . lasers
|
||||||
.:~ LaserStart
|
.:~ LaserStart
|
||||||
{ _lpPhaseV = 1
|
{ _lpPhaseV = 1
|
||||||
@@ -246,19 +242,15 @@ updateItemTargeting tt cr itm w = case tt of
|
|||||||
, _lpType = TargetingLaser (_itID itm)
|
, _lpType = TargetingLaser (_itID itm)
|
||||||
}
|
}
|
||||||
TARGETLASER -> w & pointItUse . tgPos .~ Nothing
|
TARGETLASER -> w & pointItUse . tgPos .~ Nothing
|
||||||
TargetRBPress
|
TargetRBPress | rbpressed -> w
|
||||||
| rbpressed ->
|
|
||||||
w
|
|
||||||
& pointItUse . tgPos %~ maybe (Just $ mouseWorldPos (w ^. input) (w ^. wCam)) Just
|
& pointItUse . tgPos %~ maybe (Just $ mouseWorldPos (w ^. input) (w ^. wCam)) Just
|
||||||
& pointItUse . tgActive .~ True
|
& pointItUse . tgActive .~ True
|
||||||
TargetRBPress ->
|
TargetRBPress -> w
|
||||||
w
|
|
||||||
& pointItUse . tgPos .~ Nothing
|
& pointItUse . tgPos .~ Nothing
|
||||||
& pointItUse . tgActive .~ False
|
& pointItUse . tgActive .~ False
|
||||||
TargetRBCreature -> w & pointItUse %~ setRBCreatureTargeting cr w
|
TargetRBCreature -> w & pointItUse %~ setRBCreatureTargeting cr w
|
||||||
TargetCursor ->
|
TargetCursor -> w
|
||||||
w & pointItUse
|
& pointItUse .~ UseTargeting
|
||||||
.~ TargetingUse
|
|
||||||
(Just (mouseWorldPos (w ^. input) (w ^. wCam)))
|
(Just (mouseWorldPos (w ^. input) (w ^. wCam)))
|
||||||
Nothing
|
Nothing
|
||||||
True
|
True
|
||||||
|
|||||||
@@ -51,21 +51,21 @@ data ItemUse
|
|||||||
}
|
}
|
||||||
| UseConsume { _cUse :: Cuse }
|
| UseConsume { _cUse :: Cuse }
|
||||||
| UseEquip { _uequipEffect :: EquipEffect }
|
| UseEquip { _uequipEffect :: EquipEffect }
|
||||||
| CraftUse
|
| UseCraft
|
||||||
| UseAttach {_uaParams :: AttachParams}
|
| UseAttach {_uaParams :: AttachParams}
|
||||||
| UseAmmoMag
|
| UseAmmoMag
|
||||||
{ _amagLoadStatus :: ReloadStatus
|
{ _amagLoadStatus :: ReloadStatus
|
||||||
, _amagParams :: AmmoParams
|
, _amagParams :: AmmoParams
|
||||||
, _amagType :: AmmoType
|
, _amagType :: AmmoType
|
||||||
}
|
}
|
||||||
| ScopeUse { _scopeScope :: Scope }
|
| UseScope { _uScope :: Scope }
|
||||||
| TargetingUse
|
| UseTargeting
|
||||||
{ _tgPos :: Maybe Point2
|
{ _tgPos :: Maybe Point2
|
||||||
, _tgID :: Maybe Int
|
, _tgID :: Maybe Int
|
||||||
, _tgActive :: Bool
|
, _tgActive :: Bool
|
||||||
}
|
}
|
||||||
| BulletModUse
|
| UseBulletMod
|
||||||
{ _buMod :: BulletMod
|
{ _ubMod :: BulletMod
|
||||||
}
|
}
|
||||||
deriving (Eq, Show, Read)
|
deriving (Eq, Show, Read)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
module Dodge.Default.Item (
|
module Dodge.Default.Item (
|
||||||
module Dodge.Default.Item,
|
defaultHeldItem,
|
||||||
|
singleAmmo,
|
||||||
|
defaultBulletWeapon,
|
||||||
|
defaultLeftItem,
|
||||||
|
defaultCraftItem,
|
||||||
|
defaultConsumable,
|
||||||
module Dodge.Default.Item.Use,
|
module Dodge.Default.Item.Use,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
@@ -33,7 +38,7 @@ defaultLeftItem :: Item
|
|||||||
defaultLeftItem = defaultHeldItem & itUse .~ defaultLeftUse
|
defaultLeftItem = defaultHeldItem & itUse .~ defaultLeftUse
|
||||||
|
|
||||||
defaultCraftItem :: Item
|
defaultCraftItem :: Item
|
||||||
defaultCraftItem = defaultHeldItem & itUse .~ CraftUse
|
defaultCraftItem = defaultHeldItem & itUse .~ UseCraft
|
||||||
|
|
||||||
singleAmmo :: a -> IM.IntMap a
|
singleAmmo :: a -> IM.IntMap a
|
||||||
singleAmmo x = IM.insert 0 x mempty
|
singleAmmo x = IM.insert 0 x mempty
|
||||||
|
|||||||
@@ -304,14 +304,14 @@ getBulletType itmtree magtree mz cr w =
|
|||||||
targetingtree <- lookup WeaponTargetingLink (itmtree ^. ldtRight) -- left or right for these?
|
targetingtree <- lookup WeaponTargetingLink (itmtree ^. ldtRight) -- left or right for these?
|
||||||
tp <- targetingtree ^? ldtValue . itUse . tgPos . _Just
|
tp <- targetingtree ^? ldtValue . itUse . tgPos . _Just
|
||||||
attree <- lookup AmmoTargetingLink (magtree ^. ldtLeft)
|
attree <- lookup AmmoTargetingLink (magtree ^. ldtLeft)
|
||||||
bt <- attree ^? ldtValue . itUse . buMod . bmTrajectory
|
bt <- attree ^? ldtValue . itUse . ubMod . bmTrajectory
|
||||||
return $ getBulletTrajectory mz (itmtree ^. ldtValue) bt tp cr w
|
return $ getBulletTrajectory mz (itmtree ^. ldtValue) bt tp cr w
|
||||||
bpayload = fromMaybe BulSpark $ do
|
bpayload = fromMaybe BulSpark $ do
|
||||||
attree <- lookup AmmoPayloadLink (magtree ^. ldtLeft)
|
attree <- lookup AmmoPayloadLink (magtree ^. ldtLeft)
|
||||||
attree ^? ldtValue . itUse . buMod . bmPayload
|
attree ^? ldtValue . itUse . ubMod . bmPayload
|
||||||
beffect = fromMaybe DestroyBullet $ do
|
beffect = fromMaybe DestroyBullet $ do
|
||||||
attree <- lookup AmmoEffectLink (magtree ^. ldtLeft)
|
attree <- lookup AmmoEffectLink (magtree ^. ldtLeft)
|
||||||
attree ^? ldtValue . itUse . buMod . bmEffect
|
attree ^? ldtValue . itUse . ubMod . bmEffect
|
||||||
|
|
||||||
getBulletTrajectory ::
|
getBulletTrajectory ::
|
||||||
Muzzle ->
|
Muzzle ->
|
||||||
|
|||||||
@@ -1,36 +1,18 @@
|
|||||||
module Dodge.Item.Display (
|
module Dodge.Item.Display (
|
||||||
itemDisplay,
|
itemDisplay,
|
||||||
-- canAttachTargeting,
|
|
||||||
itemString,
|
itemString,
|
||||||
itemBaseName,
|
itemBaseName,
|
||||||
basicItemDisplay,
|
basicItemDisplay,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
--import Control.Applicative
|
|
||||||
--import Control.Monad
|
|
||||||
import ShortShow
|
import ShortShow
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Dodge.Data.Creature
|
import Dodge.Data.Creature
|
||||||
import LensHelp
|
import LensHelp
|
||||||
import Padding
|
import Padding
|
||||||
|
|
||||||
--canAttachTargeting :: TargetingType -> Item -> Bool
|
|
||||||
--canAttachTargeting TARGETLASER _ = True
|
|
||||||
--canAttachTargeting _ itm =
|
|
||||||
-- isJust (itm ^? itType . iyModules . ix ModBulletTrajectory . imtBulletTrajectoryType)
|
|
||||||
-- || Just LAUNCHHOME == (itm ^? itType . iyModules . ix ModLauncherHoming)
|
|
||||||
|
|
||||||
--targetingTypeString :: TargetType -> String
|
|
||||||
--targetingTypeString tt = case tt of
|
|
||||||
-- TARGETLASER -> "LASER"
|
|
||||||
-- TargetRBPress -> "POS"
|
|
||||||
-- TargetRBLine -> ""
|
|
||||||
-- TargetRBCreature -> "LIFEFORM"
|
|
||||||
-- TargetCursor -> "CURSOR"
|
|
||||||
|
|
||||||
itemDisplay :: Creature -> Item -> [String]
|
itemDisplay :: Creature -> Item -> [String]
|
||||||
itemDisplay cr itm =
|
itemDisplay cr itm =
|
||||||
--itemDisplayWithNumber (showConsumption cr it) it
|
|
||||||
zipWithDefaults id (leftPad 15 ' ') itemDisplayPad (basicItemDisplay itm) (itemNumberDisplay cr itm)
|
zipWithDefaults id (leftPad 15 ' ') itemDisplayPad (basicItemDisplay itm) (itemNumberDisplay cr itm)
|
||||||
|
|
||||||
zipWithDefaults :: (a -> c) -> (b -> c) -> (a -> b -> c) -> [a] -> [b] -> [c]
|
zipWithDefaults :: (a -> c) -> (b -> c) -> (a -> b -> c) -> [a] -> [b] -> [c]
|
||||||
@@ -113,15 +95,15 @@ itemNumberDisplay cr itm = case iu of
|
|||||||
UseHeld{} -> []
|
UseHeld{} -> []
|
||||||
UseHotkey{} -> [showAutoRechargeProgress (_leftConsumption iu)]
|
UseHotkey{} -> [showAutoRechargeProgress (_leftConsumption iu)]
|
||||||
UseEquip{} -> showEquipmentNumber cr itm
|
UseEquip{} -> showEquipmentNumber cr itm
|
||||||
CraftUse -> []
|
UseCraft -> []
|
||||||
UseConsume {} -> []
|
UseConsume {} -> []
|
||||||
UseAttach {} -> []
|
UseAttach {} -> []
|
||||||
UseAmmoMag {} -> [maybe "" shortShow $ itm ^? itUse . amagLoadStatus . iaLoaded]
|
UseAmmoMag {} -> [maybe "" shortShow $ itm ^? itUse . amagLoadStatus . iaLoaded]
|
||||||
ScopeUse OpticScope {_opticZoom = x} -> [shortShow x]
|
UseScope OpticScope {_opticZoom = x} -> [shortShow x]
|
||||||
ScopeUse {} -> []
|
UseScope {} -> []
|
||||||
TargetingUse {_tgPos = mp} -> [maybe "" shortShow mp]
|
UseTargeting {_tgPos = mp} -> [maybe "" shortShow mp]
|
||||||
-- this could be cleaner here...
|
-- this could be cleaner here...
|
||||||
BulletModUse {} -> mempty
|
UseBulletMod {} -> mempty
|
||||||
where
|
where
|
||||||
iu = itm ^?! itUse
|
iu = itm ^?! itUse
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ module Dodge.Item.Scope (
|
|||||||
targetingScope,
|
targetingScope,
|
||||||
remoteScreen,
|
remoteScreen,
|
||||||
homingModule,
|
homingModule,
|
||||||
fletchingModule,
|
|
||||||
bulletTargetingModule,
|
bulletTargetingModule,
|
||||||
augmentedHUD,
|
augmentedHUD,
|
||||||
bulletModule,
|
bulletModule,
|
||||||
@@ -18,24 +17,25 @@ import Dodge.Default.Item
|
|||||||
zoomScope :: Item
|
zoomScope :: Item
|
||||||
zoomScope = defaultHeldItem
|
zoomScope = defaultHeldItem
|
||||||
& itType .~ ATTACH ZOOMSCOPE
|
& itType .~ ATTACH ZOOMSCOPE
|
||||||
& itUse .~ ScopeUse OpticScope{_opticPos = 0, _opticZoom = 1, _opticDefaultZoom = 0.5}
|
& itUse .~ UseScope OpticScope{_opticPos = 0, _opticZoom = 1, _opticDefaultZoom = 0.5}
|
||||||
|
|
||||||
targetingScope :: TargetingType -> Item
|
targetingScope :: TargetingType -> Item
|
||||||
targetingScope tt = defaultHeldItem
|
targetingScope tt = defaultHeldItem
|
||||||
& itType .~ TARGETING tt
|
& itType .~ TARGETING tt
|
||||||
& itUse .~ TargetingUse Nothing Nothing False
|
& itUse .~ UseTargeting
|
||||||
|
{ _tgPos = Nothing
|
||||||
|
, _tgID = Nothing
|
||||||
|
, _tgActive = False
|
||||||
|
}
|
||||||
|
|
||||||
homingModule :: Item
|
homingModule :: Item
|
||||||
homingModule = makeAttach HOMINGMODULE
|
homingModule = makeAttach HOMINGMODULE
|
||||||
|
|
||||||
fletchingModule :: Item
|
|
||||||
fletchingModule = bulletTargetingModule FlechetteTrajectoryType
|
|
||||||
|
|
||||||
bulletModule :: BulletMod -> Item
|
bulletModule :: BulletMod -> Item
|
||||||
bulletModule bm =
|
bulletModule bm =
|
||||||
defaultHeldItem
|
defaultHeldItem
|
||||||
& itType .~ BULLETMOD bm
|
& itType .~ BULLETMOD bm
|
||||||
& itUse .~ BulletModUse bm
|
& itUse .~ UseBulletMod {_ubMod = bm}
|
||||||
|
|
||||||
bulletTargetingModule :: BulletTrajectoryType -> Item
|
bulletTargetingModule :: BulletTrajectoryType -> Item
|
||||||
bulletTargetingModule = bulletModule . BulletModTrajectory
|
bulletTargetingModule = bulletModule . BulletModTrajectory
|
||||||
@@ -49,4 +49,3 @@ augmentedHUD = makeAttach AUGMENTEDHUD
|
|||||||
remoteScreen :: Item
|
remoteScreen :: Item
|
||||||
remoteScreen = makeAttach REMOTESCREEN
|
remoteScreen = makeAttach REMOTESCREEN
|
||||||
& itUse . uaParams .~ APLinkProjectile Nothing
|
& itUse . uaParams .~ APLinkProjectile Nothing
|
||||||
|
|
||||||
|
|||||||
@@ -79,27 +79,9 @@ lockInvFor i f it cr =
|
|||||||
-- pos = addZ 0 $ _crPos cr +.+ (_crRad cr + 15) *.* unitVectorAtAngle dir
|
-- pos = addZ 0 $ _crPos cr +.+ (_crRad cr + 15) *.* unitVectorAtAngle dir
|
||||||
-- ps = replicateM 20 randOnUnitSphere & evalState $ _randGen w
|
-- ps = replicateM 20 randOnUnitSphere & evalState $ _randGen w
|
||||||
|
|
||||||
-- TODO create a trigger that does different things on first and continued
|
|
||||||
-- fire.
|
|
||||||
--ammoCheckI :: ChainEffect
|
|
||||||
--ammoCheckI eff itm cr w = fromMaybe (failsound w) $ do
|
|
||||||
-- atype <- itm ^? ldtValue . itUse . heldAmmoTypes . ix 0
|
|
||||||
-- leftitms <- itm ^? ldtLeft
|
|
||||||
-- mag <- lookup (AmmoInLink 0 atype) leftitms
|
|
||||||
-- x <- mag ^? ldtValue . itUse . amagLoadStatus . iaLoaded
|
|
||||||
-- guard $ x > 0
|
|
||||||
-- return $ eff itm cr w -- & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
|
|
||||||
-- where
|
|
||||||
-- failsound = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
|
|
||||||
-- Just 0 -> soundStart (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing
|
|
||||||
-- _ -> soundContinue (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing
|
|
||||||
|
|
||||||
itUseCharge :: Int -> Item -> Item
|
itUseCharge :: Int -> Item -> Item
|
||||||
itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)
|
itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)
|
||||||
|
|
||||||
--itUseAmmo :: Int -> Item -> Item
|
|
||||||
--itUseAmmo x = itUse . heldConsumption . laSource . _InternalSource . iaLoaded %~ (max 0 . subtract x)
|
|
||||||
|
|
||||||
--{- | Fires at an increasing rate.
|
--{- | Fires at an increasing rate.
|
||||||
--Has different effect after first fire.
|
--Has different effect after first fire.
|
||||||
--Applies ammo check and use cooldown check.
|
--Applies ammo check and use cooldown check.
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ module Dodge.Update.Camera (
|
|||||||
) where
|
) where
|
||||||
|
|
||||||
import Bound
|
import Bound
|
||||||
--import Control.Applicative
|
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
@@ -94,16 +93,16 @@ moveZoomCamera cfig theinput cr w campos =
|
|||||||
offset = fromMaybe noscopeoffset $ do
|
offset = fromMaybe noscopeoffset $ do
|
||||||
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
||||||
i <- cr ^? crManipulation . manObject . imSelectedItem
|
i <- cr ^? crManipulation . manObject . imSelectedItem
|
||||||
fmap docamrot (cr ^? crInv . ix i . itUse . scopeScope . opticPos)
|
fmap docamrot (cr ^? crInv . ix i . itUse . uScope . opticPos)
|
||||||
noscopeoffset = docamrot $
|
noscopeoffset = docamrot $
|
||||||
((newzoom - newDefaultZoom) / (newDefaultZoom * newzoom)) *.* _mousePos theinput
|
((newzoom - newDefaultZoom) / (newDefaultZoom * newzoom)) *.* _mousePos theinput
|
||||||
newzoom = fromMaybe (newDefaultZoom * newItemZoom) $ do
|
newzoom = fromMaybe (newDefaultZoom * newItemZoom) $ do
|
||||||
i <- cr ^? crManipulation . manObject . imSelectedItem
|
i <- cr ^? crManipulation . manObject . imSelectedItem
|
||||||
cr ^? crInv . ix i . itUse . scopeScope . opticZoom
|
cr ^? crInv . ix i . itUse . uScope . opticZoom
|
||||||
idealDefaultZoom = clipZoom wallZoom
|
idealDefaultZoom = clipZoom wallZoom
|
||||||
newDefaultZoom = fromMaybe (changeZoom (campos ^. camDefaultZoom) idealDefaultZoom) $ do
|
newDefaultZoom = fromMaybe (changeZoom (campos ^. camDefaultZoom) idealDefaultZoom) $ do
|
||||||
i <- cr ^? crManipulation . manObject . imSelectedItem
|
i <- cr ^? crManipulation . manObject . imSelectedItem
|
||||||
cr ^? crInv . ix i . itUse . scopeScope . opticZoom
|
cr ^? crInv . ix i . itUse . uScope . opticZoom
|
||||||
idealItemZoom = fromMaybe 1 $ do
|
idealItemZoom = fromMaybe 1 $ do
|
||||||
guard $ crIsAiming cr
|
guard $ crIsAiming cr
|
||||||
i <- cr ^? crManipulation . manObject . imSelectedItem
|
i <- cr ^? crManipulation . manObject . imSelectedItem
|
||||||
@@ -136,7 +135,7 @@ updateScopeZoom' i w
|
|||||||
w & wppointer %~ doScopeZoom (w ^. input . smoothScrollAmount) (w ^. input . mousePos)
|
w & wppointer %~ doScopeZoom (w ^. input . smoothScrollAmount) (w ^. input . mousePos)
|
||||||
| otherwise = w & wppointer %~ resetscope
|
| otherwise = w & wppointer %~ resetscope
|
||||||
where
|
where
|
||||||
wppointer = cWorld . lWorld . creatures . ix 0 . crInv . ix i . itUse . scopeScope
|
wppointer = cWorld . lWorld . creatures . ix 0 . crInv . ix i . itUse . uScope
|
||||||
resetscope (OpticScope _ _ defz) = OpticScope (V2 0 0) defz defz
|
resetscope (OpticScope _ _ defz) = OpticScope (V2 0 0) defz defz
|
||||||
resetscope otherAtt = otherAtt
|
resetscope otherAtt = otherAtt
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user