Hack together correct positioning of grenades from attached items
This commit is contained in:
@@ -25,7 +25,7 @@ useItem invid pt w = fmap (worldEventFlags . at InventoryChange ?~ ()) $ do
|
||||
useItemLoc cr usedloc pt w
|
||||
|
||||
useItemLoc :: Creature ->
|
||||
LocationLDT ItemLink CItem ->
|
||||
LocationLDT ItemLink OItem ->
|
||||
PressType ->
|
||||
World ->
|
||||
Maybe World
|
||||
@@ -33,13 +33,13 @@ useItemLoc cr loc pt w
|
||||
| HeldPlatformSF <- sf
|
||||
, fromMaybe False $ loc ^? locLDT . ldtValue . _1 . itLocation . ilIsRoot
|
||||
, Aiming {} <- cr ^. crStance . posture =
|
||||
return $ heldEffect pt (bimap id (^. _1) ldt) cr w
|
||||
return $ heldEffect pt (bimap id id ldt) cr w
|
||||
| GadgetPlatformSF <- sf =
|
||||
return $ gadgetEffect pt loc cr w
|
||||
| UnderBarrelPlatformSF <- sf
|
||||
, fromMaybe False $ loc ^? locLDT . ldtValue . _1 . itLocation . ilIsAttached
|
||||
, Aiming {} <- cr ^. crStance . posture =
|
||||
return $ heldEffect pt (bimap id (^. _1) ldt) cr w
|
||||
return $ heldEffect pt (bimap id id ldt) cr w
|
||||
| RemoteDetonatorSF <- sf
|
||||
, pt == InitialPress =
|
||||
return $ activateDetonator ldt w
|
||||
@@ -62,7 +62,7 @@ useItemLoc cr loc pt w
|
||||
ldt = loc ^. locLDT
|
||||
itm = ldt ^. ldtValue . _1
|
||||
|
||||
useLocation :: LocationLDT ItemLink CItem -> LocationLDT ItemLink CItem
|
||||
useLocation :: LocationLDT ItemLink OItem -> LocationLDT ItemLink OItem
|
||||
useLocation loc
|
||||
| isJust $ loc ^? locLDT . ldtValue . _1 . itType . ibtEquip = loc
|
||||
| isJust $ loc ^? locLDT . ldtValue . _1 . itUse . uaParams . apProjectiles . ix 0 =
|
||||
@@ -80,7 +80,7 @@ structureUseAtLoc = \case
|
||||
MapperSF -> True
|
||||
_ -> False
|
||||
|
||||
activateDetonator :: LDTree ItemLink CItem -> World -> World
|
||||
activateDetonator :: LDTree ItemLink OItem -> World -> World
|
||||
activateDetonator det = fromMaybe id $ do
|
||||
pjid <- det ^? ldtValue . _1 . itUse . uaParams . apProjectiles . ix 0
|
||||
return $ cWorld . lWorld . projectiles . ix pjid . pjTimer .~ 0
|
||||
|
||||
Reference in New Issue
Block a user