Allow for laser to be attached to transformer to create weapon

This commit is contained in:
2025-07-10 10:31:04 +01:00
parent f557d5b954
commit e3c6ef1398
5 changed files with 49 additions and 55 deletions
+5 -3
View File
@@ -20,13 +20,15 @@ useItem invid pt w = fmap (worldEventFlags . at InventoryChange ?~ ()) $ do
cr <- w ^? cWorld . lWorld . creatures . ix 0
itmloc <- allInvLocs (_crInv cr) ^? ix invid . _2
useItemLoc cr itmloc pt w
-- let usedloc = chooseUseLocation itmloc
-- useItemLoc cr usedloc pt w
useItemLoc :: Creature -> LocationLDT ItemLink OItem -> PressType -> World -> Maybe World
useItemLoc cr loc pt w
| HeldPlatformSF <- sf
, fromMaybe False $ loc ^? locLDT . ldtValue . _1 . itLocation . ilIsRoot
, fromMaybe False $ loc ^? locLDT . ldtValue . _1 . itLocation . ilIsAttached
, Aiming{} <- cr ^. crStance . posture =
return $ gadgetEffect pt loc cr w
| LaserWeaponSF <- sf
, fromMaybe False $ loc ^? locLDT . ldtValue . _1 . itLocation . ilIsAttached
, Aiming{} <- cr ^. crStance . posture =
return $ gadgetEffect pt loc cr w
| GadgetPlatformSF <- sf =