Simplify item composition structure
This commit is contained in:
@@ -216,7 +216,7 @@ doAnyEquipmentEffect loc cr = case itm ^? itLocation . ilEquipSite . _Just of
|
||||
tryUseParent :: LocationLDT ItemLink CItem -> World -> World
|
||||
tryUseParent loc w = fromMaybe w $ do
|
||||
t <- locUp loc
|
||||
let t' = bimap (^. iatType) (^. _1) $ t ^. locLDT
|
||||
let t' = bimap id (^. _1) $ t ^. locLDT
|
||||
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
||||
return $ heldEffectNoHammerCheck t' cr w
|
||||
|
||||
@@ -295,7 +295,7 @@ chainLinkOrientation ::
|
||||
ItemLink ->
|
||||
CItem ->
|
||||
(Point3, Q.Quaternion Float)
|
||||
chainLinkOrientation (p, q) par (ILink lt) child = (p + Q.rotate q p1, q * q1)
|
||||
chainLinkOrientation (p, q) par lt child = (p + Q.rotate q p1, q * q1)
|
||||
where
|
||||
(p1, q1) = orientAttachment (par ^. _1) lt (child ^. _1)
|
||||
|
||||
@@ -332,7 +332,7 @@ shineTargetLaser ::
|
||||
World
|
||||
shineTargetLaser cr itmtree (p, q) w = fromMaybe (w & pointittarg . itTgPos .~ Nothing) $ do
|
||||
guard (crIsAiming cr)
|
||||
(_, mag) <- find (isammolink . _iatType . fst) (itmtree ^. ldtLeft)
|
||||
(_, mag) <- find (isammolink . fst) (itmtree ^. ldtLeft)
|
||||
i <- mag ^. ldtValue . _1 . itConsumables
|
||||
guard $ i >= x
|
||||
maginvid <- mag ^? ldtValue . _1 . itLocation . ilInvID
|
||||
@@ -372,7 +372,7 @@ shineTorch ::
|
||||
World ->
|
||||
World
|
||||
shineTorch cr itmtree (p, q) = fromMaybe id $ do
|
||||
(_, mag) <- find (isammolink . _iatType . fst) (itmtree ^. ldtLeft)
|
||||
(_, mag) <- find (isammolink . fst) (itmtree ^. ldtLeft)
|
||||
i <- mag ^. ldtValue . _1 . itConsumables
|
||||
guard $ crIsAiming cr
|
||||
guard $ i >= x
|
||||
|
||||
Reference in New Issue
Block a user