Introduce idea of world event flags

This commit is contained in:
2023-02-23 11:46:45 +00:00
parent da49d7003e
commit fc0fd5fa37
7 changed files with 87 additions and 60 deletions
+10 -13
View File
@@ -2,8 +2,9 @@
module Dodge.DisplayInventory (
toggleCombineInv,
updatePositionHUD,
updateInventorySectionItems,
updateInventoryPositioning,
updateCombinePositioning,
) where
import Dodge.ListDisplayParams
@@ -25,21 +26,17 @@ import LensHelp
import Picture.Base
import Regex
-- this should ONLY change the shownitems
updatePositionHUD :: Universe -> Universe
updatePositionHUD u = case u ^? uvWorld . hud . hudElement . subInventory of
Just NoSubInventory -> u & updateDisplayInventory
Just CombineInventory {} -> u & uvWorld . hud . hudElement . subInventory . ciSections
%~ updateCombineInventory (_uvWorld u) (_uvConfig u)
_ -> u
toggleCombineInv :: Universe -> Universe
toggleCombineInv uv = case uv ^? uvWorld . hud . hudElement . subInventory of
Just CombineInventory{} -> uv & uvWorld . hud . hudElement . subInventory .~ NoSubInventory
_ -> uv & uvWorld %~ enterCombineInv (uv ^. uvConfig)
updateCombineInventory :: World -> Configuration -> SelectionSections CombinableItem -> SelectionSections CombinableItem
updateCombineInventory w cfig sss =
updateCombinePositioning :: Universe -> Universe
updateCombinePositioning u = u & uvWorld . hud . hudElement . subInventory . ciSections
%~ updateCombineSections (_uvWorld u) (_uvConfig u)
updateCombineSections :: World -> Configuration -> SelectionSections CombinableItem -> SelectionSections CombinableItem
updateCombineSections w cfig sss =
sss & sssSections
%~ updateSectionsPositioning
mselpos
@@ -83,8 +80,8 @@ orRegex f x str = case words str of
[] -> True
xs -> any (f x) xs
updateDisplayInventory :: Universe -> Universe
updateDisplayInventory u = u & uvWorld . hud . hudElement . diSections
updateInventoryPositioning :: Universe -> Universe
updateInventoryPositioning u = u & uvWorld . hud . hudElement . diSections
%~ updateDisplaySections (_uvWorld u) (_uvConfig u)
updateDisplaySections :: World -> Configuration -> SelectionSections () -> SelectionSections ()