Commit before using item structural function more prominently
This commit is contained in:
@@ -236,7 +236,8 @@ inventoryX c = case c of
|
||||
'U' ->
|
||||
[targetingScope tt | tt <- [minBound .. maxBound]]
|
||||
<>
|
||||
[ launcher
|
||||
[ battery
|
||||
, launcher
|
||||
, megaShellMag
|
||||
, homingModule
|
||||
, remoteScreen
|
||||
|
||||
@@ -161,9 +161,7 @@ equipmentEffects cr = alaf Endo foldMap (useEquipment cr) (IM.keys $ _crInvEquip
|
||||
invSideEff :: Creature -> World -> World
|
||||
invSideEff cr = alaf Endo foldMap f (_crInv cr) . updateHeldRootItem cr
|
||||
where
|
||||
f it =
|
||||
itemInvSideEffect cr it
|
||||
. maybe id (\g -> doInvEffect g it cr) (it ^? itEffect . ieInv)
|
||||
f it = maybe id (\g -> doInvEffect g it cr) (it ^? itEffect . ieInv)
|
||||
|
||||
updateHeldRootItem :: Creature -> World -> World
|
||||
updateHeldRootItem cr = fromMaybe id $ do
|
||||
@@ -200,7 +198,8 @@ updateItemWithOrientation ::
|
||||
World
|
||||
updateItemWithOrientation cr m loc@(LocLDT _ itmtree) = case _itType itm of
|
||||
HELD TORCH -> shineTorch cr itmtree m
|
||||
TARGETING TARGETLASER -> makeTargetLaser cr itmtree m
|
||||
TARGETING TARGETLASER -> shineTargetLaser cr itmtree m
|
||||
TARGETING tt -> updateItemTargeting tt cr itm
|
||||
ATTACH AUGMENTEDHUD -> drawAugmentedHUD loc
|
||||
_ -> id
|
||||
where
|
||||
@@ -211,16 +210,17 @@ drawAugmentedHUD (LocLDT con _) w = fromMaybe w $ do
|
||||
itm <- con ^? cldtParent
|
||||
return $ w & cWorld . lWorld . flares <>~ drawTargeting itm w
|
||||
|
||||
makeTargetLaser :: Creature -> LabelDoubleTree ItemLink Item -> (Point3, Q.Quaternion Float)
|
||||
shineTargetLaser :: Creature -> LabelDoubleTree ItemLink Item -> (Point3, Q.Quaternion Float)
|
||||
-> World -> World
|
||||
makeTargetLaser cr itmtree (p,q) w = fromMaybe (w & pointItUse . tgPos .~ Nothing) $ do
|
||||
shineTargetLaser cr itmtree (p,q) w = fromMaybe (w & pointItUse . tgPos .~ Nothing) $ do
|
||||
guard (crIsAiming cr)
|
||||
(_, mag) <- find (isammolink . _iatType . fst) (itmtree ^. ldtLeft)
|
||||
i <- mag ^? ldtValue . itUse . amagLoadStatus . iaLoaded
|
||||
guard $ i >= x
|
||||
maginvid <- mag ^? ldtValue . itLocation . ilInvID
|
||||
return $ w
|
||||
& cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix maginvid . itUse . amagLoadStatus . iaLoaded -~ x
|
||||
& cWorld . lWorld . creatures . ix (_crID cr)
|
||||
. crInv . ix maginvid . itUse . amagLoadStatus . iaLoaded -~ x
|
||||
& cWorld . lWorld . lasers .:~ LaserStart
|
||||
{ _lpPhaseV = 1
|
||||
, _lpDir = _crDir cr + argV (Q.qToV2 q)
|
||||
@@ -258,11 +258,6 @@ shineTorch cr itmtree (p, q) = fromMaybe id $ do
|
||||
cdir = _crDir cr
|
||||
d = _crDir cr + argV (Q.qToV2 q)
|
||||
|
||||
itemInvSideEffect :: Creature -> Item -> World -> World
|
||||
itemInvSideEffect cr itm = case _itType itm of
|
||||
TARGETING tt -> updateItemTargeting tt cr itm
|
||||
_ -> id
|
||||
|
||||
-- this probably needs to be set to null when dropped as well?
|
||||
-- does this need to be updated if it is not attached to the used root item?
|
||||
updateItemTargeting :: TargetingType -> Creature -> Item -> World -> World
|
||||
|
||||
@@ -3,10 +3,6 @@ module Dodge.Render.ShapePicture (
|
||||
) where
|
||||
|
||||
import Data.Strict.Tuple
|
||||
import Control.Applicative
|
||||
import Dodge.Data.DoubleTree
|
||||
import Dodge.Data.ComposedItem
|
||||
import Dodge.Item.Grammar
|
||||
import NewInt
|
||||
import Dodge.Render.List
|
||||
import Control.Lens
|
||||
@@ -39,7 +35,6 @@ worldSPic cfig u =
|
||||
<> foldup btSPic (filtOn _btPos _buttons)
|
||||
<> foldup mcSPic (filtOn _mcPos _machines)
|
||||
<> aimDelaySweep w
|
||||
-- <> anyTargeting w
|
||||
where
|
||||
w = _uvWorld u
|
||||
foldup = foldMap'
|
||||
@@ -72,18 +67,6 @@ drawSweep cr w = fromMaybe mempty $ do
|
||||
theinput = w ^. input
|
||||
mwp = mouseWorldPos theinput campos
|
||||
|
||||
-- assume for now that targeting is above the root,
|
||||
-- and the augmented hud is above that
|
||||
anyTargeting :: World -> SPic
|
||||
anyTargeting w = fromMaybe mempty $ do
|
||||
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
||||
itinvid <- cr ^? crManipulation . manObject . imRootItem
|
||||
itmtree <- invTrees (_crInv cr) ^? ix itinvid
|
||||
ttree <- lookup WeaponTargetingLink (itmtree ^. ldtRight)
|
||||
_ <- lookup AugmentedHUDLink (ttree ^. ldtLeft)
|
||||
<|> lookup AugmentedHUDLink (ttree ^. ldtRight)
|
||||
return . noShape $ drawTargeting (ttree ^. ldtValue) w
|
||||
|
||||
drawCreature :: Creature -> SPic
|
||||
drawCreature cr = case _crType cr of
|
||||
Humanoid{} -> basicCrPict cr
|
||||
|
||||
Reference in New Issue
Block a user