Move towards positional item targeting

This commit is contained in:
2023-05-19 23:03:52 +01:00
parent 7cb17034f8
commit 2d3b76dfd4
8 changed files with 29 additions and 19 deletions
+2 -2
View File
@@ -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
+16 -9
View File
@@ -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
+2 -1
View File
@@ -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
+2 -2
View File
@@ -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}
+2 -2
View File
@@ -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
}
+1 -1
View File
@@ -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 =
+2 -1
View File
@@ -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 =
+2 -1
View File
@@ -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