feat(gs/xanthous): Creatures drop their items when they die

When a creature is killed, it now drops all the contents of its
inventory on the ground.

Change-Id: Ie95c397308ba2c9861f10e58b99c91c9cc759c56
This commit is contained in:
Griffin Smith 2021-11-25 10:14:00 -05:00 committed by grfn
parent a3d220b631
commit 604319850c
3 changed files with 24 additions and 4 deletions

View file

@ -34,7 +34,7 @@ module Xanthous.Util
, times, times_, endoTimes
-- * State utilities
, modifyK, modifyKL
, modifyK, modifyKL, useListOf
-- * Type-level programming utils
, KnownBool(..)
@ -311,6 +311,14 @@ modifyK k = get >>= k >>= put
modifyKL :: MonadState s m => LensLike m s s a b -> (a -> m b) -> m ()
modifyKL l k = get >>= traverseOf l k >>= put
-- | Use a list of all the targets of a 'Fold' in the current state
--
-- @@
-- evalState (useListOf folded) === toList
-- @@
useListOf :: MonadState s m => Getting (Endo [a]) s a -> m [a]
useListOf = gets . toListOf
--------------------------------------------------------------------------------
-- | A newtype wrapper around 'Char' whose 'Enum' and 'Bounded' instances only