This commit is contained in:
2023-05-03 19:24:29 +01:00
parent 2a39497805
commit 748e24137f
4 changed files with 19 additions and 33 deletions
Binary file not shown.
-14
View File
@@ -1,5 +1,4 @@
--{-# LANGUAGE TupleSections #-} --{-# LANGUAGE TupleSections #-}
module Dodge.Inventory ( module Dodge.Inventory (
selSecSelPos, selSecSelPos,
checkInvSlotsYou, checkInvSlotsYou,
@@ -89,9 +88,6 @@ rmInvItem cid invid w = case w ^? getcid . crInv . ix invid . itUse . useAmount
doanyitemeffect = fromMaybe id $ do doanyitemeffect = fromMaybe id $ do
rmf <- itm ^? itEffect . ieOnDrop rmf <- itm ^? itEffect . ieOnDrop
return $ doInvEffect rmf itm cr return $ doInvEffect rmf itm cr
--removeAnySlotEquipment = case w ^? cWorld . lWorld . creatures . ix cid . crInvEquipped . ix invid of
-- Just epos -> pointcid . crEquipment . at epos .~ Nothing
-- Nothing -> id
removeAnySlotEquipment = fromMaybe id $ do removeAnySlotEquipment = fromMaybe id $ do
epos <- w ^? cWorld . lWorld . creatures . ix cid . crInvEquipped . ix invid epos <- w ^? cWorld . lWorld . creatures . ix cid . crInvEquipped . ix invid
return $ pointcid . crEquipment . at epos .~ Nothing return $ pointcid . crEquipment . at epos .~ Nothing
@@ -114,16 +110,6 @@ rmSelectedInvItem cid w = case w ^? cWorld . lWorld . creatures . ix cid . crMan
Just i -> rmInvItem cid i w Just i -> rmInvItem cid i w
Nothing -> w Nothing -> w
--selNumPos :: ManipulatedObject -> World -> Maybe Int
--selNumPos mo w =
-- w ^? hud . hudElement . diSections
-- >>= case mo of
-- InInventory SortInventory -> selSecSelPos (-1) 0
-- InInventory (SelItem i _) -> selSecSelPos 0 i
-- SelNothing -> selSecSelPos 1 0
-- InNearby SortNearby -> selSecSelPos 2 0
-- InNearby (SelCloseObject i) -> selSecSelPos 3 i
-- there are still more ListDisplayParams to integrate here -- there are still more ListDisplayParams to integrate here
selNumTextEndPos :: Configuration -> ListDisplayParams -> SelectionSections a -> Int -> Int -> Maybe Point2 selNumTextEndPos :: Configuration -> ListDisplayParams -> SelectionSections a -> Int -> Int -> Maybe Point2
selNumTextEndPos cfig ldp sss i j = do selNumTextEndPos cfig ldp sss i j = do
+2 -2
View File
@@ -293,8 +293,8 @@ advanceScrollAmount u =
& uvWorld . input . smoothScrollAmount %~ advanceSmoothScroll & uvWorld . input . smoothScrollAmount %~ advanceSmoothScroll
updatePastWorlds :: World -> World updatePastWorlds :: World -> World
--updatePastWorlds w = w & pastWorlds %~ (forceFoldable . take 100 . ((w ^. cWorld . lWorld) :)) updatePastWorlds w = w & pastWorlds %~ (forceFoldable . take 100 . ((w ^. cWorld . lWorld) :))
updatePastWorlds w = w & pastWorlds %~ (forceFoldable . take 600 . ((w ^. cWorld . lWorld) :)) --updatePastWorlds w = w & pastWorlds %~ (forceFoldable . take 600 . ((w ^. cWorld . lWorld) :))
doWorldEvents :: World -> World doWorldEvents :: World -> World
doWorldEvents w = doWorldEvents w =
+8 -8
View File
@@ -2,7 +2,6 @@ module Dodge.Update.Scroll (
updateWheelEvent, updateWheelEvent,
) where ) where
import Dodge.SelectionSections
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
import Data.Maybe import Data.Maybe
import Dodge.Base import Dodge.Base
@@ -10,6 +9,7 @@ import Dodge.Data.Universe
import Dodge.HeldScroll import Dodge.HeldScroll
import Dodge.InputFocus import Dodge.InputFocus
import Dodge.Inventory import Dodge.Inventory
import Dodge.SelectionSections
import Dodge.SoundLogic import Dodge.SoundLogic
import Dodge.Terminal import Dodge.Terminal
import Dodge.Tweak import Dodge.Tweak
@@ -49,8 +49,10 @@ updateWheelEvent yi w = case w ^. hud . hudElement of
invKeyDown = ScancodeCapsLock `M.member` _pressedKeys (_input w) invKeyDown = ScancodeCapsLock `M.member` _pressedKeys (_input w)
moveCombineSel :: Int -> World -> World moveCombineSel :: Int -> World -> World
moveCombineSel yi = (hud . hudElement . subInventory . ciSections moveCombineSel yi =
%~ scrollSelectionSections yi) ( hud . hudElement . subInventory . ciSections
%~ scrollSelectionSections yi
)
. (worldEventFlags . at CombineInventoryChange ?~ ()) . (worldEventFlags . at CombineInventoryChange ?~ ())
moveSubSel :: Int -> Int -> World -> World moveSubSel :: Int -> Int -> World -> World
@@ -65,12 +67,12 @@ guardDisconnectedID tmid w w' = case w ^? cWorld . lWorld . terminals . ix tmid
terminalWheelEvent :: Int -> Int -> World -> World terminalWheelEvent :: Int -> Int -> World -> World
terminalWheelEvent yi tmid w terminalWheelEvent yi tmid w
-- | isJust $ w ^? cWorld . lWorld . terminals . ix tmid . tmPartialCommand . _Just = w
| rbDown && inTermFocus w = | rbDown && inTermFocus w =
guardDisconnectedID tmid w $ guardDisconnectedID tmid w $
w w
& cWorld . lWorld . terminals . ix tmid %~ updatetermsubsel & cWorld . lWorld . terminals . ix tmid %~ updatetermsubsel
| inTermFocus w = guardDisconnectedID tmid w $ | inTermFocus w =
guardDisconnectedID tmid w $
w w
& cWorld . lWorld . terminals . ix tmid %~ updatetermsel & cWorld . lWorld . terminals . ix tmid %~ updatetermsel
| otherwise = w | otherwise = w
@@ -119,9 +121,7 @@ changeTweakParam mi i w = fromMaybe w $ do
) )
scrollCommands :: Terminal -> [TerminalCommand] scrollCommands :: Terminal -> [TerminalCommand]
scrollCommands tm = (nullCommand :) $ _tmScrollCommands tm scrollCommands = (nullCommand :) . _tmScrollCommands
-- | null $ _tmPartialCommand tm = (nullCommand :) $ _tmScrollCommands tm
-- | otherwise = [nullCommand]
scrollCommandStrings :: World -> Terminal -> [String] scrollCommandStrings :: World -> Terminal -> [String]
scrollCommandStrings w tm = case tm ^? tmPartialCommand . _Just of scrollCommandStrings w tm = case tm ^? tmPartialCommand . _Just of