diff --git a/src/Dodge/Combine/Module.hs b/src/Dodge/Combine/Module.hs index 0e4fba0fa..713ea2005 100644 --- a/src/Dodge/Combine/Module.hs +++ b/src/Dodge/Combine/Module.hs @@ -17,7 +17,7 @@ moduleModification imt = case imt of . (itUse . heldConsumption . laAmmoType . amBullet . buTimer .~ 3) BULPAY thepayload -> itUse . heldConsumption . laAmmoType . amBullet . buSpawn .~ thepayload BULBODY thebody -> itUse . heldConsumption . laAmmoType . amBullet . buEffect .~ thebody - TARGET t -> itUse . useTargeting ?~ t + TARGET {} -> id -- itUse . useTargeting ?~ t BULTRAJ BasicBulletTrajectoryType -> id BULTRAJ MagnetTrajectoryType -> (itUse . heldConsumption . laAmmoType . amBullet . buTrajectory .~ MagnetTrajectory 0) @@ -38,7 +38,7 @@ moduleModification imt = case imt of where makeDirectedTele it = it - & itUse . useTargeting ?~ TargetRBPress +-- & itUse . useTargeting ?~ TargetRBPress & itUse . heldMods %~ ModWithDirectedTeleport -- .:~ withPosDirWallCheck directedTelPos -- for the camera: the simplest option is to remove all zoom/offset & itUse . heldAim . aimZoom . izFac .~ 1 diff --git a/src/Dodge/Creature/State.hs b/src/Dodge/Creature/State.hs index 4befe4332..9f4490ae4 100644 --- a/src/Dodge/Creature/State.hs +++ b/src/Dodge/Creature/State.hs @@ -3,6 +3,7 @@ module Dodge.Creature.State ( doDamage, ) where +import Control.Applicative import Data.Foldable import Data.Maybe import Dodge.Base @@ -15,7 +16,7 @@ import Dodge.Creature.Test import Dodge.Damage import Dodge.Data.World import Dodge.EnergyBall -import Dodge.Equipment +--import Dodge.Equipment import Dodge.Euse import Dodge.Hammer import Dodge.ItEffect @@ -271,14 +272,20 @@ updateAutoRecharge it = case it ^? itUse . leftConsumption of crGetTargeting :: Creature -> Maybe TargetType crGetTargeting cr = do - itm <- find hastargeting $ helditem ++ IM.elems (getCrEquipment cr) - itm ^? itUse . useTargeting . _Just - where - hastargeting itm = isJust (itm ^? itUse . useTargeting . _Just) - helditem = fromMaybe [] $ do - i <- cr ^? crManipulation . manObject . inInventory . ispItem - itm <- cr ^? crInv . ix i - return [itm] + i <- cr ^? crManipulation . manObject . inInventory . ispItem + itm <- cr ^? crInv . ix i + itm ^? itType . iyModules . ix ModTarget . imtTargetType + <|> cr ^? crInv . ix (i+1) . itUse . equipTargeting . _Just + + +-- itm <- find hastargeting $ helditem ++ IM.elems (getCrEquipment cr) +-- itm ^? itUse . useTargeting . _Just +-- where +-- hastargeting itm = isJust (itm ^? itUse . useTargeting . _Just) +-- helditem = fromMaybe [] $ do +-- i <- cr ^? crManipulation . manObject . inInventory . ispItem +-- itm <- cr ^? crInv . ix i +-- return [itm] weaponReloadSounds :: Creature -> World -> World weaponReloadSounds cr w = case cr ^? crManipulation . manObject . inInventory . iselAction of diff --git a/src/Dodge/Data/Item/Combine.hs b/src/Dodge/Data/Item/Combine.hs index 2399e0f54..e76df8246 100644 --- a/src/Dodge/Data/Item/Combine.hs +++ b/src/Dodge/Data/Item/Combine.hs @@ -191,7 +191,7 @@ data ItemModuleType | BULPAY BulletSpawn | BULBODY BulletEffect | BULTRAJ BulletTrajectoryType - | TARGET TargetType + | TARGET {_imtTargetType :: TargetType} | INCENDLAS | SPLITLAS | STATICLAS @@ -224,6 +224,7 @@ data ModuleSlot makeLenses ''ItemType makeLenses ''ItemBaseType makeLenses ''HeldItemType +makeLenses ''ItemModuleType deriveJSON defaultOptions ''Stack deriveJSON defaultOptions ''CraftType deriveJSON defaultOptions ''ConsumableItemType diff --git a/src/Dodge/Data/Item/Use.hs b/src/Dodge/Data/Item/Use.hs index 9559b2ccb..a196b6155 100644 --- a/src/Dodge/Data/Item/Use.hs +++ b/src/Dodge/Data/Item/Use.hs @@ -34,7 +34,7 @@ data ItemUse , _heldAim :: AimParams , _heldScroll :: HeldScroll , _heldConsumption :: HeldConsumption - , _useTargeting :: Maybe TargetType +-- , _useTargeting :: Maybe TargetType } | LeftUse { _leftUse :: Luse @@ -49,7 +49,7 @@ data ItemUse } | EquipUse { _equipEffect :: EquipEffect - , _useTargeting :: Maybe TargetType + , _equipTargeting :: Maybe TargetType } | CraftUse {_useAmount :: ItAmount} diff --git a/src/Dodge/Default/Item/Use.hs b/src/Dodge/Default/Item/Use.hs index af363c03e..ff2f61bc3 100644 --- a/src/Dodge/Default/Item/Use.hs +++ b/src/Dodge/Default/Item/Use.hs @@ -23,7 +23,7 @@ defaultLeftUse = defaultEquipUse :: ItemUse defaultEquipUse = EquipUse { _equipEffect = defaultEquip - , _useTargeting = Nothing + , _equipTargeting = Nothing } defaultHeldUse :: ItemUse @@ -36,5 +36,5 @@ defaultHeldUse = , _heldAim = defaultAimParams , _heldScroll = HeldScrollDoNothing , _heldConsumption = defaultLoadable - , _useTargeting = Nothing +-- , _useTargeting = Nothing } diff --git a/src/Dodge/Item/Equipment.hs b/src/Dodge/Item/Equipment.hs index cd78d47e0..09a3bc45d 100644 --- a/src/Dodge/Item/Equipment.hs +++ b/src/Dodge/Item/Equipment.hs @@ -111,7 +111,7 @@ targetingHat tt = defaultEquipment & itUse . equipEffect . eeSite .~ GoesOnHead & itType . iyBase .~ EQUIP (TARGETINGHAT tt) - & itUse . useTargeting ?~ tt +-- & itUse . useTargeting ?~ tt headLamp :: Item headLamp = diff --git a/src/Dodge/Item/Held/Rod.hs b/src/Dodge/Item/Held/Rod.hs index 8969b4e81..f614c2588 100644 --- a/src/Dodge/Item/Held/Rod.hs +++ b/src/Dodge/Item/Held/Rod.hs @@ -72,7 +72,8 @@ sniperRifle = & itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 0.5, _izMin = 0.5,_izFac = 1} & itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun & itScope .~ ZoomScope (V2 0 0) 1 0.5 False - & itUse . useTargeting ?~ TargetLaser + & itType . iyModules . at ModTarget ?~ TARGET TargetLaser +-- & itUse . useTargeting ?~ TargetLaser machineGun :: Item machineGun = diff --git a/src/Dodge/Item/Held/Utility.hs b/src/Dodge/Item/Held/Utility.hs index b44a3332b..5d5b1819a 100644 --- a/src/Dodge/Item/Held/Utility.hs +++ b/src/Dodge/Item/Held/Utility.hs @@ -52,7 +52,8 @@ torch = forceFieldGun :: Item forceFieldGun = defaultWeapon - & itUse . useTargeting ?~ TargetRBLine +-- & itUse . useTargeting ?~ TargetRBLine + & itType . iyModules . at ModTarget ?~ TARGET TargetRBLine & itParams .~ ParamMID Nothing & itUse . heldUse .~ HeldForceField --useForceFieldGun & itUse . heldDelay .~ NoDelay