Use constructed laser as targeting scope
This commit is contained in:
@@ -196,14 +196,15 @@ updateItemWithOrientation ::
|
||||
LocationLDT ItemLink ComposedItem ->
|
||||
World ->
|
||||
World
|
||||
updateItemWithOrientation cr m loc@(LocLDT _ itmtree) = case _itType itm of
|
||||
HELD TORCH -> shineTorch cr itmtree m
|
||||
TARGETING TARGETLASER -> shineTargetLaser cr itmtree m
|
||||
TARGETING tt -> updateItemTargeting tt cr itm
|
||||
ATTACH AUGMENTEDHUD -> drawAugmentedHUD loc
|
||||
updateItemWithOrientation cr m loc@(LocLDT _ itmtree) = case (ci ^. cItem . itType, ci ^. cItemFunction) of
|
||||
(HELD TORCH, _) -> shineTorch cr itmtree m
|
||||
(HELD LASER, WeaponTargetingSF) -> shineTargetLaser cr itmtree m
|
||||
(TARGETING tt, _) -> updateItemTargeting tt cr itm
|
||||
(ATTACH AUGMENTEDHUD, _) -> drawAugmentedHUD loc
|
||||
_ -> id
|
||||
where
|
||||
itm = itmtree ^. ldtValue . cItem
|
||||
ci = itmtree ^. ldtValue
|
||||
itm = ci ^. cItem
|
||||
|
||||
drawAugmentedHUD :: LocationLDT ItemLink ComposedItem -> World -> World
|
||||
drawAugmentedHUD (LocLDT con _) w = fromMaybe w $ do
|
||||
@@ -219,6 +220,7 @@ shineTargetLaser cr itmtree (p,q) w = fromMaybe (w & pointittarg . itTgPos .~ No
|
||||
guard $ i >= x
|
||||
maginvid <- mag ^? ldtValue . cItem . itLocation . ilInvID
|
||||
return $ w
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
& cWorld . lWorld . creatures . ix (_crID cr)
|
||||
. crInv . ix maginvid . itUse . amagLoadStatus . iaLoaded -~ x
|
||||
& cWorld . lWorld . lasers .:~ LaserStart
|
||||
@@ -245,6 +247,7 @@ shineTorch :: Creature -> LabelDoubleTree ItemLink ComposedItem -> (Point3, Q.Qu
|
||||
shineTorch cr itmtree (p, q) = fromMaybe id $ do
|
||||
(_, mag) <- find (isammolink . _iatType . fst) (itmtree ^. ldtLeft)
|
||||
i <- mag ^? ldtValue . cItem . itUse . amagLoadStatus . iaLoaded
|
||||
guard $ crIsAiming cr
|
||||
guard $ i >= x
|
||||
invid <- mag ^? ldtValue . cItem . itLocation . ilInvID
|
||||
return $
|
||||
|
||||
Reference in New Issue
Block a user