This commit is contained in:
2022-06-02 09:29:44 +01:00
parent b6e2b6ef21
commit 98cb8f2264
8 changed files with 57 additions and 48 deletions
+16 -23
View File
@@ -50,7 +50,8 @@ import qualified Data.Text as T
-- | after this the item at the inventory position will no longer exist
rmInvItem :: Int -- ^ Creature id
-> Int -- ^ Inventory position
-> World -> World
-> World
-> World
rmInvItem cid invid w = case w ^? creatures . ix cid . crInv . ix invid . itConsumption . itAmount of
Just x | x > 1 -> w & creatures . ix cid . crInv . ix invid . itConsumption . itAmount %~ subtract 1
_ -> w & creatures . ix cid . crInv %~ f
@@ -141,7 +142,7 @@ invSelPos w = splitgap + (foldl' (+) 0 . fst $ IM.split invsel (augmentedInvSize
where
invsel = yourInvSel w
splitgap
| yourInvSel w < length (yourInv w) = 0
| invsel < length (yourInv w) = 0
| otherwise = 1
updateTerminal :: World -> World
@@ -157,22 +158,21 @@ checkTermDist w = case w ^? hud . hudElement . subInventory . termID of
updateTerminalLine :: World -> World
updateTerminalLine w = case w ^? hud . hudElement . subInventory . termParams . termFutureLines . ix 0 of
Nothing -> w
Just tl | _tlPause tl > 0 -> w
& hud . hudElement . subInventory . termParams . termFutureLines . ix 0 . tlPause -~ 1
Just (TerminalLineDisplay _ f) -> w
& hud . hudElement . subInventory . termParams . termFutureLines %~ tail
& hud . hudElement . subInventory . termParams . termDisplayedLines .:~ f
Just tl | _tlPause tl > 0 -> w & pointTermParams . termFutureLines . ix 0 . tlPause -~ 1
Just (TerminalLineDisplay _ f) -> w & pointTermParams %~
( ( termFutureLines %~ tail )
. ( termDisplayedLines .:~ f )
)
Just (TerminalLineEffect _ eff) -> w
& hud . hudElement . subInventory . termParams . termFutureLines %~ tail
& pointTermParams . termFutureLines %~ tail
& eff (_subInventory . _hudElement $ _hud w)
-- Just (TerminalLineChoice _ ops) -> w
-- & hud . hudElement . subInventory . termParams . termFutureLines %~ tail
-- & hud . hudElement . subInventory . termParams . termOptions .~ ops
-- & hud . hudElement . subInventory . termParams . termSel ?~ 0
Just (TerminalLineInput _ commands) -> w
& hud . hudElement . subInventory . termParams . termFutureLines %~ tail
& hud . hudElement . subInventory . termParams . termInput ?~ T.empty
& hud . hudElement . subInventory . termParams . termCommands .~ commands
Just (TerminalLineInput _ scrollc writec) -> w & pointTermParams %~
( ( termFutureLines %~ tail )
. ( termInput ?~ T.empty )
. ( termScrollCommands .~ scrollc )
. ( termWriteCommands .~ writec ) )
where
pointTermParams = hud . hudElement . subInventory . termParams
-- this looks ugly...
updateCloseObjects :: World -> World
@@ -321,13 +321,6 @@ changeSwapInvSel k w
n = length $ _crInv cr
numCO = length $ _closeObjects w
--swapIntSetKeys :: Int -> Int -> IS.IntSet -> IS.IntSet
--swapIntSetKeys i j is
-- | i `IS.member` is && j `IS.member` is = is
-- | i `IS.member` is = j `IS.insert` (i `IS.delete` is)
-- | j `IS.member` is = i `IS.insert` (j `IS.delete` is)
-- | otherwise = is
changeAugInvSel :: Int -> World -> World
changeAugInvSel i w
| n == 0 = w