24 lines
959 B
Haskell
24 lines
959 B
Haskell
module Dodge.SelectUse
|
|
where
|
|
|
|
import Dodge.Payload
|
|
import Dodge.Data.ComposedItem
|
|
import Dodge.Data.DoubleTree
|
|
import Dodge.Data.World
|
|
import Data.Maybe
|
|
import Control.Lens
|
|
|
|
selectUse :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
|
|
selectUse ittree _ w = fromMaybe w $ do
|
|
pjid <- ittree ^? ldtValue . itUse . atLinkedProjectile . _Just
|
|
thepj <- w ^? cWorld . lWorld . projectiles . ix pjid
|
|
return $ w
|
|
& cWorld . lWorld . projectiles . ix pjid . prjUpdates .~ [PJRetireRemote 69 30 pjid] -- 69 is placeholder, should be removed
|
|
& cWorld . lWorld . projectiles . ix pjid . prjDraw .~ DrawBlankProjectile
|
|
-- & itPoint . itUse . heldUse .~ HeldDoNothing
|
|
-- & itPoint . itUse . heldMods .~ DoNothingMod
|
|
& usePayload (_prjPayload thepj) (_prjPos thepj)
|
|
where
|
|
-- itPoint = pointerToItemLocation $ w ^?! cWorld . lWorld . itemLocations . ix itid-- _itemLocations (_cWorld w) IM.! itid
|
|
|