Simplify right button options
This commit is contained in:
+13
-12
@@ -1,14 +1,14 @@
|
||||
module Dodge.Inventory.Add
|
||||
( tryPutItemInInv
|
||||
, createPutItem
|
||||
, createAndSelectItem
|
||||
)where
|
||||
module Dodge.Inventory.Add (
|
||||
tryPutItemInInv,
|
||||
createPutItem,
|
||||
createAndSelectItem,
|
||||
) where
|
||||
|
||||
import Dodge.Data.SelectionList
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
import Dodge.Base.You
|
||||
import Dodge.Combine.Module
|
||||
import Dodge.Data.SelectionList
|
||||
import Dodge.Data.World
|
||||
import Dodge.FloorItem
|
||||
import Dodge.Inventory.CheckSlots
|
||||
@@ -16,8 +16,8 @@ import qualified IntMapHelp as IM
|
||||
|
||||
putItemInInvID :: Int -> Int -> World -> (Maybe Int, World)
|
||||
putItemInInvID cid flid w = fromMaybe (Nothing, w) $ do
|
||||
--(i, w') <- tryPutItemInInv cid (_floorItems (_cWorld w) IM.! flid) w
|
||||
(i, w') <- tryPutItemInInv cid (w ^?! cWorld . lWorld . floorItems . ix flid) w
|
||||
flit <- w ^? cWorld . lWorld . floorItems . ix flid
|
||||
(i, w') <- tryPutItemInInv cid flit w
|
||||
return (Just i, w')
|
||||
|
||||
putItemInInvSlot :: Int -> Item -> IM.IntMap Item -> IM.IntMap Item
|
||||
@@ -42,10 +42,11 @@ tryPutItemInInv cid flit w = case maybeInvSlot of
|
||||
|
||||
createAndSelectItem :: Item -> World -> World
|
||||
createAndSelectItem itm w = case createPutItem itm w of
|
||||
(Just i, w') -> w'
|
||||
& hud . hudElement . diSections . sssExtra . sssSelPos ?~ (0,i)
|
||||
& cWorld . lWorld . creatures . ix 0 . crManipulation . manObject
|
||||
.~ InInventory (SelItem i NoInvSelAction)
|
||||
(Just i, w') ->
|
||||
w'
|
||||
& hud . hudElement . diSections . sssExtra . sssSelPos ?~ (0, i)
|
||||
& cWorld . lWorld . creatures . ix 0 . crManipulation . manObject
|
||||
.~ InInventory (SelItem i NoInvSelAction)
|
||||
(Nothing, w') -> w'
|
||||
|
||||
createPutItem :: Item -> World -> (Maybe Int, World)
|
||||
|
||||
Reference in New Issue
Block a user