Fix bugs in drag pickup when releasing mouse outside of inventory list
This commit is contained in:
+6
-10
@@ -7,23 +7,19 @@ import Dodge.Data.World
|
||||
import Dodge.Item.InvSize
|
||||
import Geometry
|
||||
import LensHelp
|
||||
--import qualified IntMapHelp as IM
|
||||
import NewInt
|
||||
import System.Random
|
||||
|
||||
-- | Copy an item to the floor
|
||||
copyItemToFloor :: Point2 -> Item -> World -> World
|
||||
copyItemToFloor pos it w =
|
||||
copyItemToFloor p it w =
|
||||
w'
|
||||
& cWorld . lWorld . floorItems . at (_unNInt $ _itID it) ?~ theflit
|
||||
& cWorld . lWorld . items . at (_unNInt $ _itID it) ?~ (it & itLocation .~ OnFloor)
|
||||
& hud . closeItems .:~ _itID it
|
||||
& cWorld . lWorld . floorItems . at (it ^. itID . unNInt) ?~ FlIt q r
|
||||
& cWorld . lWorld . items . at (it ^. itID . unNInt) ?~ (it & itLocation .~ OnFloor)
|
||||
& hud . closeItems .:~ _itID it -- puts item at top of close items
|
||||
where
|
||||
-- & hud . hudElement . diSections . ix 3 . ssOffset .~ 0
|
||||
-- ensures dropped item is at the top of the close item selection list
|
||||
(p', w') = findWallFreeDropPoint (_dimRad $ itDim it) pos w
|
||||
rot = fst . randomR (- pi, pi) $ _randGen w
|
||||
theflit = FlIt{_flItPos = p', _flItRot = rot}
|
||||
(q, w') = findWallFreeDropPoint (_dimRad $ itDim it) p w
|
||||
r = fst . randomR (- pi, pi) $ _randGen w
|
||||
|
||||
cardinalVectors :: [Point2]
|
||||
cardinalVectors = [ V2 1 0 , V2 0 1 , V2 (-1) 0 , V2 0 (-1) ]
|
||||
|
||||
Reference in New Issue
Block a user