Fix scope rotation after torque
This commit is contained in:
@@ -2,9 +2,11 @@ module Dodge.Item.Location (
|
||||
pointerToItemLocation,
|
||||
getItem,
|
||||
pointerToItem,
|
||||
pointerYourItem,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
import Dodge.Data.World
|
||||
|
||||
getItem :: Int -> World -> Maybe Item
|
||||
@@ -26,6 +28,11 @@ pointerToItemLocation (InInv cid invid) = cWorld . lWorld . creatures . ix cid .
|
||||
pointerToItemLocation (OnFloor flid) = cWorld . lWorld . floorItems . ix flid . flIt
|
||||
pointerToItemLocation _ = const pure
|
||||
|
||||
pointerYourItem :: Applicative a => (Item -> a Item) -> World -> a World
|
||||
pointerYourItem f w = fromMaybe (pure w) $ do
|
||||
itinvid <- w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . inInventory . ispItem
|
||||
Just $ pointerToItemLocation (InInv 0 itinvid) f w
|
||||
|
||||
pointerToItem ::
|
||||
Applicative f =>
|
||||
Item ->
|
||||
|
||||
Reference in New Issue
Block a user