Major item refactor, still broken
This commit is contained in:
@@ -17,12 +17,14 @@ import qualified IntMapHelp as IM
|
||||
checkInvSlotsYou :: Item -> World -> Maybe Int
|
||||
checkInvSlotsYou it w = do
|
||||
ycr <- w ^? cWorld . lWorld . creatures . ix 0
|
||||
guard $ crNumFreeSlots ycr >= itInvHeight it
|
||||
guard $ crNumFreeSlots (w ^. cWorld . lWorld . items) ycr >= itInvHeight it
|
||||
Just . IM.newKey $ _crInv ycr
|
||||
|
||||
crNumFreeSlots :: Creature -> Int
|
||||
crNumFreeSlots :: IM.IntMap Item -> Creature -> Int
|
||||
--crNumFreeSlots cr = _crInvCapacity cr - invSize (_crInv cr)
|
||||
crNumFreeSlots cr = maxInvSlots - invSize (_crInv cr)
|
||||
crNumFreeSlots m cr = maxInvSlots - invSize (fmap f (_crInv cr))
|
||||
where
|
||||
f i = m ^?! ix i
|
||||
|
||||
maxInvSlots :: Int
|
||||
maxInvSlots = 25
|
||||
|
||||
Reference in New Issue
Block a user