Remove _ilIsSelected
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
module Dodge.Creature.Impulse.UseItem (useItem) where
|
||||
|
||||
import qualified Data.IntSet as IS
|
||||
import Dodge.Euse
|
||||
import NewInt
|
||||
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 cr loc pt w
|
||||
| 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 =
|
||||
return $ gadgetEffect pt loc cr w
|
||||
| GadgetPlatformSF <- sf =
|
||||
|
||||
@@ -4,6 +4,7 @@ module Dodge.Creature.State (
|
||||
invItemEffs,
|
||||
) where
|
||||
|
||||
import qualified Data.IntSet as IS
|
||||
import Dodge.Creature.Radius
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import Linear
|
||||
@@ -106,19 +107,23 @@ invItemLocUpdate cr loc w = doAnyEquipmentEffect loc cr $ case itm ^. itType of
|
||||
HELD MINIGUNX{} -> coolMinigun itm w
|
||||
HELD MACHINEPISTOL{} -> coolMachinePistol cr itm w
|
||||
LASER | loc ^. locDT . dtValue . _2 == WeaponTargetingSF
|
||||
, itm ^? itLocation . ilIsAttached == Just True -> shineTargetLaser cr loc w
|
||||
, isattached -> shineTargetLaser cr loc w
|
||||
HELD LED
|
||||
| itm ^? itLocation . ilIsAttached == Just True -> shineTorch cr loc w
|
||||
| isattached -> shineTorch cr loc w
|
||||
TARGETING tt
|
||||
| itm ^? itLocation . ilIsAttached == Just True -> updateItemTargeting tt cr itm w
|
||||
| isattached -> updateItemTargeting tt cr itm w
|
||||
ARHUD
|
||||
| itm ^? itLocation . ilIsAttached == Just True -> drawARHUD loc w
|
||||
| isattached -> drawARHUD loc w
|
||||
_ -> w
|
||||
where
|
||||
haspulse =
|
||||
w ^? cWorld . lWorld . creatures . ix 0 . crType . avatarPulse . pulseProgress
|
||||
== Just 0
|
||||
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 itm
|
||||
@@ -312,7 +317,10 @@ updateItemTargeting tt cr itm w = case tt of
|
||||
where
|
||||
pointittarg = cWorld . lWorld . items . ix itid . itTargeting
|
||||
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)
|
||||
|
||||
setRBCreatureTargeting :: Creature -> World -> ItemTargeting -> ItemTargeting
|
||||
|
||||
Reference in New Issue
Block a user