Fix burst rifle rate delay bug, various cleanups

This commit is contained in:
2025-06-25 23:47:41 +01:00
parent 1bdf426c42
commit 5b35b4c6c8
19 changed files with 440 additions and 469 deletions
+11 -11
View File
@@ -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