Fix multiple left click explosions of remote rockets

This commit is contained in:
2024-11-29 20:55:51 +00:00
parent 59c65b059a
commit 126f328198
+6
View File
@@ -14,6 +14,8 @@ selectUse itm _ w = fromMaybe w $ do
itid <- itm ^? itID
pjid <- itm ^? itUse . uaParams . apLinkedProjectile . _Just
thepj <- w ^? cWorld . lWorld . projectiles . ix pjid
topupdate <- thepj ^? prjUpdates . ix 0
guard $ notdestroyed topupdate -- this assumes that "destroyed" projectiles always have the same type of update at the top
return $
w
& cWorld . lWorld . projectiles . ix pjid . prjUpdates .~ [DestroyPU (Just itid) 30] -- 69 is placeholder, should be removed
@@ -21,6 +23,10 @@ selectUse itm _ w = fromMaybe w $ do
-- & itPoint . itUse . heldUse .~ HeldDoNothing
-- & itPoint . itUse . heldMods .~ DoNothingMod
& usePayload (_prjPayload thepj) (_prjPos thepj)
where
notdestroyed DestroyPU{} = False
notdestroyed _ = True
-- where
-- itPoint = pointerToItemLocation $ w ^?! cWorld . lWorld . itemLocations . ix itid-- _itemLocations (_cWorld w) IM.! itid