Remove _ilIsSelected
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
module Dodge.Creature.Impulse.UseItem (useItem) where
|
module Dodge.Creature.Impulse.UseItem (useItem) where
|
||||||
|
|
||||||
|
import qualified Data.IntSet as IS
|
||||||
import Dodge.Euse
|
import Dodge.Euse
|
||||||
import NewInt
|
import NewInt
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
@@ -28,7 +29,10 @@ useItem invid pt w = fmap (worldEventFlags . at InventoryChange ?~ ()) $ do
|
|||||||
useItemLoc :: Creature -> LocationDT OItem -> Int -> World -> Maybe World
|
useItemLoc :: Creature -> LocationDT OItem -> Int -> World -> Maybe World
|
||||||
useItemLoc cr loc pt w
|
useItemLoc cr loc pt w
|
||||||
| aimuse
|
| aimuse
|
||||||
, fromMaybe False $ loc ^? locDT . dtValue . _1 . itLocation . ilIsAttached
|
, fromMaybe False $ do
|
||||||
|
i <- loc ^? locDT . dtValue . _1 . itLocation . ilInvID . unNInt
|
||||||
|
is <- w ^? hud . manObject . hiAttachedItems
|
||||||
|
return $ i `IS.member` is
|
||||||
, Aiming{} <- cr ^. crStance . posture =
|
, Aiming{} <- cr ^. crStance . posture =
|
||||||
return $ gadgetEffect pt loc cr w
|
return $ gadgetEffect pt loc cr w
|
||||||
| GadgetPlatformSF <- sf =
|
| GadgetPlatformSF <- sf =
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ module Dodge.Creature.State (
|
|||||||
invItemEffs,
|
invItemEffs,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import qualified Data.IntSet as IS
|
||||||
import Dodge.Creature.Radius
|
import Dodge.Creature.Radius
|
||||||
import qualified Data.IntMap.Strict as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
import Linear
|
import Linear
|
||||||
@@ -106,19 +107,23 @@ invItemLocUpdate cr loc w = doAnyEquipmentEffect loc cr $ case itm ^. itType of
|
|||||||
HELD MINIGUNX{} -> coolMinigun itm w
|
HELD MINIGUNX{} -> coolMinigun itm w
|
||||||
HELD MACHINEPISTOL{} -> coolMachinePistol cr itm w
|
HELD MACHINEPISTOL{} -> coolMachinePistol cr itm w
|
||||||
LASER | loc ^. locDT . dtValue . _2 == WeaponTargetingSF
|
LASER | loc ^. locDT . dtValue . _2 == WeaponTargetingSF
|
||||||
, itm ^? itLocation . ilIsAttached == Just True -> shineTargetLaser cr loc w
|
, isattached -> shineTargetLaser cr loc w
|
||||||
HELD LED
|
HELD LED
|
||||||
| itm ^? itLocation . ilIsAttached == Just True -> shineTorch cr loc w
|
| isattached -> shineTorch cr loc w
|
||||||
TARGETING tt
|
TARGETING tt
|
||||||
| itm ^? itLocation . ilIsAttached == Just True -> updateItemTargeting tt cr itm w
|
| isattached -> updateItemTargeting tt cr itm w
|
||||||
ARHUD
|
ARHUD
|
||||||
| itm ^? itLocation . ilIsAttached == Just True -> drawARHUD loc w
|
| isattached -> drawARHUD loc w
|
||||||
_ -> w
|
_ -> w
|
||||||
where
|
where
|
||||||
haspulse =
|
haspulse =
|
||||||
w ^? cWorld . lWorld . creatures . ix 0 . crType . avatarPulse . pulseProgress
|
w ^? cWorld . lWorld . creatures . ix 0 . crType . avatarPulse . pulseProgress
|
||||||
== Just 0
|
== Just 0
|
||||||
itm = loc ^. locDT . dtValue . _1
|
itm = loc ^. locDT . dtValue . _1
|
||||||
|
isattached = fromMaybe False $ do
|
||||||
|
i <- itm ^? itLocation . ilInvID . unNInt
|
||||||
|
is <- w ^? hud . manObject . hiAttachedItems
|
||||||
|
return $ i `IS.member` is
|
||||||
|
|
||||||
coolMinigun :: Item -> World -> World
|
coolMinigun :: Item -> World -> World
|
||||||
coolMinigun itm
|
coolMinigun itm
|
||||||
@@ -312,7 +317,10 @@ updateItemTargeting tt cr itm w = case tt of
|
|||||||
where
|
where
|
||||||
pointittarg = cWorld . lWorld . items . ix itid . itTargeting
|
pointittarg = cWorld . lWorld . items . ix itid . itTargeting
|
||||||
itid = itm ^. itID . unNInt
|
itid = itm ^. itID . unNInt
|
||||||
isattached = itm ^?! itLocation . ilIsAttached
|
isattached = fromMaybe False $ do
|
||||||
|
i <- itm ^? itLocation . ilInvID . unNInt
|
||||||
|
is <- w ^? hud . manObject . hiAttachedItems
|
||||||
|
return $ i `IS.member` is
|
||||||
rbpressed = SDL.ButtonRight `M.member` _mouseButtons (_input w)
|
rbpressed = SDL.ButtonRight `M.member` _mouseButtons (_input w)
|
||||||
|
|
||||||
setRBCreatureTargeting :: Creature -> World -> ItemTargeting -> ItemTargeting
|
setRBCreatureTargeting :: Creature -> World -> ItemTargeting -> ItemTargeting
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ data ItemLocation
|
|||||||
, _ilInvID :: NewInt InvInt
|
, _ilInvID :: NewInt InvInt
|
||||||
, _ilIsRoot :: Bool -- of any item
|
, _ilIsRoot :: Bool -- of any item
|
||||||
, _ilIsSelected :: Bool
|
, _ilIsSelected :: Bool
|
||||||
, _ilIsAttached :: Bool -- to selected item. question: downwards and upwards?
|
-- , _ilIsAttached :: Bool -- to selected item. question: downwards and upwards?
|
||||||
, _ilEquipSite :: Maybe EquipSite
|
, _ilEquipSite :: Maybe EquipSite
|
||||||
}
|
}
|
||||||
| OnTurret {_ilTuID :: Int}
|
| OnTurret {_ilTuID :: Int}
|
||||||
@@ -40,14 +40,12 @@ data ItemLocation
|
|||||||
deriving (Eq, Show, Ord, Read) --Generic, Flat)
|
deriving (Eq, Show, Ord, Read) --Generic, Flat)
|
||||||
|
|
||||||
instance ShortShow ItemLocation where
|
instance ShortShow ItemLocation where
|
||||||
shortShow (InInv cid invid rootb selb attb esite) =
|
shortShow (InInv cid invid rootb selb esite) =
|
||||||
"InInv:cid" <> shortShow cid <> "invid" <> shortShow (_unNInt invid)
|
"InInv:cid" <> shortShow cid <> "invid" <> shortShow (_unNInt invid)
|
||||||
<> "root"
|
<> "root"
|
||||||
<> shortShow rootb
|
<> shortShow rootb
|
||||||
<> "sel"
|
<> "sel"
|
||||||
<> shortShow selb
|
<> shortShow selb
|
||||||
<> "att"
|
|
||||||
<> shortShow attb
|
|
||||||
<> shortShow (fmap (SString . show) esite)
|
<> shortShow (fmap (SString . show) esite)
|
||||||
shortShow x = show x
|
shortShow x = show x
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ tryPutItemInInv mcipos itid w = do
|
|||||||
, _ilInvID = invid
|
, _ilInvID = invid
|
||||||
, _ilIsRoot = False
|
, _ilIsRoot = False
|
||||||
, _ilIsSelected = False
|
, _ilIsSelected = False
|
||||||
, _ilIsAttached = False
|
-- , _ilIsAttached = False
|
||||||
, _ilEquipSite = Nothing
|
, _ilEquipSite = Nothing
|
||||||
}
|
}
|
||||||
return $ (invid,) $
|
return $ (invid,) $
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ crUpdateInvidLocations mo w invid itm =
|
|||||||
, _ilInvID = NInt invid
|
, _ilInvID = NInt invid
|
||||||
, _ilIsRoot = Just (NInt invid) == mo ^? hiRootSelectedItem
|
, _ilIsRoot = Just (NInt invid) == mo ^? hiRootSelectedItem
|
||||||
, _ilIsSelected = Just (Sel 0 invid) == w ^? hud . diSelection . _Just
|
, _ilIsSelected = Just (Sel 0 invid) == w ^? hud . diSelection . _Just
|
||||||
, _ilIsAttached = invid `IS.member` (mo ^. hiAttachedItems)
|
-- , _ilIsAttached = invid `IS.member` (mo ^. hiAttachedItems)
|
||||||
, _ilEquipSite = w ^? cWorld . lWorld . items . ix itid . itLocation . ilEquipSite . _Just
|
, _ilEquipSite = w ^? cWorld . lWorld . items . ix itid . itLocation . ilEquipSite . _Just
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ module Dodge.Item.BackgroundEffect (
|
|||||||
removeShieldWall,
|
removeShieldWall,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import NewInt
|
||||||
import Linear
|
import Linear
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Dodge.Creature.Radius
|
import Dodge.Creature.Radius
|
||||||
@@ -19,6 +20,8 @@ import Dodge.Wall.Create
|
|||||||
import Dodge.Wall.Delete
|
import Dodge.Wall.Delete
|
||||||
import Dodge.Wall.Move
|
import Dodge.Wall.Move
|
||||||
import Geometry.Vector
|
import Geometry.Vector
|
||||||
|
import qualified Data.IntSet as IS
|
||||||
|
import Data.Maybe
|
||||||
|
|
||||||
cancelExamineInventory :: World -> World
|
cancelExamineInventory :: World -> World
|
||||||
cancelExamineInventory = hud . subInventory %~ f
|
cancelExamineInventory = hud . subInventory %~ f
|
||||||
@@ -44,11 +47,16 @@ rootAndAttNotEff ::
|
|||||||
Creature ->
|
Creature ->
|
||||||
World ->
|
World ->
|
||||||
World
|
World
|
||||||
rootAndAttNotEff f g it
|
rootAndAttNotEff f g it cr w
|
||||||
| it ^? itLocation . ilIsRoot == Just True
|
| it ^? itLocation . ilIsRoot == Just True
|
||||||
&& it ^? itLocation . ilIsAttached == Just True
|
&& isattached
|
||||||
= f it
|
= f it cr w
|
||||||
| otherwise = g it
|
| otherwise = g it cr w
|
||||||
|
where
|
||||||
|
isattached = fromMaybe False $ do
|
||||||
|
i <- it ^? itLocation . ilInvID . unNInt
|
||||||
|
is <- w ^? hud . manObject . hiAttachedItems
|
||||||
|
return $ i `IS.member` is
|
||||||
|
|
||||||
createShieldWall :: Item -> Creature -> World -> World
|
createShieldWall :: Item -> Creature -> World -> World
|
||||||
createShieldWall it cr w = case it ^? itParams . flatShieldWlMIX . _Just of
|
createShieldWall it cr w = case it ^? itParams . flatShieldWlMIX . _Just of
|
||||||
|
|||||||
Reference in New Issue
Block a user