Separate out concrete part of world
This commit is contained in:
@@ -18,15 +18,15 @@ copyItemToFloor pos it = snd . copyItemToFloorID pos it
|
||||
{- | Copy an item to the floor, returns the floor item's id. -}
|
||||
copyItemToFloorID :: Point2 -> Item -> World -> (Int, World)
|
||||
copyItemToFloorID pos it w = (,) flid $ w'
|
||||
& floorItems %~ IM.insert flid theflit
|
||||
& cWorld . floorItems %~ IM.insert flid theflit
|
||||
& updateLocation
|
||||
where
|
||||
(p',w') = findWallFreeDropPoint (_dimRad $ _itDimension it) pos w
|
||||
rot = fst . randomR (-pi,pi) $ _randGen w
|
||||
updateLocation = case it ^? itID of
|
||||
Just (Just i') -> itemPositions . ix i' .~ OnFloor flid
|
||||
Just (Just i') -> cWorld . itemPositions . ix i' .~ OnFloor flid
|
||||
_ -> id
|
||||
flid = IM.newKey $ _floorItems w
|
||||
flid = IM.newKey $ _floorItems (_cWorld w)
|
||||
theflit = FlIt
|
||||
{_flIt = it & itConsumption . icAmount %~ const 1
|
||||
,_flItPos = p'
|
||||
|
||||
Reference in New Issue
Block a user