Remove ComposedItem, to be replaced with PartiallyComposedItem
This commit is contained in:
@@ -27,17 +27,19 @@ useRootItem crid w = (worldEventFlags . at InventoryChange ?~ ()) . fromMaybe w
|
||||
cr <- w ^? cWorld . lWorld . creatures . ix crid
|
||||
itRef <- cr ^? crManipulation . manObject . imRootSelectedItem
|
||||
itmtree <- invRootTrees (_crInv cr) ^? ix itRef
|
||||
let itm = itmtree ^. ldtValue . cItem
|
||||
case itmtree ^. ldtValue . cItemFunction of
|
||||
let itm = itmtree ^. ldtValue . _1
|
||||
case itmtree ^. ldtValue . _2 of
|
||||
WeaponPlatformSF ->
|
||||
return $
|
||||
heldEffect (bimap _iatType _cItem itmtree) cr w
|
||||
heldEffect (bimap _iatType fst3 itmtree) cr w
|
||||
& pointerToItem itm . itUse . heldHammer .~ HammerDown
|
||||
EquipmentPlatformSF -> do
|
||||
guard (_crHammerPosition cr == HammerUp)
|
||||
invid <- itm ^? itLocation . ilInvID
|
||||
return $ toggleEquipmentAt invid cr w
|
||||
_ -> Nothing
|
||||
where
|
||||
fst3 (x,_,_) = x
|
||||
|
||||
-- where
|
||||
-- UseHotkey{} -> doequipmentchange
|
||||
|
||||
@@ -140,5 +140,5 @@ shoulderSH = translateSHz 20
|
||||
drawEquipment :: Creature -> SPic
|
||||
{-# INLINE drawEquipment #-}
|
||||
drawEquipment cr = foldMap
|
||||
(itemEquipPict cr . fmap (\(a, b, _) -> CItem a b))
|
||||
(itemEquipPict cr)
|
||||
(invLDT $ _crInv cr)
|
||||
|
||||
+28
-22
@@ -237,23 +237,23 @@ 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 PartiallyComposedItem -> Creature -> World -> World
|
||||
updateAttachedItems itmtree cr =
|
||||
cldtPropagateFold
|
||||
chainLinkOrientation
|
||||
chainLinkOrientation
|
||||
(updateItemWithOrientation cr)
|
||||
(heldItemRelativeOrient (_cItem $ _ldtValue itmtree) cr (0, Q.qID))
|
||||
(heldItemRelativeOrient (itmtree ^. ldtValue . _1) cr (0, Q.qID))
|
||||
(LocLDT TopLDT itmtree)
|
||||
|
||||
-- need to check rotation
|
||||
chainLinkOrientation ::
|
||||
(Point3, Q.Quaternion Float) ->
|
||||
ComposedItem ->
|
||||
PartiallyComposedItem ->
|
||||
ItemLink ->
|
||||
ComposedItem ->
|
||||
PartiallyComposedItem ->
|
||||
(Point3, Q.Quaternion Float)
|
||||
chainLinkOrientation mo (CItem par _) (ILink lt f) (CItem child _) =
|
||||
chainLinkOrientation mo (par, _, _) (ILink lt f) (child, _, _) =
|
||||
(p + Q.rotate q p1, q * q1)
|
||||
where
|
||||
(p, q) = mo
|
||||
@@ -262,36 +262,37 @@ chainLinkOrientation mo (CItem par _) (ILink lt f) (CItem child _) =
|
||||
updateItemWithOrientation ::
|
||||
Creature ->
|
||||
(Point3, Q.Quaternion Float) ->
|
||||
LocationLDT ItemLink ComposedItem ->
|
||||
LocationLDT ItemLink PartiallyComposedItem ->
|
||||
World ->
|
||||
World
|
||||
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
|
||||
updateItemWithOrientation cr m loc@(LocLDT _ itmtree) =
|
||||
case (ci ^. _1 . itType, ci ^. _2) 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
|
||||
ci = itmtree ^. ldtValue
|
||||
itm = ci ^. cItem
|
||||
itm = ci ^. _1
|
||||
|
||||
drawAugmentedHUD :: LocationLDT ItemLink ComposedItem -> World -> World
|
||||
drawAugmentedHUD :: LocationLDT ItemLink PartiallyComposedItem -> World -> World
|
||||
drawAugmentedHUD (LocLDT con _) w = fromMaybe w $ do
|
||||
itm <- con ^? cldtParent . cItem
|
||||
itm <- con ^? cldtParent . _1
|
||||
return $ w & cWorld . lWorld . flares <>~ drawTargeting itm w
|
||||
|
||||
shineTargetLaser ::
|
||||
Creature ->
|
||||
LabelDoubleTree ItemLink ComposedItem ->
|
||||
LabelDoubleTree ItemLink PartiallyComposedItem ->
|
||||
(Point3, Q.Quaternion Float) ->
|
||||
World ->
|
||||
World
|
||||
shineTargetLaser cr itmtree (p, q) w = fromMaybe (w & pointittarg . itTgPos .~ Nothing) $ do
|
||||
guard (crIsAiming cr)
|
||||
(_, mag) <- find (isammolink . _iatType . fst) (itmtree ^. ldtLeft)
|
||||
i <- mag ^? ldtValue . cItem . itUse . amagLoadStatus . iaLoaded
|
||||
i <- mag ^? ldtValue . _1 . itUse . amagLoadStatus . iaLoaded
|
||||
guard $ i >= x
|
||||
maginvid <- mag ^? ldtValue . cItem . itLocation . ilInvID
|
||||
maginvid <- mag ^? ldtValue . _1 . itLocation . ilInvID
|
||||
return $
|
||||
w
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
@@ -316,19 +317,24 @@ shineTargetLaser cr itmtree (p, q) w = fromMaybe (w & pointittarg . itTgPos .~ N
|
||||
isammolink _ = False
|
||||
pos = _crPos cr + xyV3 (rotate3 cdir (p + V3 5 0 0))
|
||||
cdir = _crDir cr
|
||||
itm = itmtree ^. ldtValue . cItem
|
||||
itm = itmtree ^. ldtValue . _1
|
||||
pointittarg = cWorld . lWorld . creatures . ix cid . crInv . ix invid . itTargeting
|
||||
cid = _crID cr
|
||||
invid = _ilInvID $ _itLocation itm
|
||||
col = blue -- mixColors reloadFrac (1-reloadFrac) blue red
|
||||
|
||||
shineTorch :: Creature -> LabelDoubleTree ItemLink ComposedItem -> (Point3, Q.Quaternion Float) -> World -> World
|
||||
shineTorch ::
|
||||
Creature ->
|
||||
LabelDoubleTree ItemLink PartiallyComposedItem ->
|
||||
(Point3, Q.Quaternion Float) ->
|
||||
World ->
|
||||
World
|
||||
shineTorch cr itmtree (p, q) = fromMaybe id $ do
|
||||
(_, mag) <- find (isammolink . _iatType . fst) (itmtree ^. ldtLeft)
|
||||
i <- mag ^? ldtValue . cItem . itUse . amagLoadStatus . iaLoaded
|
||||
i <- mag ^? ldtValue . _1 . itUse . amagLoadStatus . iaLoaded
|
||||
guard $ crIsAiming cr
|
||||
guard $ i >= x
|
||||
invid <- mag ^? ldtValue . cItem . itLocation . ilInvID
|
||||
invid <- mag ^? ldtValue . _1 . itLocation . ilInvID
|
||||
return $
|
||||
--(cWorld . lWorld . tempLightSources .:~ tlsTimeRadColPos 1 250 0.7 pos'')
|
||||
(cWorld . lWorld . lights .:~ LSParam pos'' 250 0.7)
|
||||
|
||||
Reference in New Issue
Block a user