Work on held item usage
This commit is contained in:
+5
-2
@@ -3,6 +3,7 @@ module Dodge.Bullet (
|
|||||||
useAmmoParams,
|
useAmmoParams,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Linear
|
||||||
import Dodge.Item.Weapon.Bullet
|
import Dodge.Item.Weapon.Bullet
|
||||||
import System.Random
|
import System.Random
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
@@ -59,13 +60,15 @@ useAmmoParams :: Item -> Creature -> World -> World
|
|||||||
useAmmoParams it cr w =
|
useAmmoParams it cr w =
|
||||||
w & cWorld . lWorld . instantBullets
|
w & cWorld . lWorld . instantBullets
|
||||||
.:~ ( _amBullet bultype
|
.:~ ( _amBullet bultype
|
||||||
& buPos .~ sp
|
-- & buPos .~ sp
|
||||||
|
& buPos .~ _crPos cr
|
||||||
& buTrajectory %~ settrajectory
|
& buTrajectory %~ settrajectory
|
||||||
& buVel %~ (rotateV dir . (muzvel *.*))
|
& buVel %~ (rotateV dir . (muzvel *.*))
|
||||||
& buDrag *~ _rifling (_itParams it)
|
& buDrag *~ _rifling (_itParams it)
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
sp = _crPos cr +.+ (muzlength + 10) *.* unitVectorAtAngle dir
|
--sp = _crPos cr +.+ (muzlength + 10) *.* unitVectorAtAngle dir
|
||||||
|
sp = _crPos cr +.+ (muzlength ^?! _head . _x) *.* unitVectorAtAngle dir
|
||||||
dir = _crDir cr
|
dir = _crDir cr
|
||||||
bultype = _laAmmoType $ _heldConsumption $ _itUse it
|
bultype = _laAmmoType $ _heldConsumption $ _itUse it
|
||||||
muzvel = _muzVel $ _itParams it
|
muzvel = _muzVel $ _itParams it
|
||||||
|
|||||||
@@ -259,6 +259,7 @@ stackedInventory =
|
|||||||
, flatShield
|
, flatShield
|
||||||
, spawnGun (lamp 5)
|
, spawnGun (lamp 5)
|
||||||
, lasGun
|
, lasGun
|
||||||
|
, lasWide 5
|
||||||
, flameThrower
|
, flameThrower
|
||||||
, poisonSprayer
|
, poisonSprayer
|
||||||
, launcher
|
, launcher
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
module Dodge.Creature.HandPos where
|
module Dodge.Creature.HandPos where
|
||||||
|
|
||||||
|
import Linear
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Dodge.Creature.Test
|
import Dodge.Creature.Test
|
||||||
@@ -20,10 +21,18 @@ aimingWeaponZeroPos cr it =
|
|||||||
aimingWeaponHandlePos cr it
|
aimingWeaponHandlePos cr it
|
||||||
- fromMaybe 0 (it ^? itUse . heldAim . aimHandlePos)
|
- fromMaybe 0 (it ^? itUse . heldAim . aimHandlePos)
|
||||||
|
|
||||||
aimingMuzzlePos :: Creature -> Item -> Float
|
aimingMuzzlePos :: Creature -> Item -> [Point2]
|
||||||
aimingMuzzlePos cr it =
|
aimingMuzzlePos cr it = fmap ((+ zp) . _mzPos) (it ^.. itUse . heldAim . aimMuzzles . folded)
|
||||||
aimingWeaponZeroPos cr it
|
where
|
||||||
+ fromMaybe 0 (it ^? itUse . heldAim . aimMuzPos)
|
zp = V2 (aimingWeaponZeroPos cr it) 0
|
||||||
|
|
||||||
|
aimingMuzzleOff :: Creature -> Item -> [Point2]
|
||||||
|
aimingMuzzleOff cr it = fmap (rotateV (_crDir cr) . (+ zp) . _mzPos) (it ^.. itUse . heldAim . aimMuzzles . folded)
|
||||||
|
where
|
||||||
|
zp = V2 (aimingWeaponZeroPos cr it) 0
|
||||||
|
|
||||||
|
aimingMuzzleLength :: Creature -> Item -> Float
|
||||||
|
aimingMuzzleLength cr it = head (aimingMuzzlePos cr it) ^. _x
|
||||||
|
|
||||||
translatePointToRightHand :: Creature -> Point3 -> Point3
|
translatePointToRightHand :: Creature -> Point3 -> Point3
|
||||||
translatePointToRightHand cr = translatePointToRightHand' cr . mirrorV3xz
|
translatePointToRightHand cr = translatePointToRightHand' cr . mirrorV3xz
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ data ItemParams
|
|||||||
{ _muzVel :: Float
|
{ _muzVel :: Float
|
||||||
, _rifling :: Float
|
, _rifling :: Float
|
||||||
, _bore :: Float
|
, _bore :: Float
|
||||||
, _gunBarrels :: [GunBarrel]
|
|
||||||
, _recoil :: Float
|
, _recoil :: Float
|
||||||
, _torqueAfter :: Float
|
, _torqueAfter :: Float
|
||||||
, _randomOffset :: Float
|
, _randomOffset :: Float
|
||||||
@@ -76,12 +75,6 @@ data ShrinkGunStatus = FullSize | Shrunk
|
|||||||
data PreviousArcEffect = NoPreviousArcEffect | PerturbTillBreakPreviousArc
|
data PreviousArcEffect = NoPreviousArcEffect | PerturbTillBreakPreviousArc
|
||||||
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
data GunBarrel = GunBarrel
|
|
||||||
{ _barlPos :: Point2
|
|
||||||
, _barlRot :: Float
|
|
||||||
, _barlInaccuracy :: Float
|
|
||||||
}
|
|
||||||
|
|
||||||
--data GunBarrels
|
--data GunBarrels
|
||||||
---- = MultiBarrel
|
---- = MultiBarrel
|
||||||
---- { _brlSpread :: BarrelSpread
|
---- { _brlSpread :: BarrelSpread
|
||||||
@@ -103,21 +96,9 @@ data Nozzle = Nozzle
|
|||||||
}
|
}
|
||||||
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
--data BarrelSpread
|
|
||||||
-- = AlignedBarrels
|
|
||||||
-- | SpreadBarrels {_spreadAngle :: Float}
|
|
||||||
-- | RotatingBarrels {_rotatingBarrelInaccuracy :: Float}
|
|
||||||
-- --deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
||||||
|
|
||||||
--makeLenses ''BarrelSpread
|
|
||||||
makeLenses ''ItemParams
|
makeLenses ''ItemParams
|
||||||
makeLenses ''Nozzle
|
makeLenses ''Nozzle
|
||||||
--makeLenses ''GunBarrels
|
|
||||||
makeLenses ''GunBarrel
|
|
||||||
deriveJSON defaultOptions ''ShrinkGunStatus
|
deriveJSON defaultOptions ''ShrinkGunStatus
|
||||||
deriveJSON defaultOptions ''PreviousArcEffect
|
deriveJSON defaultOptions ''PreviousArcEffect
|
||||||
deriveJSON defaultOptions ''Nozzle
|
deriveJSON defaultOptions ''Nozzle
|
||||||
--deriveJSON defaultOptions ''BarrelSpread
|
|
||||||
deriveJSON defaultOptions ''GunBarrel
|
|
||||||
--deriveJSON defaultOptions ''GunBarrels
|
|
||||||
deriveJSON defaultOptions ''ItemParams
|
deriveJSON defaultOptions ''ItemParams
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ module Dodge.Data.Item.Use (
|
|||||||
module Dodge.Data.Item.Targeting,
|
module Dodge.Data.Item.Targeting,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Linear
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
import Data.Aeson.TH
|
import Data.Aeson.TH
|
||||||
@@ -72,10 +73,17 @@ data AimParams = AimParams
|
|||||||
, _aimZoom :: ItZoom
|
, _aimZoom :: ItZoom
|
||||||
, _aimStance :: AimStance
|
, _aimStance :: AimStance
|
||||||
, _aimHandlePos :: Float
|
, _aimHandlePos :: Float
|
||||||
, _aimMuzPos :: Float
|
, _aimMuzzles :: [Muzzle]
|
||||||
}
|
}
|
||||||
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
|
data Muzzle = Muzzle
|
||||||
|
{ _mzPos :: V2 Float
|
||||||
|
, _mzRot :: Float
|
||||||
|
, _mzInaccuracy :: Float
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
data AimStance
|
data AimStance
|
||||||
= TwoHandTwist
|
= TwoHandTwist
|
||||||
| TwoHandFlat
|
| TwoHandFlat
|
||||||
@@ -94,6 +102,8 @@ data ItZoom = ItZoom
|
|||||||
makeLenses ''ItemUse
|
makeLenses ''ItemUse
|
||||||
makeLenses ''AimParams
|
makeLenses ''AimParams
|
||||||
makeLenses ''ItZoom
|
makeLenses ''ItZoom
|
||||||
|
makeLenses ''Muzzle
|
||||||
|
deriveJSON defaultOptions ''Muzzle
|
||||||
deriveJSON defaultOptions ''AimStance
|
deriveJSON defaultOptions ''AimStance
|
||||||
deriveJSON defaultOptions ''ItZoom
|
deriveJSON defaultOptions ''ItZoom
|
||||||
deriveJSON defaultOptions ''AimParams
|
deriveJSON defaultOptions ''AimParams
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
module Dodge.Default.Item.Use.AimParams where
|
module Dodge.Default.Item.Use.AimParams where
|
||||||
|
|
||||||
import Dodge.Data.Item.Use
|
import Dodge.Data.Item.Use
|
||||||
|
import Linear
|
||||||
|
|
||||||
defaultAimParams :: AimParams
|
defaultAimParams :: AimParams
|
||||||
defaultAimParams =
|
defaultAimParams =
|
||||||
@@ -11,5 +12,6 @@ defaultAimParams =
|
|||||||
, _aimZoom = ItZoom 20 0.2 1
|
, _aimZoom = ItZoom 20 0.2 1
|
||||||
, _aimStance = OneHand
|
, _aimStance = OneHand
|
||||||
, _aimHandlePos = 10
|
, _aimHandlePos = 10
|
||||||
, _aimMuzPos = 20
|
, _aimMuzzles = [Muzzle (V2 20 0) 0 0]
|
||||||
|
-- , _aimMuzPos = 20
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-21
@@ -87,6 +87,7 @@ useMod hm = case hm of
|
|||||||
, withSoundForI tone440sawtoothquietS 2
|
, withSoundForI tone440sawtoothquietS 2
|
||||||
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||||
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||||
|
, duplicateLoadedBarrels
|
||||||
, ammoCheckI
|
, ammoCheckI
|
||||||
]
|
]
|
||||||
DualBeamMod ->
|
DualBeamMod ->
|
||||||
@@ -97,11 +98,11 @@ useMod hm = case hm of
|
|||||||
, ammoCheckI
|
, ammoCheckI
|
||||||
]
|
]
|
||||||
LasMod ->
|
LasMod ->
|
||||||
[ crAtMuzPos
|
[ useAmmoAmount 1
|
||||||
, useAmmoAmount 1
|
-- , withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||||
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
|
||||||
, withSoundForI tone440sawtoothquietS 2
|
, withSoundForI tone440sawtoothquietS 2
|
||||||
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
-- , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||||
|
, duplicateLoadedBarrels
|
||||||
, ammoCheckI
|
, ammoCheckI
|
||||||
]
|
]
|
||||||
LauncherXMod i ->
|
LauncherXMod i ->
|
||||||
@@ -130,7 +131,7 @@ useMod hm = case hm of
|
|||||||
[ withMuzFlareI
|
[ withMuzFlareI
|
||||||
, withSmoke 1 black 20 200 5
|
, withSmoke 1 black 20 200 5
|
||||||
, withRecoil
|
, withRecoil
|
||||||
, applyInaccuracy
|
, duplicateLoadedBarrels
|
||||||
, withTorqueAfter
|
, withTorqueAfter
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
@@ -141,7 +142,6 @@ useMod hm = case hm of
|
|||||||
VolleyGunMod ->
|
VolleyGunMod ->
|
||||||
[ withRecoil
|
[ withRecoil
|
||||||
, withMuzFlareI
|
, withMuzFlareI
|
||||||
, applyInaccuracy
|
|
||||||
, duplicateLoadedBarrels
|
, duplicateLoadedBarrels
|
||||||
, withTorqueAfter
|
, withTorqueAfter
|
||||||
, useAllAmmo
|
, useAllAmmo
|
||||||
@@ -155,7 +155,7 @@ useMod hm = case hm of
|
|||||||
[ withMuzFlareI
|
[ withMuzFlareI
|
||||||
, withSmoke 1 black 20 200 5
|
, withSmoke 1 black 20 200 5
|
||||||
, withRecoil
|
, withRecoil
|
||||||
, applyInaccuracy
|
, duplicateLoadedBarrels
|
||||||
, withTorqueAfter
|
, withTorqueAfter
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
@@ -166,7 +166,7 @@ useMod hm = case hm of
|
|||||||
[ withRecoil
|
[ withRecoil
|
||||||
, withMuzFlareI
|
, withMuzFlareI
|
||||||
, withThickSmokeI
|
, withThickSmokeI
|
||||||
, applyInaccuracy
|
, duplicateLoadedBarrels
|
||||||
, withTorqueAfter
|
, withTorqueAfter
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, withSoundStart bangEchoS
|
, withSoundStart bangEchoS
|
||||||
@@ -178,7 +178,7 @@ useMod hm = case hm of
|
|||||||
[ withRecoil
|
[ withRecoil
|
||||||
, withMuzFlareI
|
, withMuzFlareI
|
||||||
, withThickSmokeI
|
, withThickSmokeI
|
||||||
, applyInaccuracy
|
, duplicateLoadedBarrels
|
||||||
, withTorqueAfter
|
, withTorqueAfter
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, withSoundStart bangEchoS
|
, withSoundStart bangEchoS
|
||||||
@@ -190,7 +190,7 @@ useMod hm = case hm of
|
|||||||
[ withRecoil
|
[ withRecoil
|
||||||
, withMuzFlareI
|
, withMuzFlareI
|
||||||
, withThickSmokeI
|
, withThickSmokeI
|
||||||
, applyInaccuracy
|
, duplicateLoadedBarrels
|
||||||
, withTorqueAfter
|
, withTorqueAfter
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, withSoundStart bangEchoS
|
, withSoundStart bangEchoS
|
||||||
@@ -222,7 +222,7 @@ useMod hm = case hm of
|
|||||||
, withSidePushI 50
|
, withSidePushI 50
|
||||||
, withRecoil
|
, withRecoil
|
||||||
, withTorqueAfter
|
, withTorqueAfter
|
||||||
, applyInaccuracy
|
, duplicateLoadedBarrels
|
||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
@@ -234,7 +234,7 @@ useMod hm = case hm of
|
|||||||
, withSidePushI 50
|
, withSidePushI 50
|
||||||
, withRecoil
|
, withRecoil
|
||||||
, withTorqueAfter
|
, withTorqueAfter
|
||||||
, applyInaccuracy
|
, duplicateLoadedBarrels
|
||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
@@ -245,7 +245,7 @@ useMod hm = case hm of
|
|||||||
, withRecoil
|
, withRecoil
|
||||||
, withSidePushI 50
|
, withSidePushI 50
|
||||||
, withTorqueAfter
|
, withTorqueAfter
|
||||||
, applyInaccuracy
|
, duplicateLoadedBarrels
|
||||||
, withSoundStart tap1S
|
, withSoundStart tap1S
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
@@ -254,7 +254,7 @@ useMod hm = case hm of
|
|||||||
BurstRifleMod ->
|
BurstRifleMod ->
|
||||||
[ withRecoil
|
[ withRecoil
|
||||||
, withMuzFlareI
|
, withMuzFlareI
|
||||||
, applyInaccuracy
|
, duplicateLoadedBarrels
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
, repeatOnFrames [3, 6] BurstRifleRepeatMod
|
, repeatOnFrames [3, 6] BurstRifleRepeatMod
|
||||||
@@ -267,7 +267,7 @@ useMod hm = case hm of
|
|||||||
BurstRifleRepeatMod ->
|
BurstRifleRepeatMod ->
|
||||||
[ withRecoil
|
[ withRecoil
|
||||||
, withMuzFlareI
|
, withMuzFlareI
|
||||||
, applyInaccuracy
|
, duplicateLoadedBarrels
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
, sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
|
, sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
|
||||||
@@ -294,7 +294,7 @@ useMod hm = case hm of
|
|||||||
, withSidePushI 30
|
, withSidePushI 30
|
||||||
, withRecoil
|
, withRecoil
|
||||||
, withTorqueAfter
|
, withTorqueAfter
|
||||||
, applyInaccuracy
|
, duplicateLoadedBarrels
|
||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
@@ -305,7 +305,7 @@ useMod hm = case hm of
|
|||||||
, withTorqueAfter
|
, withTorqueAfter
|
||||||
-- , spreadLoaded
|
-- , spreadLoaded
|
||||||
, withMuzFlareI
|
, withMuzFlareI
|
||||||
, applyInaccuracy
|
, duplicateLoadedBarrels
|
||||||
, useAmmoUpTo 1
|
, useAmmoUpTo 1
|
||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
, repeatOnFrames [2, 4, 6, 8, 10] RevolverXRepeatMod
|
, repeatOnFrames [2, 4, 6, 8, 10] RevolverXRepeatMod
|
||||||
@@ -320,7 +320,7 @@ useMod hm = case hm of
|
|||||||
[ withRecoil
|
[ withRecoil
|
||||||
, withTorqueAfter
|
, withTorqueAfter
|
||||||
, withMuzFlareI
|
, withMuzFlareI
|
||||||
, applyInaccuracy
|
, duplicateLoadedBarrels
|
||||||
, useAmmoUpTo 1
|
, useAmmoUpTo 1
|
||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
, ammoCheckI
|
, ammoCheckI
|
||||||
@@ -329,9 +329,9 @@ useMod hm = case hm of
|
|||||||
[ withRandomItemParams coneRandItemParams
|
[ withRandomItemParams coneRandItemParams
|
||||||
, withRandomItemUpdate coneRandItemUpdate
|
, withRandomItemUpdate coneRandItemUpdate
|
||||||
, withRandomOffset
|
, withRandomOffset
|
||||||
, applyInaccuracy
|
, duplicateLoadedBarrels
|
||||||
, withMuzFlareI
|
|
||||||
, duplicateLoaded
|
, duplicateLoaded
|
||||||
|
, withMuzFlareI
|
||||||
, withRecoil
|
, withRecoil
|
||||||
, withTorqueAfter
|
, withTorqueAfter
|
||||||
, useAllAmmo
|
, useAllAmmo
|
||||||
@@ -511,7 +511,7 @@ shootTeslaArc it cr w =
|
|||||||
where
|
where
|
||||||
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
||||||
(w', ip) = makeTeslaArc (_itParams it) pos dir w
|
(w', ip) = makeTeslaArc (_itParams it) pos dir w
|
||||||
pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
pos = _crPos cr +.+ aimingMuzzleLength cr it *.* unitVectorAtAngle dir
|
||||||
dir = _crDir cr
|
dir = _crDir cr
|
||||||
|
|
||||||
-- I believe because the targeting returns to nothing straight after you release
|
-- I believe because the targeting returns to nothing straight after you release
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ bangStickAmmoPos :: Int -> Item -> AmmoPosition
|
|||||||
bangStickAmmoPos _ itm =
|
bangStickAmmoPos _ itm =
|
||||||
Bullets
|
Bullets
|
||||||
[(rotate3z a (V3 5 0 3), Q.axisAngle (V3 0 0 1) a)
|
[(rotate3z a (V3 5 0 3), Q.axisAngle (V3 0 0 1) a)
|
||||||
| a <- map _barlRot (itm ^?! itParams . gunBarrels)]
|
| a <- map _mzRot (itm ^?! itUse . heldAim . aimMuzzles)]
|
||||||
|
|
||||||
volleygunAmmoPos :: Int -> AmmoPosition
|
volleygunAmmoPos :: Int -> AmmoPosition
|
||||||
volleygunAmmoPos i =
|
volleygunAmmoPos i =
|
||||||
@@ -208,9 +208,9 @@ modulesSPic it _ imt = case imt of
|
|||||||
_ -> mempty
|
_ -> mempty
|
||||||
|
|
||||||
baseStickShapeX :: Item -> Int -> Shape
|
baseStickShapeX :: Item -> Int -> Shape
|
||||||
baseStickShapeX it _ = foldMap f (it ^?! itParams . gunBarrels)
|
baseStickShapeX it _ = foldMap f (it ^?! itUse . heldAim . aimMuzzles)
|
||||||
where
|
where
|
||||||
f brl = rotateSH (_barlRot brl) baseStickShape
|
f brl = rotateSH (_mzRot brl) baseStickShape
|
||||||
|
|
||||||
baseStickShape :: Shape
|
baseStickShape :: Shape
|
||||||
baseStickShape = colorSH green $ xCylinderST 3 10
|
baseStickShape = colorSH green $ xCylinderST 3 10
|
||||||
@@ -219,7 +219,7 @@ bangConeShape :: Float -> Shape
|
|||||||
bangConeShape x =
|
bangConeShape x =
|
||||||
colorSH cyan $
|
colorSH cyan $
|
||||||
xCylinderST 3 x
|
xCylinderST 3 x
|
||||||
<> upperPrismPolyST 6 (reverse $ rectNSWE 4 (-4) x (10 + x))
|
<> upperPrismPolyST 6 ( rectNSWE 4 (-4) x (10 + x))
|
||||||
|
|
||||||
defSPic :: SPic
|
defSPic :: SPic
|
||||||
defSPic = noPic $ colorSH green $ upperPrismPolyST 3 $ square 4
|
defSPic = noPic $ colorSH green $ upperPrismPolyST 3 $ square 4
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ teslaGun =
|
|||||||
& itUse . heldAim . aimWeight .~ 6
|
& itUse . heldAim . aimWeight .~ 6
|
||||||
& itUse . heldAim . aimStance .~ TwoHandFlat
|
& itUse . heldAim . aimStance .~ TwoHandFlat
|
||||||
& itUse . heldAim . aimHandlePos .~ 4
|
& itUse . heldAim . aimHandlePos .~ 4
|
||||||
& itUse . heldAim . aimMuzPos .~ 4
|
-- & itUse . heldAim . aimMuzPos .~ 4
|
||||||
|
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 4 0) 0 0]
|
||||||
& itType . iyBase .~ HELD TESLAGUN
|
& itType . iyBase .~ HELD TESLAGUN
|
||||||
|
|
||||||
lasGun :: Item
|
lasGun :: Item
|
||||||
@@ -63,7 +64,8 @@ lasGun =
|
|||||||
& itUse . heldAim . aimRange .~ 1
|
& itUse . heldAim . aimRange .~ 1
|
||||||
& itUse . heldAim . aimStance .~ TwoHandTwist
|
& itUse . heldAim . aimStance .~ TwoHandTwist
|
||||||
& itUse . heldAim . aimHandlePos .~ 5
|
& itUse . heldAim . aimHandlePos .~ 5
|
||||||
& itUse . heldAim . aimMuzPos .~ 30
|
-- & itUse . heldAim . aimMuzPos .~ 30
|
||||||
|
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0]
|
||||||
& itType . iyBase .~ HELD LASGUN
|
& itType . iyBase .~ HELD LASGUN
|
||||||
|
|
||||||
lasGunTweak :: TweakParam
|
lasGunTweak :: TweakParam
|
||||||
@@ -94,7 +96,7 @@ tractorGun =
|
|||||||
& itUse . heldAim . aimRange .~ 1
|
& itUse . heldAim . aimRange .~ 1
|
||||||
& itUse . heldAim . aimStance .~ TwoHandTwist
|
& itUse . heldAim . aimStance .~ TwoHandTwist
|
||||||
& itUse . heldAim . aimHandlePos .~ 5
|
& itUse . heldAim . aimHandlePos .~ 5
|
||||||
& itUse . heldAim . aimMuzPos .~ 30
|
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0]
|
||||||
& itType . iyBase .~ HELD TRACTORGUN
|
& itType . iyBase .~ HELD TRACTORGUN
|
||||||
|
|
||||||
tractorGunTweak :: TweakParam
|
tractorGunTweak :: TweakParam
|
||||||
@@ -149,7 +151,7 @@ dualBeam :: Item
|
|||||||
dualBeam =
|
dualBeam =
|
||||||
lasGun
|
lasGun
|
||||||
& itType . iyBase .~ HELD DUALBEAM
|
& itType . iyBase .~ HELD DUALBEAM
|
||||||
& itUse . heldAim . aimMuzPos .~ 0
|
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0]
|
||||||
& itParams
|
& itParams
|
||||||
.~ DualBeam
|
.~ DualBeam
|
||||||
{ _phaseV = 1
|
{ _phaseV = 1
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ defaultBangCane =
|
|||||||
{ _muzVel = 0.8
|
{ _muzVel = 0.8
|
||||||
, _rifling = 0.9
|
, _rifling = 0.9
|
||||||
, _bore = 2
|
, _bore = 2
|
||||||
, _gunBarrels = [GunBarrel 0 0 0.01]
|
|
||||||
, _recoil = 50
|
, _recoil = 50
|
||||||
, _torqueAfter = 0.1
|
, _torqueAfter = 0.1
|
||||||
, _randomOffset = 0
|
, _randomOffset = 0
|
||||||
@@ -33,7 +32,7 @@ defaultBangCane =
|
|||||||
& itUse . heldMods .~ BangCaneMod
|
& itUse . heldMods .~ BangCaneMod
|
||||||
& itUse . heldAim . aimStance .~ OneHand
|
& itUse . heldAim . aimStance .~ OneHand
|
||||||
& itUse . heldAim . aimHandlePos .~ 5
|
& itUse . heldAim . aimHandlePos .~ 5
|
||||||
& itUse . heldAim . aimMuzPos .~ 15
|
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01]
|
||||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1
|
||||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1]
|
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1]
|
||||||
|
|
||||||
@@ -47,20 +46,17 @@ volleyGun i =
|
|||||||
& itUse . heldAim . aimStance .~ TwoHandFlat
|
& itUse . heldAim . aimStance .~ TwoHandFlat
|
||||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||||
& itUse . heldAim . aimHandlePos .~ 5
|
& itUse . heldAim . aimHandlePos .~ 5
|
||||||
& itUse . heldAim . aimMuzPos .~ 15
|
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 3]
|
||||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
|
||||||
& itParams
|
& itParams
|
||||||
.~ BulletShooter
|
.~ BulletShooter
|
||||||
{ _muzVel = 0.8
|
{ _muzVel = 0.8
|
||||||
, _rifling = 0.9
|
, _rifling = 0.9
|
||||||
, _bore = 2
|
, _bore = 2
|
||||||
, _gunBarrels = [GunBarrel 0 0 0.01]
|
|
||||||
, _recoil = 50
|
, _recoil = 50
|
||||||
, _torqueAfter = 0.1
|
, _torqueAfter = 0.1
|
||||||
, _randomOffset = 0
|
, _randomOffset = 0
|
||||||
}
|
}
|
||||||
& itParams . gunBarrels
|
|
||||||
.~ [ GunBarrel (V2 0 x) 0 0.1 | x <- spreadAroundCenter i 3]
|
|
||||||
& itParams . torqueAfter .~ 0.48 + 0.2 * fromIntegral i
|
& itParams . torqueAfter .~ 0.48 + 0.2 * fromIntegral i
|
||||||
& itType . iyBase .~ HELD (VOLLEYGUN i)
|
& itType . iyBase .~ HELD (VOLLEYGUN i)
|
||||||
|
|
||||||
@@ -96,7 +92,7 @@ burstRifle :: Item
|
|||||||
burstRifle =
|
burstRifle =
|
||||||
repeater
|
repeater
|
||||||
& itType . iyBase .~ HELD BURSTRIFLE
|
& itType . iyBase .~ HELD BURSTRIFLE
|
||||||
& itParams . gunBarrels . ix 0 . barlInaccuracy .~ 0.05
|
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0.05
|
||||||
& itUse . heldDelay . rateMax .~ 18
|
& itUse . heldDelay . rateMax .~ 18
|
||||||
& itUse . heldMods .~ BurstRifleMod
|
& itUse . heldMods .~ BurstRifleMod
|
||||||
|
|
||||||
@@ -124,12 +120,12 @@ miniGunX i =
|
|||||||
autoRifle
|
autoRifle
|
||||||
& itUse .~ miniGunUse i
|
& itUse .~ miniGunUse i
|
||||||
& itUse . heldAim . aimTurnSpeed .~ 0.5
|
& itUse . heldAim . aimTurnSpeed .~ 0.5
|
||||||
|
& itUse . heldAim . aimMuzzles .~ replicate i (Muzzle (V2 15 0) 0 0.05)
|
||||||
& itParams
|
& itParams
|
||||||
.~ BulletShooter
|
.~ BulletShooter
|
||||||
{ _muzVel = 1
|
{ _muzVel = 1
|
||||||
, _rifling = 0.9
|
, _rifling = 0.9
|
||||||
, _bore = 2
|
, _bore = 2
|
||||||
, _gunBarrels = replicate i (GunBarrel 0 0 0.05)
|
|
||||||
, _recoil = 10
|
, _recoil = 10
|
||||||
, _torqueAfter = 0
|
, _torqueAfter = 0
|
||||||
, _randomOffset = 10
|
, _randomOffset = 10
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
module Dodge.Item.Held.Cone
|
module Dodge.Item.Held.Cone where
|
||||||
where
|
|
||||||
import Dodge.Default.Item
|
|
||||||
import Dodge.Data.Item
|
|
||||||
import Dodge.Reloading.Action
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
|
import Dodge.Data.Item
|
||||||
|
import Dodge.Default.Item
|
||||||
|
import Dodge.Reloading.Action
|
||||||
import Geometry.Data
|
import Geometry.Data
|
||||||
|
import Linear
|
||||||
|
|
||||||
bangCone :: Item
|
bangCone :: Item
|
||||||
bangCone =
|
bangCone =
|
||||||
@@ -14,7 +15,6 @@ bangCone =
|
|||||||
{ _muzVel = 0.7
|
{ _muzVel = 0.7
|
||||||
, _rifling = 0.8
|
, _rifling = 0.8
|
||||||
, _bore = 5
|
, _bore = 5
|
||||||
, _gunBarrels = [GunBarrel 0 0 0.5]
|
|
||||||
, _recoil = 150
|
, _recoil = 150
|
||||||
, _torqueAfter = 0.1
|
, _torqueAfter = 0.1
|
||||||
, _randomOffset = 12
|
, _randomOffset = 12
|
||||||
@@ -25,7 +25,7 @@ bangCone =
|
|||||||
& itUse . heldDelay . rateMax .~ 20
|
& itUse . heldDelay . rateMax .~ 20
|
||||||
& itUse . heldMods .~ BangConeMod
|
& itUse . heldMods .~ BangConeMod
|
||||||
& itUse . heldAim . aimHandlePos .~ 5
|
& itUse . heldAim . aimHandlePos .~ 5
|
||||||
& itUse . heldAim . aimMuzPos .~ 15
|
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.5]
|
||||||
& itType . iyBase .~ HELD BANGCONE
|
& itType . iyBase .~ HELD BANGCONE
|
||||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 5
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 5
|
||||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 20, loadPrime 5]
|
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 20, loadPrime 5]
|
||||||
@@ -38,7 +38,7 @@ blunderbuss =
|
|||||||
& itUse . heldAim . aimStance .~ TwoHandTwist
|
& itUse . heldAim . aimStance .~ TwoHandTwist
|
||||||
& itUse . heldAim . aimWeight .~ 6
|
& itUse . heldAim . aimWeight .~ 6
|
||||||
& itUse . heldAim . aimHandlePos .~ 5
|
& itUse . heldAim . aimHandlePos .~ 5
|
||||||
& itUse . heldAim . aimMuzPos .~ 30
|
& itUse . heldAim . aimMuzzles . ix 0 . mzPos . _x .~ 30
|
||||||
& itType . iyBase .~ HELD BLUNDERBUSS
|
& itType . iyBase .~ HELD BLUNDERBUSS
|
||||||
|
|
||||||
grapeCannon :: Int -> Item
|
grapeCannon :: Int -> Item
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ launcher =
|
|||||||
& itUse . heldAim . aimRange .~ 0.5
|
& itUse . heldAim . aimRange .~ 0.5
|
||||||
& itUse . heldAim . aimStance .~ TwoHandTwist
|
& itUse . heldAim . aimStance .~ TwoHandTwist
|
||||||
& itUse . heldAim . aimHandlePos .~ 5
|
& itUse . heldAim . aimHandlePos .~ 5
|
||||||
& itUse . heldAim . aimMuzPos .~ 20
|
-- & itUse . heldAim . aimMuzPos .~ 20
|
||||||
|
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0]
|
||||||
& itUse . heldConsumption . laAmmoType
|
& itUse . heldConsumption . laAmmoType
|
||||||
.~ ProjectileAmmo
|
.~ ProjectileAmmo
|
||||||
{ _amPayload = ExplosionPayload
|
{ _amPayload = ExplosionPayload
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ bangRod =
|
|||||||
{ _muzVel = 0.8
|
{ _muzVel = 0.8
|
||||||
, _rifling = 1
|
, _rifling = 1
|
||||||
, _bore = 2
|
, _bore = 2
|
||||||
, _gunBarrels = [GunBarrel 0 0 0.1]
|
|
||||||
, _recoil = 50
|
, _recoil = 50
|
||||||
, _torqueAfter = 0.3
|
, _torqueAfter = 0.3
|
||||||
, _randomOffset = 0
|
, _randomOffset = 0
|
||||||
@@ -39,7 +38,7 @@ bangRod =
|
|||||||
& itUse . heldAim . aimStance .~ OneHand
|
& itUse . heldAim . aimStance .~ OneHand
|
||||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||||
& itUse . heldAim . aimHandlePos .~ 5
|
& itUse . heldAim . aimHandlePos .~ 5
|
||||||
& itUse . heldAim . aimMuzPos .~ 30
|
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0.1]
|
||||||
& itUse . heldConsumption . laAmmoType .~ hvBulletAmmo
|
& itUse . heldConsumption . laAmmoType .~ hvBulletAmmo
|
||||||
|
|
||||||
elephantGun :: Item
|
elephantGun :: Item
|
||||||
@@ -47,7 +46,7 @@ elephantGun =
|
|||||||
bangRod
|
bangRod
|
||||||
& itType . iyBase .~ HELD ELEPHANTGUN
|
& itType . iyBase .~ HELD ELEPHANTGUN
|
||||||
& itUse . heldAim . aimStance .~ TwoHandTwist
|
& itUse . heldAim . aimStance .~ TwoHandTwist
|
||||||
& itParams . gunBarrels .~ [GunBarrel 0 0 0.05]
|
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0.05
|
||||||
& itUse . heldMods .~ ElephantGunMod
|
& itUse . heldMods .~ ElephantGunMod
|
||||||
& itParams . recoil .~ 50
|
& itParams . recoil .~ 50
|
||||||
& itParams . torqueAfter .~ 0.1
|
& itParams . torqueAfter .~ 0.1
|
||||||
@@ -68,7 +67,7 @@ sniperRifle :: Item
|
|||||||
sniperRifle =
|
sniperRifle =
|
||||||
elephantGun
|
elephantGun
|
||||||
& itType . iyBase .~ HELD SNIPERRIFLE
|
& itType . iyBase .~ HELD SNIPERRIFLE
|
||||||
& itParams . gunBarrels .~ [GunBarrel 0 0 0]
|
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
|
||||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 0.5, _izMin = 0.5,_izFac = 1}
|
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 0.5, _izMin = 0.5,_izFac = 1}
|
||||||
& itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun
|
& itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun
|
||||||
& itScope .~ ZoomScope (V2 0 0) 1 0.5 False
|
& itScope .~ ZoomScope (V2 0 0) 1 0.5 False
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ flameThrower =
|
|||||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 5, _izMin = 1.5}
|
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 5, _izMin = 1.5}
|
||||||
& itUse . heldAim . aimStance .~ TwoHandTwist
|
& itUse . heldAim . aimStance .~ TwoHandTwist
|
||||||
& itUse . heldAim . aimHandlePos .~ 0
|
& itUse . heldAim . aimHandlePos .~ 0
|
||||||
& itUse . heldAim . aimMuzPos .~ 18
|
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 18 0) 0 0]
|
||||||
& itUse . heldConsumption
|
& itUse . heldConsumption
|
||||||
.~ ( defaultLoadable
|
.~ ( defaultLoadable
|
||||||
& laSource . _InternalSource . iaMax .~ 250
|
& laSource . _InternalSource . iaMax .~ 250
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ bangStick i =
|
|||||||
{ _muzVel = 0.8
|
{ _muzVel = 0.8
|
||||||
, _rifling = 0.8
|
, _rifling = 0.8
|
||||||
, _bore = 2
|
, _bore = 2
|
||||||
, _gunBarrels = [GunBarrel 0 a 0.01 | a <- spreadAroundCenter i baseStickSpread]
|
|
||||||
, _recoil = 25
|
, _recoil = 25
|
||||||
, _torqueAfter = 0.18 + 0.02 * fromIntegral i
|
, _torqueAfter = 0.18 + 0.02 * fromIntegral i
|
||||||
, _randomOffset = 0
|
, _randomOffset = 0
|
||||||
@@ -35,7 +34,7 @@ bangStick i =
|
|||||||
& itUse . heldDelay . rateMax .~ 8
|
& itUse . heldDelay . rateMax .~ 8
|
||||||
& itUse . heldMods .~ BangStickMod
|
& itUse . heldMods .~ BangStickMod
|
||||||
& itUse . heldAim . aimHandlePos .~ 5
|
& itUse . heldAim . aimHandlePos .~ 5
|
||||||
& itUse . heldAim . aimMuzPos .~ 10
|
& itUse . heldAim . aimMuzzles .~ [Muzzle 10 a 0.01 | a <- spreadAroundCenter i baseStickSpread]
|
||||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
|
||||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1]
|
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1]
|
||||||
|
|
||||||
@@ -62,11 +61,11 @@ pistol =
|
|||||||
)
|
)
|
||||||
& itUse . heldDelay . rateMax .~ 6
|
& itUse . heldDelay . rateMax .~ 6
|
||||||
& itUse . heldMods .~ PistolMod
|
& itUse . heldMods .~ PistolMod
|
||||||
|
& itUse . heldAim . aimMuzzles .~ [Muzzle 0 0 0.05]
|
||||||
& itParams
|
& itParams
|
||||||
%~ ( (muzVel .~ 0.8)
|
%~ ( (muzVel .~ 0.8)
|
||||||
. (rifling .~ 0.8)
|
. (rifling .~ 0.8)
|
||||||
. (bore .~ 2)
|
. (bore .~ 2)
|
||||||
. (gunBarrels .~ [GunBarrel 0 0 0.05])
|
|
||||||
. (recoil .~ 10)
|
. (recoil .~ 10)
|
||||||
. (torqueAfter .~ 0.2)
|
. (torqueAfter .~ 0.2)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
module Dodge.Item.Held.Utility where
|
module Dodge.Item.Held.Utility where
|
||||||
|
|
||||||
|
import Linear
|
||||||
import Dodge.Default.Item
|
import Dodge.Default.Item
|
||||||
import Color
|
import Color
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Dodge.Data.Item
|
import Dodge.Data.Item
|
||||||
import Geometry.Data
|
--import Geometry.Data
|
||||||
|
|
||||||
flatShield :: Item
|
flatShield :: Item
|
||||||
flatShield =
|
flatShield =
|
||||||
@@ -14,7 +15,6 @@ flatShield =
|
|||||||
& itUse . heldAim . aimTurnSpeed .~ 0.5
|
& itUse . heldAim . aimTurnSpeed .~ 0.5
|
||||||
& itUse . heldAim . aimStance .~ TwoHandFlat
|
& itUse . heldAim . aimStance .~ TwoHandFlat
|
||||||
& itUse . heldAim . aimHandlePos .~ 0
|
& itUse . heldAim . aimHandlePos .~ 0
|
||||||
& itUse . heldAim . aimMuzPos .~ 0
|
|
||||||
& itInvSize .~ 3
|
& itInvSize .~ 3
|
||||||
& itType . iyBase .~ HELD FLATSHIELD
|
& itType . iyBase .~ HELD FLATSHIELD
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ binoculars =
|
|||||||
& itScope .~ ZoomScope (V2 0 0) 1 0.5 False
|
& itScope .~ ZoomScope (V2 0 0) 1 0.5 False
|
||||||
& itType . iyBase .~ HELD BINOCULARS
|
& itType . iyBase .~ HELD BINOCULARS
|
||||||
& itUse . heldAim . aimHandlePos .~ 5
|
& itUse . heldAim . aimHandlePos .~ 5
|
||||||
& itUse . heldAim . aimMuzPos .~ 10
|
-- & itUse . heldAim . aimMuzPos .~ 10
|
||||||
& itUse . heldAim . aimStance .~ TwoHandFlat
|
& itUse . heldAim . aimStance .~ TwoHandFlat
|
||||||
& itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun
|
& itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun
|
||||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 0.5, _izMin = 0.5, _izFac = 1}
|
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 0.5, _izMin = 0.5, _izFac = 1}
|
||||||
@@ -47,7 +47,7 @@ torch =
|
|||||||
& itEffect . ieInv .~ EffectWhileHeld CreateHeldLight
|
& itEffect . ieInv .~ EffectWhileHeld CreateHeldLight
|
||||||
& itType . iyBase .~ HELD TORCH
|
& itType . iyBase .~ HELD TORCH
|
||||||
& itUse . heldAim . aimHandlePos .~ 5
|
& itUse . heldAim . aimHandlePos .~ 5
|
||||||
& itUse . heldAim . aimMuzPos .~ 10
|
& itUse . heldAim . aimMuzzles . ix 0 . mzPos . _x .~ 10
|
||||||
|
|
||||||
forceFieldGun :: Item
|
forceFieldGun :: Item
|
||||||
forceFieldGun =
|
forceFieldGun =
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ shootDualLaser it cr w =
|
|||||||
itid = _itID it
|
itid = _itID it
|
||||||
dir = _crDir cr
|
dir = _crDir cr
|
||||||
pos = _crPos cr +.+ aimlength *.* unitVectorAtAngle dir
|
pos = _crPos cr +.+ aimlength *.* unitVectorAtAngle dir
|
||||||
aimlength = aimingMuzzlePos cr it
|
aimlength = aimingMuzzleLength cr it
|
||||||
gap = _dbGap . _itParams $ it
|
gap = _dbGap . _itParams $ it
|
||||||
posl = pos +.+ (- gap) *.* vNormal (unitVectorAtAngle dir)
|
posl = pos +.+ (- gap) *.* vNormal (unitVectorAtAngle dir)
|
||||||
posr = pos +.+ gap *.* vNormal (unitVectorAtAngle dir)
|
posr = pos +.+ gap *.* vNormal (unitVectorAtAngle dir)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ shootShatter it cr w =
|
|||||||
Opaque {} -> True
|
Opaque {} -> True
|
||||||
SeeThrough -> True
|
SeeThrough -> True
|
||||||
_ -> False
|
_ -> False
|
||||||
sp = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
sp = _crPos cr +.+ aimingMuzzleLength cr it *.* unitVectorAtAngle dir
|
||||||
dir = _crDir cr
|
dir = _crDir cr
|
||||||
ep = sp +.+ 200 *.* unitVectorAtAngle dir
|
ep = sp +.+ 200 *.* unitVectorAtAngle dir
|
||||||
|
|
||||||
|
|||||||
@@ -44,30 +44,24 @@ module Dodge.Item.Weapon.TriggerType (
|
|||||||
withSidePushAfterI,
|
withSidePushAfterI,
|
||||||
withSidePushI,
|
withSidePushI,
|
||||||
withWarmUp,
|
withWarmUp,
|
||||||
--spreadNumI,
|
|
||||||
--spreadLoaded,
|
|
||||||
repeatOnFrames,
|
repeatOnFrames,
|
||||||
sideEffectOnFrame,
|
sideEffectOnFrame,
|
||||||
duplicateItem,
|
duplicateItem,
|
||||||
duplicateLoadedBarrels,
|
duplicateLoadedBarrels,
|
||||||
duplicateLoaded,
|
duplicateLoaded,
|
||||||
duplicateOffsets,
|
|
||||||
duplicateOffsetsV2,
|
duplicateOffsetsV2,
|
||||||
duplicateOffsetsFocus,
|
duplicateOffsetsFocus,
|
||||||
hammerCheckL,
|
hammerCheckL,
|
||||||
shootL,
|
shootL,
|
||||||
useTimeCheck,
|
useTimeCheck,
|
||||||
ammoCheckI,
|
ammoCheckI,
|
||||||
applyInaccuracy,
|
|
||||||
modClock,
|
modClock,
|
||||||
blCheck,
|
blCheck,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import qualified SDL
|
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.Creature.HandPos
|
|
||||||
import Dodge.Creature.Test
|
import Dodge.Creature.Test
|
||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
import Dodge.Inventory.Lock
|
import Dodge.Inventory.Lock
|
||||||
@@ -76,10 +70,11 @@ import Dodge.Reloading
|
|||||||
import Dodge.SoundLogic
|
import Dodge.SoundLogic
|
||||||
import Dodge.WorldEvent
|
import Dodge.WorldEvent
|
||||||
import Geometry
|
import Geometry
|
||||||
|
import qualified IntMapHelp as IM
|
||||||
import LensHelp
|
import LensHelp
|
||||||
import RandomHelp
|
import RandomHelp
|
||||||
|
import qualified SDL
|
||||||
import Sound.Data
|
import Sound.Data
|
||||||
import qualified IntMapHelp as IM
|
|
||||||
|
|
||||||
type ChainEffect =
|
type ChainEffect =
|
||||||
(Item -> Creature -> World -> World) ->
|
(Item -> Creature -> World -> World) ->
|
||||||
@@ -137,14 +132,16 @@ withThickSmokeI eff item cr w =
|
|||||||
-- fire.
|
-- fire.
|
||||||
ammoCheckI :: ChainEffect
|
ammoCheckI :: ChainEffect
|
||||||
ammoCheckI eff itm cr w = case itm ^? itUse . heldConsumption . laSource of
|
ammoCheckI eff itm cr w = case itm ^? itUse . heldConsumption . laSource of
|
||||||
Just (InternalSource ia) | _iaLoaded ia <= 0 || not (_iaPrimed ia)
|
Just (InternalSource ia)
|
||||||
-> failsound w
|
| _iaLoaded ia <= 0 || not (_iaPrimed ia) ->
|
||||||
Just AboveSource | fromMaybe True $ do
|
failsound w
|
||||||
|
Just AboveSource
|
||||||
|
| fromMaybe True $ do
|
||||||
invid <- itm ^? itLocation . ipInvID
|
invid <- itm ^? itLocation . ipInvID
|
||||||
x <- cr ^? crInv . ix (invid - 1) . itUse . equipEffect . eeUse . euseAmmoAmount
|
x <- cr ^? crInv . ix (invid - 1) . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||||
return $ x <= 0
|
return $ x <= 0 ->
|
||||||
-> failsound w
|
failsound w
|
||||||
_ -> eff itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
|
_ -> eff itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
|
||||||
where
|
where
|
||||||
failsound = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
|
failsound = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
|
||||||
Just 0 -> soundStart (CrReloadSound (_crID cr)) (_crPos cr) click1S Nothing
|
Just 0 -> soundStart (CrReloadSound (_crID cr)) (_crPos cr) click1S Nothing
|
||||||
@@ -360,11 +357,12 @@ useAmmoAmount amAmount eff item cr =
|
|||||||
|
|
||||||
useAmmoAmount' :: Int -> Int -> IM.IntMap Item -> IM.IntMap Item
|
useAmmoAmount' :: Int -> Int -> IM.IntMap Item -> IM.IntMap Item
|
||||||
useAmmoAmount' itref x inv = case inv ^? ix itref . itUse . heldConsumption . laSource of
|
useAmmoAmount' itref x inv = case inv ^? ix itref . itUse . heldConsumption . laSource of
|
||||||
Just InternalSource{}
|
Just InternalSource{} ->
|
||||||
-> inv & ix itref . itUse . heldConsumption . laSource . _InternalSource . iaLoaded -~ x
|
inv & ix itref . itUse . heldConsumption . laSource . _InternalSource . iaLoaded -~ x
|
||||||
Just AboveSource
|
Just AboveSource ->
|
||||||
-> inv & ix (itref - 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
|
inv & ix (itref - 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
|
||||||
_ -> inv
|
_ -> inv
|
||||||
|
|
||||||
-- . crInv . ix itRef . itUse . heldConsumption . laSource
|
-- . crInv . ix itRef . itUse . heldConsumption . laSource
|
||||||
|
|
||||||
{- |
|
{- |
|
||||||
@@ -380,7 +378,6 @@ useTimeCheck f item cr w = case item ^? itUse . heldDelay . rateTime of
|
|||||||
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
||||||
userate = fromMaybe 0 $ item ^? itUse . heldDelay . rateMax
|
userate = fromMaybe 0 $ item ^? itUse . heldDelay . rateMax
|
||||||
|
|
||||||
|
|
||||||
-- | Applies a world effect after a hammer position check.
|
-- | Applies a world effect after a hammer position check.
|
||||||
blCheck :: ChainEffect
|
blCheck :: ChainEffect
|
||||||
blCheck f it cr w = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
|
blCheck f it cr w = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
|
||||||
@@ -457,47 +454,44 @@ modClock n chainEff eff it cr w
|
|||||||
|
|
||||||
withMuzFlareI :: ChainEffect
|
withMuzFlareI :: ChainEffect
|
||||||
withMuzFlareI f it cr w =
|
withMuzFlareI f it cr w =
|
||||||
makeTlsTimeRadColPos 2 100 (V3 1 1 0.5) flashPos
|
makeTlsTimeRadColPos 2 100 (V3 1 1 0.5) (cpos `v2z` 20)
|
||||||
. muzFlareAt (V4 5 5 0 2) flarePos cdir
|
. muzFlareAt (V4 5 5 0 2) (cpos `v2z` 20) cdir
|
||||||
$ f it cr w
|
$ f it cr w
|
||||||
|
-- makeTlsTimeRadColPos 2 100 (V3 1 1 0.5) flashPos
|
||||||
|
-- . muzFlareAt (V4 5 5 0 2) flarePos cdir
|
||||||
|
-- $ f it cr w
|
||||||
where
|
where
|
||||||
flarePos = addZ 0 (_crPos cr) +.+.+ rotate3z cdir (muzzleOffset cr it +.+.+ V3 0 0 20)
|
-- flarePos = addZ 0 (_crPos cr) +.+.+ rotate3z cdir (muzzleOffset cr it +.+.+ V3 0 0 20)
|
||||||
flashPos = addZ 0 (_crPos cr) +.+.+ rotate3z cdir (muzzleOffset cr it +.+.+ V3 5 0 20)
|
-- flashPos = addZ 0 (_crPos cr) +.+.+ rotate3z cdir (muzzleOffset cr it +.+.+ V3 5 0 20)
|
||||||
-- muzzleOffset = V3 (_muzPos (_dimPortage (_itDimension it))) 0 0
|
-- -- muzzleOffset = V3 (_muzPos (_dimPortage (_itDimension it))) 0 0
|
||||||
cdir = _crDir cr
|
cdir = _crDir cr
|
||||||
|
cpos = _crPos cr
|
||||||
|
|
||||||
muzzleOffset :: Creature -> Item -> Point3
|
--muzzleOffset :: Creature -> Item -> Point3
|
||||||
muzzleOffset cr it = V3 (holdOffset + 5 + _aimMuzPos dimPort - _aimHandlePos dimPort) 0 0
|
--muzzleOffset cr it = V3 (holdOffset + 5 + _aimMuzPos dimPort - _aimHandlePos dimPort) 0 0
|
||||||
where
|
-- where
|
||||||
dimPort = _heldAim $ _itUse it
|
-- dimPort = _heldAim $ _itUse it
|
||||||
holdOffset
|
-- holdOffset
|
||||||
| crInAimStance OneHand cr = 10
|
-- | crInAimStance OneHand cr = 10
|
||||||
| otherwise = 0
|
-- | otherwise = 0
|
||||||
|
|
||||||
withMuzPos :: (Point3 -> World -> World) -> ChainEffect
|
withMuzPos :: (Point3 -> World -> World) -> ChainEffect
|
||||||
withMuzPos = withMuzPosShift (V2 0 0)
|
withMuzPos = withMuzPosShift (V2 0 0)
|
||||||
|
|
||||||
withMuzPosShift :: Point2 -> (Point3 -> World -> World) -> ChainEffect
|
withMuzPosShift :: Point2 -> (Point3 -> World -> World) -> ChainEffect
|
||||||
withMuzPosShift p g f it cr w =
|
withMuzPosShift p g f it cr = g thepos . f it cr
|
||||||
g (pos `v2z` 20) $
|
|
||||||
f it cr w
|
|
||||||
where
|
where
|
||||||
pos =
|
thepos = (_crPos cr `v2z` 20)
|
||||||
_crPos cr
|
--thepos = (pos `v2z` 20)
|
||||||
+.+ rotateV dir p
|
--pos =
|
||||||
+.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
-- _crPos cr
|
||||||
dir = _crDir cr
|
-- +.+ rotateV dir p
|
||||||
|
-- +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
||||||
|
--dir = _crDir cr
|
||||||
|
|
||||||
crAtMuzPos :: ChainEffect
|
crAtMuzPos :: ChainEffect
|
||||||
crAtMuzPos f it cr = f it (cr & crPos +.+.~ (aimingMuzzlePos cr it *.* unitVectorAtAngle (_crDir cr)))
|
--crAtMuzPos f it cr = f it (cr & crPos +.+.~ (aimingMuzzlePos cr it *.* unitVectorAtAngle (_crDir cr)))
|
||||||
|
crAtMuzPos f it cr = f it cr
|
||||||
{- | Applies the effect to a randomly rotated creature,
|
|
||||||
- rotation amount given by inaccuracy in itParams
|
|
||||||
-}
|
|
||||||
applyInaccuracy :: ChainEffect
|
|
||||||
applyInaccuracy f it = withRandomDirI acc f it
|
|
||||||
where
|
|
||||||
acc = fromMaybe 0 $ it ^? itParams . gunBarrels . ix 0 . barlInaccuracy
|
|
||||||
|
|
||||||
-- | Applies the effect to a randomly rotated creature.
|
-- | Applies the effect to a randomly rotated creature.
|
||||||
withRandomDirI ::
|
withRandomDirI ::
|
||||||
@@ -612,27 +606,6 @@ withTorqueAfter feff item cr w
|
|||||||
(rot, g) = randomR (- torque, torque) $ _randGen w
|
(rot, g) = randomR (- torque, torque) $ _randGen w
|
||||||
torque = fromMaybe 0 $ item ^? itParams . torqueAfter
|
torque = fromMaybe 0 $ item ^? itParams . torqueAfter
|
||||||
|
|
||||||
--spreadNumI :: ChainEffect
|
|
||||||
--spreadNumI eff item cr w = foldr f w dirs
|
|
||||||
-- where
|
|
||||||
-- dirs =
|
|
||||||
-- zipWith
|
|
||||||
-- (+)
|
|
||||||
-- [- spread, - spread + (2 * spread / fromIntegral numBul) .. spread]
|
|
||||||
-- (randomRs (0, spread / fromIntegral numBul) (_randGen w))
|
|
||||||
-- f dir = eff item (cr & crDir +~ dir)
|
|
||||||
-- spread = _spreadAngle . _brlSpread . _gunBarrels $ _itParams item
|
|
||||||
-- numBul = _brlNum . _gunBarrels $ _itParams item
|
|
||||||
|
|
||||||
--spreadLoaded :: ChainEffect
|
|
||||||
--spreadLoaded eff item cr w = foldr f w dirs
|
|
||||||
-- where
|
|
||||||
-- cd = 0.5 * spread * fromIntegral (numBulLoaded -1)
|
|
||||||
-- dirs = subtract cd . (spread *) . fromIntegral <$> [0 .. numBulLoaded - 1]
|
|
||||||
-- f dir = eff item (cr & crDir +~ dir)
|
|
||||||
-- spread = _spreadAngle . _brlSpread . _gunBarrels $ _itParams item
|
|
||||||
-- numBulLoaded = item ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
|
||||||
|
|
||||||
sideEffectOnFrame ::
|
sideEffectOnFrame ::
|
||||||
Int ->
|
Int ->
|
||||||
(Item -> Creature -> WdWd) ->
|
(Item -> Creature -> WdWd) ->
|
||||||
@@ -669,12 +642,19 @@ duplicateLoaded eff it cr w = foldr f w [1 .. numBul]
|
|||||||
numBul = it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
numBul = it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||||
|
|
||||||
duplicateLoadedBarrels :: ChainEffect
|
duplicateLoadedBarrels :: ChainEffect
|
||||||
duplicateLoadedBarrels eff itm cr w = foldr f w (take numbul $ itm ^?! itParams . gunBarrels)
|
duplicateLoadedBarrels eff itm cr w = foldr f w (take numbul $ itm ^?! itUse . heldAim . aimMuzzles)
|
||||||
where
|
where
|
||||||
numbul = itm ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
numbul = itm ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||||
f brl = eff itm (cr & crPos +~ _barlPos brl
|
f brl w' =
|
||||||
& crDir +~ _barlRot brl
|
eff
|
||||||
) -- worry about inaccuracy later
|
itm
|
||||||
|
( cr & crPos +~ (rotateV (_crDir cr) (_mzPos brl))
|
||||||
|
& crDir +~ (_mzRot brl + a)
|
||||||
|
)
|
||||||
|
(w' & randGen .~ g)
|
||||||
|
where
|
||||||
|
inacc = _mzInaccuracy brl
|
||||||
|
(a,g) = randomR (-inacc,inacc) $ _randGen w'
|
||||||
|
|
||||||
duplicateOffsetsFocus :: [Float] -> ChainEffect
|
duplicateOffsetsFocus :: [Float] -> ChainEffect
|
||||||
duplicateOffsetsFocus xs eff item cr w = foldr f w poss
|
duplicateOffsetsFocus xs eff item cr w = foldr f w poss
|
||||||
@@ -686,13 +666,14 @@ duplicateOffsetsFocus xs eff item cr w = foldr f w poss
|
|||||||
cr
|
cr
|
||||||
& crPos %~ (+.+ pos)
|
& crPos %~ (+.+ pos)
|
||||||
& crDir .~ thedir pos
|
& crDir .~ thedir pos
|
||||||
thedir pos
|
--thedir pos
|
||||||
| dist (mouseWorldPos (w ^. input) (w ^. wCam)) (_crPos cr) < aimingMuzzlePos cr item =
|
-- | dist (mouseWorldPos (w ^. input) (w ^. wCam)) (_crPos cr) < aimingMuzzlePos cr item =
|
||||||
argV
|
-- argV
|
||||||
( _crPos cr +.+ aimingMuzzlePos cr item *.* unitVectorAtAngle (_crDir cr)
|
-- ( _crPos cr +.+ aimingMuzzlePos cr item *.* unitVectorAtAngle (_crDir cr)
|
||||||
-.- (_crPos cr +.+ pos)
|
-- -.- (_crPos cr +.+ pos)
|
||||||
)
|
-- )
|
||||||
| otherwise = argV (mouseWorldPos (w ^. input) (w ^. wCam) -.- (_crPos cr +.+ pos))
|
-- | otherwise = argV (mouseWorldPos (w ^. input) (w ^. wCam) -.- (_crPos cr +.+ pos))
|
||||||
|
thedir pos = argV (mouseWorldPos (w ^. input) (w ^. wCam) -.- (_crPos cr +.+ pos))
|
||||||
|
|
||||||
duplicateItem :: (Item -> [Item]) -> ChainEffect
|
duplicateItem :: (Item -> [Item]) -> ChainEffect
|
||||||
duplicateItem fit eff itm cr w = foldr f w (fit itm)
|
duplicateItem fit eff itm cr w = foldr f w (fit itm)
|
||||||
@@ -704,10 +685,3 @@ duplicateOffsetsV2 xs eff item cr w = foldr f w poss
|
|||||||
where
|
where
|
||||||
poss = map (rotateV (_crDir cr)) xs
|
poss = map (rotateV (_crDir cr)) xs
|
||||||
f pos = eff item (cr & crPos +.+.~ pos)
|
f pos = eff item (cr & crPos +.+.~ pos)
|
||||||
|
|
||||||
duplicateOffsets :: [Float] -> ChainEffect
|
|
||||||
duplicateOffsets xs eff item cr w = foldr f w poss
|
|
||||||
where
|
|
||||||
poss :: [V2 Float]
|
|
||||||
poss = map (rotateV (_crDir cr) . V2 0) xs
|
|
||||||
f pos = eff item (cr & crPos +.+.~ pos)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user