Cleanup targeting
This commit is contained in:
+3
-3
@@ -71,13 +71,13 @@ useAmmoParams it cr w =
|
|||||||
settrajectory traj = case traj of
|
settrajectory traj = case traj of
|
||||||
BasicBulletTrajectory -> BasicBulletTrajectory
|
BasicBulletTrajectory -> BasicBulletTrajectory
|
||||||
MagnetTrajectory{} -> fromMaybe BasicBulletTrajectory $ do
|
MagnetTrajectory{} -> fromMaybe BasicBulletTrajectory $ do
|
||||||
tpos <- it ^? itTargeting . tgPos . _Just
|
tpos <- it ^? itUse . heldTargeting . tgPos . _Just
|
||||||
return $ MagnetTrajectory tpos
|
return $ MagnetTrajectory tpos
|
||||||
FlechetteTrajectory{} -> fromMaybe BasicBulletTrajectory $ do
|
FlechetteTrajectory{} -> fromMaybe BasicBulletTrajectory $ do
|
||||||
tpos <- it ^? itTargeting . tgPos . _Just
|
tpos <- it ^? itUse . heldTargeting . tgPos . _Just
|
||||||
return $ FlechetteTrajectory tpos
|
return $ FlechetteTrajectory tpos
|
||||||
BezierTrajectory{} -> fromMaybe BasicBulletTrajectory $ do
|
BezierTrajectory{} -> fromMaybe BasicBulletTrajectory $ do
|
||||||
tpos <- it ^? itTargeting . tgPos . _Just
|
tpos <- it ^? itUse . heldTargeting . tgPos . _Just
|
||||||
return $ BezierTrajectory sp tpos (mouseWorldPos (w ^. input) (w ^. cWorld . camPos))
|
return $ BezierTrajectory sp tpos (mouseWorldPos (w ^. input) (w ^. cWorld . camPos))
|
||||||
|
|
||||||
bounceDir :: (Point2, Either Creature Wall) -> Maybe Point2
|
bounceDir :: (Point2, Either Creature Wall) -> Maybe Point2
|
||||||
|
|||||||
@@ -167,9 +167,9 @@ moduleCombinations =
|
|||||||
( ModTarget
|
( ModTarget
|
||||||
, homingLaunchers ++ bulletWeapons
|
, homingLaunchers ++ bulletWeapons
|
||||||
,
|
,
|
||||||
[ amod [cr MICROCHIP, cr HEATSENSOR] TARGCR
|
[ amod [cr MICROCHIP, cr HEATSENSOR] (TARGET TargetRBCreature)
|
||||||
, amod [cr MICROCHIP, cr LIGHTSENSOR] TARGLAS
|
, amod [cr MICROCHIP, cr LIGHTSENSOR] (TARGET TargetLaser)
|
||||||
, amod [cr MICROCHIP, cr SOUNDSENSOR] TARGPOS
|
, amod [cr MICROCHIP, cr SOUNDSENSOR] (TARGET TargetRBPress)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
,
|
,
|
||||||
|
|||||||
@@ -19,9 +19,7 @@ moduleModification imt = case imt of
|
|||||||
PENBUL -> itUse . heldConsumption . laAmmoType . amBullet . buEffect .~ PenetrateBullet
|
PENBUL -> itUse . heldConsumption . laAmmoType . amBullet . buEffect .~ PenetrateBullet
|
||||||
STATICBUL -> itUse . heldConsumption . laAmmoType . amBullet . buSpawn .~ BulBall TeslaBall
|
STATICBUL -> itUse . heldConsumption . laAmmoType . amBullet . buSpawn .~ BulBall TeslaBall
|
||||||
CONCUSBUL -> itUse . heldConsumption . laAmmoType . amBullet . buSpawn .~ BulBall ConcBall
|
CONCUSBUL -> itUse . heldConsumption . laAmmoType . amBullet . buSpawn .~ BulBall ConcBall
|
||||||
TARGCR -> itTargeting .~ targetRBCreature
|
TARGET t -> itUse . heldTargeting .~ (defaultTargeting & tgType .~ t)
|
||||||
TARGLAS -> itTargeting .~ targetLaser
|
|
||||||
TARGPOS -> itTargeting .~ targetRBPress
|
|
||||||
MAGNETTRAJ ->
|
MAGNETTRAJ ->
|
||||||
(itUse . heldConsumption . laAmmoType . amBullet . buTrajectory .~ MagnetTrajectory 0)
|
(itUse . heldConsumption . laAmmoType . amBullet . buTrajectory .~ MagnetTrajectory 0)
|
||||||
. (itUse . heldConsumption . laAmmoType . amBullet . buVel .~ V2 10 0)
|
. (itUse . heldConsumption . laAmmoType . amBullet . buVel .~ V2 10 0)
|
||||||
@@ -39,7 +37,7 @@ moduleModification imt = case imt of
|
|||||||
where
|
where
|
||||||
makeDirectedTele it =
|
makeDirectedTele it =
|
||||||
it
|
it
|
||||||
& itTargeting .~ targetRBPress
|
& itUse . heldTargeting .~ (defaultTargeting & tgType .~ TargetRBPress)
|
||||||
& itUse . heldMods %~ ModWithDirectedTeleport -- .:~ withPosDirWallCheck directedTelPos
|
& itUse . heldMods %~ ModWithDirectedTeleport -- .:~ withPosDirWallCheck directedTelPos
|
||||||
-- for the camera: the simplest option is to remove all zoom/offset
|
-- for the camera: the simplest option is to remove all zoom/offset
|
||||||
& itUse . heldAim . aimZoom . izFac .~ 1
|
& itUse . heldAim . aimZoom . izFac .~ 1
|
||||||
|
|||||||
@@ -270,12 +270,12 @@ updateAutoRecharge it = case it ^? itUse . leftConsumption of
|
|||||||
_ -> it
|
_ -> it
|
||||||
|
|
||||||
doItemTargeting :: Int -> Creature -> World -> World
|
doItemTargeting :: Int -> Creature -> World -> World
|
||||||
doItemTargeting invid cr w = case cr ^? crInv . ix invid . itTargeting of
|
doItemTargeting invid cr w = case cr ^? crInv . ix invid . itUse . heldTargeting of
|
||||||
Nothing -> w
|
Nothing -> w
|
||||||
Just NoTargeting -> w
|
Just NoTargeting -> w
|
||||||
Just t ->
|
Just t ->
|
||||||
let (w', t') = updateTargeting (_tgUpdate t) (_crInv cr IM.! invid) cr w t
|
let (w', t') = updateTargeting (_tgType t) (_crInv cr IM.! invid) cr w t
|
||||||
in w' & cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itTargeting .~ t'
|
in w' & cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . heldTargeting .~ t'
|
||||||
|
|
||||||
weaponReloadSounds :: Creature -> World -> World
|
weaponReloadSounds :: Creature -> World -> World
|
||||||
weaponReloadSounds cr w = case cr ^? crInvSel . iselAction of
|
weaponReloadSounds cr w = case cr ^? crInvSel . iselAction of
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ module Dodge.Data.Item (
|
|||||||
module Dodge.Data.Item.CurseStatus,
|
module Dodge.Data.Item.CurseStatus,
|
||||||
module Dodge.Data.Item.Scope,
|
module Dodge.Data.Item.Scope,
|
||||||
module Dodge.Data.Item.Combine,
|
module Dodge.Data.Item.Combine,
|
||||||
module Dodge.Data.Item.Targeting,
|
|
||||||
module Dodge.Data.Item.Location,
|
module Dodge.Data.Item.Location,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
@@ -29,7 +28,6 @@ import Dodge.Data.Item.Misc
|
|||||||
import Dodge.Data.Item.Params
|
import Dodge.Data.Item.Params
|
||||||
import Dodge.Data.Item.Tweak
|
import Dodge.Data.Item.Tweak
|
||||||
import Dodge.Data.Item.Use
|
import Dodge.Data.Item.Use
|
||||||
import Dodge.Data.Item.Targeting
|
|
||||||
import Dodge.Data.Item.Location
|
import Dodge.Data.Item.Location
|
||||||
|
|
||||||
data Item = Item
|
data Item = Item
|
||||||
@@ -41,7 +39,6 @@ data Item = Item
|
|||||||
, _itEffect :: ItEffect
|
, _itEffect :: ItEffect
|
||||||
, _itInvSize :: Float
|
, _itInvSize :: Float
|
||||||
, _itInvColor :: Color
|
, _itInvColor :: Color
|
||||||
, _itTargeting :: Targeting
|
|
||||||
, _itDimension :: ItemDimension
|
, _itDimension :: ItemDimension
|
||||||
, _itCurseStatus :: CurseStatus
|
, _itCurseStatus :: CurseStatus
|
||||||
, _itTweaks :: ItemTweaks
|
, _itTweaks :: ItemTweaks
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
module Dodge.Data.Item.Combine where
|
module Dodge.Data.Item.Combine where
|
||||||
|
|
||||||
|
import Dodge.Data.Item.Targeting
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
import Data.Aeson.TH
|
import Data.Aeson.TH
|
||||||
@@ -187,9 +188,7 @@ data ItemModuleType
|
|||||||
| PENBUL
|
| PENBUL
|
||||||
| STATICBUL
|
| STATICBUL
|
||||||
| CONCUSBUL
|
| CONCUSBUL
|
||||||
| TARGCR
|
| TARGET TargetType
|
||||||
| TARGLAS
|
|
||||||
| TARGPOS
|
|
||||||
| MAGNETTRAJ
|
| MAGNETTRAJ
|
||||||
| FLECHETRAJ
|
| FLECHETRAJ
|
||||||
| BEZIERTRAJ
|
| BEZIERTRAJ
|
||||||
|
|||||||
@@ -14,29 +14,21 @@ data Targeting
|
|||||||
= NoTargeting
|
= NoTargeting
|
||||||
| Targeting
|
| Targeting
|
||||||
{ _tgPos :: Maybe Point2
|
{ _tgPos :: Maybe Point2
|
||||||
, _tgUpdate :: TargetUpdate --Item -> Creature -> World -> Targeting -> (World, Targeting)
|
, _tgType :: TargetType --Item -> Creature -> World -> Targeting -> (World, Targeting)
|
||||||
, _tgDraw :: TargetDraw --Item -> Creature -> Configuration -> World -> Picture
|
-- , _tgDraw :: TargetDraw --Item -> Creature -> Configuration -> World -> Picture
|
||||||
, _tgID :: Maybe Int
|
, _tgID :: Maybe Int
|
||||||
, _tgActive :: Bool
|
, _tgActive :: Bool
|
||||||
}
|
}
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
data TargetUpdate
|
data TargetType
|
||||||
= NoTargetUpdate
|
= TargetLaser
|
||||||
| TargetLaserUpdate
|
| TargetRBPress
|
||||||
| TargetRBPressUpdate
|
| TargetRBLine
|
||||||
| TargetRBCreatureUpdate
|
| TargetRBCreature
|
||||||
| TargetCursorUpdate
|
| TargetCursor
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
||||||
|
|
||||||
data TargetDraw
|
|
||||||
= NoTargetDraw
|
|
||||||
| TargetDistanceDraw
|
|
||||||
| SimpleDrawTarget
|
|
||||||
| TargetRBCreatureDraw
|
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
makeLenses ''Targeting
|
makeLenses ''Targeting
|
||||||
deriveJSON defaultOptions ''TargetUpdate
|
deriveJSON defaultOptions ''TargetType
|
||||||
deriveJSON defaultOptions ''TargetDraw
|
|
||||||
deriveJSON defaultOptions ''Targeting
|
deriveJSON defaultOptions ''Targeting
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ module Dodge.Data.Item.Use (
|
|||||||
module Dodge.Data.Item.HeldDelay,
|
module Dodge.Data.Item.HeldDelay,
|
||||||
module Dodge.Data.Item.Use.Consumption,
|
module Dodge.Data.Item.Use.Consumption,
|
||||||
module Dodge.Data.Hammer,
|
module Dodge.Data.Hammer,
|
||||||
|
module Dodge.Data.Item.Targeting,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
@@ -22,6 +23,7 @@ import Dodge.Data.Item.HeldUse
|
|||||||
import Dodge.Data.Item.Use.Consumption
|
import Dodge.Data.Item.Use.Consumption
|
||||||
import Dodge.Data.Item.Use.Equipment
|
import Dodge.Data.Item.Use.Equipment
|
||||||
import Dodge.Data.Item.HeldDelay
|
import Dodge.Data.Item.HeldDelay
|
||||||
|
import Dodge.Data.Item.Targeting
|
||||||
|
|
||||||
data ItemUse
|
data ItemUse
|
||||||
= HeldUse
|
= HeldUse
|
||||||
@@ -32,6 +34,7 @@ data ItemUse
|
|||||||
, _heldAim :: AimParams
|
, _heldAim :: AimParams
|
||||||
, _heldScroll :: HeldScroll
|
, _heldScroll :: HeldScroll
|
||||||
, _heldConsumption :: HeldConsumption
|
, _heldConsumption :: HeldConsumption
|
||||||
|
, _heldTargeting :: Targeting
|
||||||
}
|
}
|
||||||
| LeftUse
|
| LeftUse
|
||||||
{ _leftUse :: Luse
|
{ _leftUse :: Luse
|
||||||
@@ -46,6 +49,7 @@ data ItemUse
|
|||||||
}
|
}
|
||||||
| EquipUse
|
| EquipUse
|
||||||
{ _equipEffect :: EquipEffect
|
{ _equipEffect :: EquipEffect
|
||||||
|
, _equipTargeting :: Targeting
|
||||||
}
|
}
|
||||||
| CraftUse
|
| CraftUse
|
||||||
{_useAmount :: ItAmount}
|
{_useAmount :: ItAmount}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import Geometry.Data
|
|||||||
|
|
||||||
data LaserType
|
data LaserType
|
||||||
= DamageLaser {_laserTypeDamage :: Int}
|
= DamageLaser {_laserTypeDamage :: Int}
|
||||||
| TargetLaser
|
| TargetingLaser
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
data LaserStart = LaserStart
|
data LaserStart = LaserStart
|
||||||
|
|||||||
@@ -28,9 +28,7 @@ defaultEquipment :: Item
|
|||||||
defaultEquipment =
|
defaultEquipment =
|
||||||
defaultItem
|
defaultItem
|
||||||
& itInvColor .~ yellow
|
& itInvColor .~ yellow
|
||||||
& itUse .~ EquipUse defaultEquip
|
& itUse .~ defaultEquipUse
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
defaultFlIt :: FloorItem
|
defaultFlIt :: FloorItem
|
||||||
defaultFlIt = FlIt{_flItRot = 0, _flIt = defaultConsumable, _flItPos = V2 0 0, _flItID = 0}
|
defaultFlIt = FlIt{_flItRot = 0, _flIt = defaultConsumable, _flItPos = V2 0 0, _flItID = 0}
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ defaultItem =
|
|||||||
, _itParams = NoParams
|
, _itParams = NoParams
|
||||||
, _itTweaks = NoTweaks
|
, _itTweaks = NoTweaks
|
||||||
, _itScope = NoScope
|
, _itScope = NoScope
|
||||||
, _itTargeting = NoTargeting
|
|
||||||
-- , _itValue = ItemValue 0 MundaneItem
|
-- , _itValue = ItemValue 0 MundaneItem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,10 @@ defaultLeftUse =
|
|||||||
}
|
}
|
||||||
|
|
||||||
defaultEquipUse :: ItemUse
|
defaultEquipUse :: ItemUse
|
||||||
defaultEquipUse = EquipUse{_equipEffect = defaultEquip}
|
defaultEquipUse = EquipUse
|
||||||
|
{ _equipEffect = defaultEquip
|
||||||
|
, _equipTargeting = NoTargeting
|
||||||
|
}
|
||||||
|
|
||||||
defaultHeldUse :: ItemUse
|
defaultHeldUse :: ItemUse
|
||||||
defaultHeldUse =
|
defaultHeldUse =
|
||||||
@@ -33,4 +36,5 @@ defaultHeldUse =
|
|||||||
, _heldAim = defaultAimParams
|
, _heldAim = defaultAimParams
|
||||||
, _heldScroll = HeldScrollDoNothing
|
, _heldScroll = HeldScrollDoNothing
|
||||||
, _heldConsumption = defaultLoadable
|
, _heldConsumption = defaultLoadable
|
||||||
|
, _heldTargeting = NoTargeting
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ useMod hm = case hm of
|
|||||||
thegapDualBeam = _dbGap . _itParams
|
thegapDualBeam = _dbGap . _itParams
|
||||||
directedTelPos it cr w = (p, a)
|
directedTelPos it cr w = (p, a)
|
||||||
where
|
where
|
||||||
p = fromMaybe (_crPos cr) $ it ^? itTargeting . tgPos . _Just
|
p = fromMaybe (_crPos cr) $ it ^? itUse . heldTargeting . tgPos . _Just
|
||||||
a = argV (mouseWorldPos (w ^. input) (w ^. cWorld . camPos) -.- p)
|
a = argV (mouseWorldPos (w ^. input) (w ^. cWorld . camPos) -.- p)
|
||||||
moddelay x = itUse . heldConsumption . laAmmoType . amBullet . buDelayFraction .~ x
|
moddelay x = itUse . heldConsumption . laAmmoType . amBullet . buDelayFraction .~ x
|
||||||
modcrpos x cr =
|
modcrpos x cr =
|
||||||
@@ -511,7 +511,7 @@ shootTeslaArc it cr w =
|
|||||||
-- TODO investigate more and fix
|
-- TODO investigate more and fix
|
||||||
useForceFieldGun :: Item -> Creature -> World -> World
|
useForceFieldGun :: Item -> Creature -> World -> World
|
||||||
useForceFieldGun itm cr w = fromMaybe w $ do
|
useForceFieldGun itm cr w = fromMaybe w $ do
|
||||||
a <- _tgPos $ _itTargeting itm
|
a <- _tgPos . _heldTargeting $ _itUse itm
|
||||||
let mwp = mouseWorldPos (w ^. input) (w ^. cWorld . camPos)
|
let mwp = mouseWorldPos (w ^. input) (w ^. cWorld . camPos)
|
||||||
b = if dist a mwp < 100 then mwp else a +.+ 100 *.* normalizeV (mwp -.- a)
|
b = if dist a mwp < 100 then mwp else a +.+ 100 *.* normalizeV (mwp -.- a)
|
||||||
wlline = (a, b)
|
wlline = (a, b)
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ showConsumption :: ItemUse -> String
|
|||||||
showConsumption iu = case iu of
|
showConsumption iu = case iu of
|
||||||
HeldUse{} -> showReloadProgress' (_heldConsumption iu)
|
HeldUse{} -> showReloadProgress' (_heldConsumption iu)
|
||||||
LeftUse{} -> showAutoRechargeProgress (_leftConsumption iu)
|
LeftUse{} -> showAutoRechargeProgress (_leftConsumption iu)
|
||||||
EquipUse ee -> showEUseNumber ee
|
EquipUse {_equipEffect = ee} -> showEUseNumber ee
|
||||||
_ -> show $ iu ^?! useAmount . getItAmount
|
_ -> show $ iu ^?! useAmount . getItAmount
|
||||||
|
|
||||||
showEUseNumber :: EquipEffect -> String
|
showEUseNumber :: EquipEffect -> String
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ sniperRifle =
|
|||||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 0.5, _izMin = 0.5}
|
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 0.5, _izMin = 0.5}
|
||||||
& itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun
|
& itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun
|
||||||
& itScope .~ ZoomScope (V2 0 0) 0 1 0.5 False
|
& itScope .~ ZoomScope (V2 0 0) 0 1 0.5 False
|
||||||
& itTargeting .~ targetLaser
|
& itUse . heldTargeting .~ (defaultTargeting & tgType .~ TargetLaser)
|
||||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1}
|
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1}
|
||||||
|
|
||||||
machineGun :: Item
|
machineGun :: Item
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ torch =
|
|||||||
forceFieldGun :: Item
|
forceFieldGun :: Item
|
||||||
forceFieldGun =
|
forceFieldGun =
|
||||||
defaultWeapon
|
defaultWeapon
|
||||||
& itTargeting .~ (targetRBPress & tgDraw .~ TargetDistanceDraw)
|
& itUse . heldTargeting .~ (defaultTargeting & tgType .~ TargetRBLine)
|
||||||
& itParams .~ ParamMID Nothing
|
& itParams .~ ParamMID Nothing
|
||||||
& itUse . heldUse .~ HeldForceField --useForceFieldGun
|
& itUse . heldUse .~ HeldForceField --useForceFieldGun
|
||||||
& itUse . heldDelay .~ NoDelay
|
& itUse . heldDelay .~ NoDelay
|
||||||
|
|||||||
@@ -1,37 +1,13 @@
|
|||||||
module Dodge.Item.Targeting where
|
module Dodge.Item.Targeting where
|
||||||
|
|
||||||
import Control.Lens
|
|
||||||
import Dodge.Data.Item.Targeting
|
import Dodge.Data.Item.Targeting
|
||||||
|
|
||||||
defaultTargeting :: Targeting
|
defaultTargeting :: Targeting
|
||||||
defaultTargeting =
|
defaultTargeting =
|
||||||
Targeting
|
Targeting
|
||||||
{ _tgPos = Nothing
|
{ _tgPos = Nothing
|
||||||
, _tgUpdate = NoTargetUpdate
|
, _tgType = TargetRBPress
|
||||||
, _tgDraw = NoTargetDraw
|
--, _tgDraw = NoTargetDraw
|
||||||
, _tgID = Nothing
|
, _tgID = Nothing
|
||||||
, _tgActive = False
|
, _tgActive = False
|
||||||
}
|
}
|
||||||
|
|
||||||
targetLaser :: Targeting
|
|
||||||
targetLaser =
|
|
||||||
defaultTargeting
|
|
||||||
& tgUpdate .~ TargetLaserUpdate
|
|
||||||
|
|
||||||
targetRBPress :: Targeting
|
|
||||||
targetRBPress =
|
|
||||||
defaultTargeting
|
|
||||||
& tgUpdate .~ TargetRBPressUpdate
|
|
||||||
& tgDraw .~ SimpleDrawTarget
|
|
||||||
|
|
||||||
targetRBCreature :: Targeting
|
|
||||||
targetRBCreature =
|
|
||||||
defaultTargeting
|
|
||||||
& tgUpdate .~ TargetRBCreatureUpdate
|
|
||||||
& tgDraw .~ TargetRBCreatureDraw
|
|
||||||
|
|
||||||
targetCursor :: Targeting
|
|
||||||
targetCursor =
|
|
||||||
defaultTargeting
|
|
||||||
& tgUpdate .~ TargetCursorUpdate
|
|
||||||
& tgDraw .~ SimpleDrawTarget
|
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ targetLaserUpdate _ cr w t
|
|||||||
, _lpDir = _crDir cr
|
, _lpDir = _crDir cr
|
||||||
, _lpPos = sp
|
, _lpPos = sp
|
||||||
, _lpColor = col
|
, _lpColor = col
|
||||||
, _lpType = TargetLaser
|
, _lpType = TargetingLaser
|
||||||
}
|
}
|
||||||
--wpammo = _itConsumption it
|
--wpammo = _itConsumption it
|
||||||
-- reloadFrac
|
-- reloadFrac
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ useTargetPos ::
|
|||||||
Creature ->
|
Creature ->
|
||||||
World ->
|
World ->
|
||||||
World
|
World
|
||||||
useTargetPos f cr w = case cr ^? crInv . ix (crSel cr) . itTargeting . tgPos of
|
useTargetPos f cr w = case cr ^? crInv . ix (crSel cr) . itUse . heldTargeting . tgPos of
|
||||||
Nothing -> w
|
Nothing -> w
|
||||||
Just p -> f p cr w
|
Just p -> f p cr w
|
||||||
|
|
||||||
removeItTarget :: Item -> Item
|
removeItTarget :: Item -> Item
|
||||||
removeItTarget = itTargeting . tgPos .~ Nothing
|
removeItTarget = itUse . heldTargeting . tgPos .~ Nothing
|
||||||
|
|||||||
+5
-3
@@ -29,9 +29,11 @@ moduleName imt = case imt of
|
|||||||
PENBUL -> Just "+PENETRATE"
|
PENBUL -> Just "+PENETRATE"
|
||||||
STATICBUL -> Just "+STATIC"
|
STATICBUL -> Just "+STATIC"
|
||||||
CONCUSBUL -> Just "+CONCUSS"
|
CONCUSBUL -> Just "+CONCUSS"
|
||||||
TARGCR -> Just "+CREATURETARGETING"
|
TARGET TargetRBCreature -> Just "+CREATURETARGETING"
|
||||||
TARGLAS -> Just "+LASERTARGETING"
|
TARGET TargetLaser -> Just "+LASERTARGETING"
|
||||||
TARGPOS -> Just "+POSTIONALTARGETING"
|
TARGET TargetRBPress -> Just "+POSTIONALTARGETING"
|
||||||
|
TARGET TargetCursor -> Just "+CURSORTARGETING"
|
||||||
|
TARGET TargetRBLine -> Just "+LINETARGETING"
|
||||||
MAGNETTRAJ -> Just "+MAGNETTRAJECTORY"
|
MAGNETTRAJ -> Just "+MAGNETTRAJECTORY"
|
||||||
FLECHETRAJ -> Just "+FLECHETTETRAJECTORY"
|
FLECHETRAJ -> Just "+FLECHETTETRAJECTORY"
|
||||||
BEZIERTRAJ -> Just "+BEZIERTRAJECTORY"
|
BEZIERTRAJ -> Just "+BEZIERTRAJECTORY"
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ pjTrack :: Int -> Proj -> World -> World
|
|||||||
pjTrack itid pj w = rotateToTarget pj w
|
pjTrack itid pj w = rotateToTarget pj w
|
||||||
where
|
where
|
||||||
rotateToTarget _ = fromMaybe id $ do
|
rotateToTarget _ = fromMaybe id $ do
|
||||||
tpos <- w ^? itPoint . itTargeting . tgPos . _Just
|
tpos <- w ^? itPoint . itUse . heldTargeting . tgPos . _Just
|
||||||
return $
|
return $
|
||||||
cWorld . lWorld . projectiles . ix (_prjID pj) . prjSpin
|
cWorld . lWorld . projectiles . ix (_prjID pj) . prjSpin
|
||||||
.~ turnToAmount
|
.~ turnToAmount
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ anyTargeting :: Configuration -> World -> SPic
|
|||||||
anyTargeting cfig w = (mempty, pictures $ IM.elems $ IM.mapMaybe f $ _crInv cr)
|
anyTargeting cfig w = (mempty, pictures $ IM.elems $ IM.mapMaybe f $ _crInv cr)
|
||||||
where
|
where
|
||||||
cr = you w
|
cr = you w
|
||||||
f it = fmap (\g -> drawTargeting g it cr cfig w) (it ^? itTargeting . tgDraw)
|
f it = fmap (\g -> drawTargeting g it cr cfig w) (it ^? itUse . heldTargeting . tgType)
|
||||||
|
|
||||||
drawCreature :: Creature -> SPic
|
drawCreature :: Creature -> SPic
|
||||||
drawCreature cr = case _crType cr of
|
drawCreature cr = case _crType cr of
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ module Dodge.Targeting where
|
|||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
import Dodge.Item.Weapon.ExtraEffect
|
import Dodge.Item.Weapon.ExtraEffect
|
||||||
|
|
||||||
updateTargeting :: TargetUpdate -> Item -> Creature -> World -> Targeting -> (World, Targeting)
|
updateTargeting :: TargetType -> Item -> Creature -> World -> Targeting -> (World, Targeting)
|
||||||
updateTargeting tu = case tu of
|
updateTargeting tu = case tu of
|
||||||
NoTargetUpdate -> \_ _ w t -> (w, t)
|
TargetLaser -> targetLaserUpdate
|
||||||
TargetLaserUpdate -> targetLaserUpdate
|
TargetRBPress -> targetUpdateWith targetRBPressUpdate
|
||||||
TargetRBPressUpdate -> targetUpdateWith targetRBPressUpdate
|
TargetRBLine -> targetUpdateWith targetRBPressUpdate
|
||||||
TargetRBCreatureUpdate -> targetRBCreatureUp
|
TargetRBCreature -> targetRBCreatureUp
|
||||||
TargetCursorUpdate -> targetUpdateWith targetCursorUpdate
|
TargetCursor -> targetUpdateWith targetCursorUpdate
|
||||||
|
|||||||
@@ -9,19 +9,21 @@ import LensHelp
|
|||||||
import Picture
|
import Picture
|
||||||
import ShortShow
|
import ShortShow
|
||||||
|
|
||||||
drawTargeting :: TargetDraw -> Item -> Creature -> Configuration -> World -> Picture
|
drawTargeting :: TargetType -> Item -> Creature -> Configuration -> World -> Picture
|
||||||
drawTargeting td = case td of
|
drawTargeting td = case td of
|
||||||
NoTargetDraw -> \_ _ _ _ -> mempty
|
-- NoTargetDraw -> \_ _ _ _ -> mempty
|
||||||
SimpleDrawTarget -> targetSimpleDraw
|
TargetRBCreature -> targetRBCreatureDraw
|
||||||
TargetRBCreatureDraw -> targetRBCreatureDraw
|
TargetRBLine -> targetDistanceDraw
|
||||||
TargetDistanceDraw -> targetDistanceDraw
|
TargetLaser -> \_ _ _ _ -> mempty
|
||||||
|
TargetRBPress -> targetSimpleDraw
|
||||||
|
TargetCursor -> targetSimpleDraw
|
||||||
|
|
||||||
targetSimpleDraw :: Item -> Creature -> Configuration -> World -> Picture
|
targetSimpleDraw :: Item -> Creature -> Configuration -> World -> Picture
|
||||||
targetSimpleDraw = targetDraw $ const activeTargetCursorPic
|
targetSimpleDraw = targetDraw $ const activeTargetCursorPic
|
||||||
|
|
||||||
targetDistanceDraw :: Item -> Creature -> Configuration -> World -> Picture
|
targetDistanceDraw :: Item -> Creature -> Configuration -> World -> Picture
|
||||||
targetDistanceDraw itm _ cfig w = fromMaybe mempty $ do
|
targetDistanceDraw itm _ cfig w = fromMaybe mempty $ do
|
||||||
p <- itm ^? itTargeting . tgPos . _Just
|
p <- itm ^? itUse . heldTargeting . tgPos . _Just
|
||||||
let p1 = worldPosToScreen cam p
|
let p1 = worldPosToScreen cam p
|
||||||
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . camPos)
|
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . camPos)
|
||||||
p2 = worldPosToScreen cam mwp
|
p2 = worldPosToScreen cam mwp
|
||||||
@@ -37,7 +39,7 @@ targetDistanceDraw itm _ cfig w = fromMaybe mempty $ do
|
|||||||
|
|
||||||
targetDraw :: (Item -> Picture) -> Item -> Creature -> Configuration -> World -> Picture
|
targetDraw :: (Item -> Picture) -> Item -> Creature -> Configuration -> World -> Picture
|
||||||
targetDraw f it _ cfig w = fromMaybe mempty $ do
|
targetDraw f it _ cfig w = fromMaybe mempty $ do
|
||||||
p <- it ^? itTargeting . tgPos . _Just
|
p <- it ^? itUse . heldTargeting . tgPos . _Just
|
||||||
return $
|
return $
|
||||||
winScale cfig $
|
winScale cfig $
|
||||||
setLayer FixedCoordLayer $
|
setLayer FixedCoordLayer $
|
||||||
@@ -65,7 +67,7 @@ targetRBCreatureDraw :: Item -> Creature -> Configuration -> World -> Picture
|
|||||||
targetRBCreatureDraw = targetDraw thepic
|
targetRBCreatureDraw = targetDraw thepic
|
||||||
where
|
where
|
||||||
thepic it
|
thepic it
|
||||||
| _tgActive $ _itTargeting it = activeTargetCursorPic
|
| _tgActive $ _heldTargeting $ _itUse it = activeTargetCursorPic
|
||||||
| otherwise = targetCursorPic
|
| otherwise = targetCursorPic
|
||||||
|
|
||||||
targCorner :: Picture
|
targCorner :: Picture
|
||||||
|
|||||||
Reference in New Issue
Block a user