Fix burst rifle rate delay bug, various cleanups
This commit is contained in:
@@ -24,9 +24,8 @@ useItem invid pt w = fmap (worldEventFlags . at InventoryChange ?~ ()) $ do
|
||||
let usedloc = useLocation itmloc
|
||||
useItemLoc cr usedloc pt w
|
||||
|
||||
useItemLoc ::
|
||||
Creature ->
|
||||
LocationLDT ItemLink ComposedItem ->
|
||||
useItemLoc :: Creature ->
|
||||
LocationLDT ItemLink CItem ->
|
||||
PressType ->
|
||||
World ->
|
||||
Maybe World
|
||||
@@ -63,7 +62,7 @@ useItemLoc cr loc pt w
|
||||
ldt = loc ^. locLDT
|
||||
itm = ldt ^. ldtValue . _1
|
||||
|
||||
useLocation :: LocationLDT ItemLink ComposedItem -> LocationLDT ItemLink ComposedItem
|
||||
useLocation :: LocationLDT ItemLink CItem -> LocationLDT ItemLink CItem
|
||||
useLocation loc
|
||||
| isJust $ loc ^? locLDT . ldtValue . _1 . itType . ibtEquip = loc
|
||||
| isJust $ loc ^? locLDT . ldtValue . _1 . itUse . uaParams . apProjectiles . ix 0 =
|
||||
@@ -81,10 +80,7 @@ structureUseAtLoc = \case
|
||||
MapperSF -> True
|
||||
_ -> False
|
||||
|
||||
activateDetonator ::
|
||||
LabelDoubleTree ItemLink ComposedItem ->
|
||||
World ->
|
||||
World
|
||||
activateDetonator :: LabelDoubleTree ItemLink CItem -> World -> World
|
||||
activateDetonator det = fromMaybe id $ do
|
||||
pjid <- det ^? ldtValue . _1 . itUse . uaParams . apProjectiles . ix 0
|
||||
return $ cWorld . lWorld . projectiles . ix pjid . pjTimer .~ 0
|
||||
|
||||
+11
-11
@@ -149,7 +149,7 @@ invRootItemEffs cr =
|
||||
(reduceLocLDT (Endo . invItemLocUpdate cr) . LocLDT TopLDT)
|
||||
(invLDT (_crInv cr))
|
||||
|
||||
invItemLocUpdate :: Creature -> LocationLDT ItemLink ComposedItem -> World -> World
|
||||
invItemLocUpdate :: Creature -> LocationLDT ItemLink CItem -> World -> World
|
||||
invItemLocUpdate cr loc w = doAnyEquipmentEffect loc cr $ case itm ^. itType of
|
||||
ATTACH BULLETSYNTH -> trySynthBullet loc w
|
||||
EQUIP WRIST_ECG | haspulse -> tryUseParent loc w
|
||||
@@ -175,21 +175,21 @@ copierItemUpdate itm cr w = fromMaybe w $ do
|
||||
v <- getItemValue itm' w cr
|
||||
return $ w & pointerToItem itm . itUse . uValue .~ v
|
||||
|
||||
doAnyEquipmentEffect :: LocationLDT ItemLink ComposedItem -> Creature -> World -> World
|
||||
doAnyEquipmentEffect :: LocationLDT ItemLink CItem -> Creature -> World -> World
|
||||
doAnyEquipmentEffect loc cr = case itm ^? itLocation . ilEquipSite . _Just of
|
||||
Just _ -> equipBackgroundEffect loc cr
|
||||
_ -> id
|
||||
where
|
||||
itm = loc ^. locLDT . ldtValue . _1
|
||||
|
||||
tryUseParent :: LocationLDT ItemLink ComposedItem -> World -> World
|
||||
tryUseParent :: LocationLDT ItemLink CItem -> World -> World
|
||||
tryUseParent loc w = fromMaybe w $ do
|
||||
t <- locUp loc
|
||||
let t' = bimap (^. iatType) (^. _1) $ t ^. locLDT
|
||||
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
||||
return $ heldEffectNoHammerCheck t' cr w
|
||||
|
||||
trySynthBullet :: LocationLDT ItemLink ComposedItem -> World -> World
|
||||
trySynthBullet :: LocationLDT ItemLink CItem -> World -> World
|
||||
trySynthBullet loc w = fromMaybe w $ do
|
||||
i <- itm ^? itLocation . ilInvID
|
||||
x <- itm ^? itUse . uaParams . apInt
|
||||
@@ -248,7 +248,7 @@ updateHeldRootItem cr = fromMaybe id $ do
|
||||
itmtree <- invRootTrees (_crInv cr) ^? ix invid
|
||||
return $ updateAttachedItems itmtree cr
|
||||
|
||||
updateAttachedItems :: LabelDoubleTree ItemLink ComposedItem -> Creature -> World -> World
|
||||
updateAttachedItems :: LabelDoubleTree ItemLink CItem -> Creature -> World -> World
|
||||
updateAttachedItems itmtree cr =
|
||||
cldtPropagateFold
|
||||
chainLinkOrientation
|
||||
@@ -260,9 +260,9 @@ updateAttachedItems itmtree cr =
|
||||
-- need to check rotation
|
||||
chainLinkOrientation ::
|
||||
(Point3, Q.Quaternion Float) ->
|
||||
ComposedItem ->
|
||||
CItem ->
|
||||
ItemLink ->
|
||||
ComposedItem ->
|
||||
CItem ->
|
||||
(Point3, Q.Quaternion Float)
|
||||
chainLinkOrientation (p, q) par (ILink lt f) child = (p + Q.rotate q p1, q * q1)
|
||||
where
|
||||
@@ -271,7 +271,7 @@ chainLinkOrientation (p, q) par (ILink lt f) child = (p + Q.rotate q p1, q * q1)
|
||||
updateItemWithOrientation ::
|
||||
Creature ->
|
||||
(Point3, Q.Quaternion Float) ->
|
||||
LocationLDT ItemLink ComposedItem ->
|
||||
LocationLDT ItemLink CItem ->
|
||||
World ->
|
||||
World
|
||||
updateItemWithOrientation cr m loc@(LocLDT _ itmtree) w =
|
||||
@@ -285,7 +285,7 @@ updateItemWithOrientation cr m loc@(LocLDT _ itmtree) w =
|
||||
ci = itmtree ^. ldtValue
|
||||
itm = ci ^. _1
|
||||
|
||||
drawARHUD :: LocationLDT ItemLink ComposedItem -> World -> World
|
||||
drawARHUD :: LocationLDT ItemLink CItem -> World -> World
|
||||
drawARHUD (LocLDT con _) w = fromMaybe w $ do
|
||||
itm <- con ^? cldtParent . _1
|
||||
return $
|
||||
@@ -295,7 +295,7 @@ drawARHUD (LocLDT con _) w = fromMaybe w $ do
|
||||
|
||||
shineTargetLaser ::
|
||||
Creature ->
|
||||
LabelDoubleTree ItemLink ComposedItem ->
|
||||
LabelDoubleTree ItemLink CItem ->
|
||||
(Point3, Q.Quaternion Float) ->
|
||||
World ->
|
||||
World
|
||||
@@ -336,7 +336,7 @@ shineTargetLaser cr itmtree (p, q) w = fromMaybe (w & pointittarg . itTgPos .~ N
|
||||
|
||||
shineTorch ::
|
||||
Creature ->
|
||||
LabelDoubleTree ItemLink ComposedItem ->
|
||||
LabelDoubleTree ItemLink CItem ->
|
||||
(Point3, Q.Quaternion Float) ->
|
||||
World ->
|
||||
World
|
||||
|
||||
Reference in New Issue
Block a user