Hack together general held item orientation
This commit is contained in:
@@ -311,7 +311,7 @@ updateItemWithOrientation cr m loc@(LocLDT _ itmtree) w =
|
||||
case (ci ^. _1 . itType, ci ^. _2) of
|
||||
(HELD TORCH, _) -> shineTorch cr itmtree m w
|
||||
--(HELD LASER, WeaponTargetingSF) -> shineTargetLaser cr itmtree m w
|
||||
(HELD LASER, WeaponTargetingSF) -> shineTargetLaser' cr loc w
|
||||
(HELD LASER, WeaponTargetingSF) -> shineTargetLaser cr loc w
|
||||
(TARGETING tt, _) -> updateItemTargeting tt cr itm w
|
||||
(ARHUD, _) -> drawARHUD loc w
|
||||
_ -> w
|
||||
@@ -327,12 +327,8 @@ drawARHUD (LocLDT con _) w = fromMaybe w $ do
|
||||
<>~ fold
|
||||
(drawTargetingAR itm w <|> drawMapperAR itm w)
|
||||
|
||||
shineTargetLaser' ::
|
||||
Creature ->
|
||||
LocationLDT ItemLink CItem ->
|
||||
World ->
|
||||
World
|
||||
shineTargetLaser' cr loc w = fromMaybe (w & pointittarg . itTgPos .~ Nothing) $ do
|
||||
shineTargetLaser :: Creature -> LocationLDT ItemLink CItem -> World -> World
|
||||
shineTargetLaser cr loc w = fromMaybe (w & pointittarg . itTgPos .~ Nothing) $ do
|
||||
guard (crIsAiming cr)
|
||||
(_, mag) <- find (isammolink . fst) (itmtree ^. ldtLeft)
|
||||
i <- mag ^. ldtValue . _1 . itConsumables
|
||||
@@ -357,11 +353,12 @@ shineTargetLaser' cr loc w = fromMaybe (w & pointittarg . itTgPos .~ Nothing) $
|
||||
}
|
||||
where
|
||||
itmtree = loc ^. locLDT
|
||||
(p,q) = orientLocation $ fmap fst loc
|
||||
(p,q) = heldItemRelativeOrient (locToTop loc ^. locLDT . ldtValue . _1) cr
|
||||
$ orientLocation (V3 0 0 0,Q.qID) (fmap fst loc) (V3 5 0 0,Q.qID)
|
||||
x = 1
|
||||
isammolink AmmoInLink{} = True
|
||||
isammolink _ = False
|
||||
pos = _crPos cr + xyV3 (rotate3 cdir (p + V3 5 0 0))
|
||||
pos = _crPos cr + xyV3 (rotate3 cdir p)
|
||||
cdir = _crDir cr
|
||||
itm = itmtree ^. ldtValue . _1
|
||||
pointittarg = cWorld . lWorld . creatures . ix cid . crInv . ix invid . itTargeting
|
||||
|
||||
Reference in New Issue
Block a user