Add files

This commit is contained in:
2024-09-23 13:12:25 +01:00
parent 5262355368
commit 3a08cf93f5
2 changed files with 82 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
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