Move towards adding in pulse laser "rifle" (like UT shock rifle)
This commit is contained in:
+35
-3
@@ -8,11 +8,11 @@ module Dodge.HeldUse (
|
||||
heldEffectMuzzles,
|
||||
) where
|
||||
|
||||
import Dodge.PulseLaser
|
||||
import qualified IntMapHelp as IM
|
||||
import Dodge.IsPulseLaser
|
||||
import Color
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import Data.Maybe
|
||||
import Dodge.Base
|
||||
import Dodge.BaseTriggerType
|
||||
@@ -53,8 +53,12 @@ gadgetEffect pt loc
|
||||
| CLICKER x <- loc ^. locDT . dtValue . _1 . itType
|
||||
, Just i <- loc ^? locDT . dtValue . _1 . itUse . uInt =
|
||||
useInventoryPath pt i x loc
|
||||
| PulseBallSF <- loc ^. locDT . dtValue . _2 = \cr
|
||||
-> creatureShootPulseBall loc cr cmuz
|
||||
| otherwise = const id
|
||||
|
||||
cmuz = Muzzle (V2 15 0) 0 0.01 0 BasicFlare MuzzleShootBullet (UseExactly 1) 0
|
||||
|
||||
heldEffect :: PressType -> LocationDT OItem -> Creature -> World -> World
|
||||
heldEffect = hammerCheck heldEffectMuzzles
|
||||
|
||||
@@ -731,7 +735,7 @@ useLoadedAmmo loc cr (_, w) (Just (mz, x, magtree)) = (,) True $
|
||||
removeAmmoFromMag x mid cr . makeMuzzleFlare mz loc cr $ case _mzEffect mz of
|
||||
MuzzleShootBullet -> shootBullets loc cr (mz, x, magtree) w
|
||||
MuzzleLaser -> creatureShootLaser loc cr mz w
|
||||
MuzzlePulseLaser -> creatureShootPulseLaser loc cr mz w
|
||||
MuzzlePulseLaser -> creatureShootPulseBall loc cr mz w
|
||||
MuzzleTesla -> shootTeslaArc loc cr mz w
|
||||
MuzzleTractor -> shootTractorBeam cr w
|
||||
MuzzleRLauncher -> createProjectileR loc magtree mz cr w
|
||||
@@ -900,6 +904,34 @@ shootPulseLaser so p dir w =
|
||||
}
|
||||
& soundContinue so p tone440sawtoothquietS (Just 2)
|
||||
|
||||
creatureShootPulseBall :: LocationDT OItem -> Creature -> Muzzle -> World -> World
|
||||
creatureShootPulseBall loc cr mz w = w & randGen .~ g & shootPulseBall pos dir
|
||||
where
|
||||
(V3 x y _, q) =
|
||||
locOrient loc cr
|
||||
`Q.comp` ((_mzPos mz + V2 0 offset) `v2z` 0, Q.axisAngle (V3 0 0 1) (_mzRot mz))
|
||||
pos = _crPos cr + rotateV (_crDir cr) (V2 x y)
|
||||
dir = _crDir cr + Q.qToAng q + a
|
||||
(a, g) = randomR (- inacc, inacc) $ _randGen w
|
||||
inacc = _mzInaccuracy mz
|
||||
offset = case mz ^. mzRandomOffset of
|
||||
0 -> 0
|
||||
i -> fst . randomR (- i, i) $ _randGen w
|
||||
|
||||
shootPulseBall :: Point2 -> Float -> World -> World
|
||||
shootPulseBall p dir w =
|
||||
w
|
||||
& cWorld . lWorld . pulseBalls . at i ?~
|
||||
PulseBall
|
||||
{ _pbPos = p
|
||||
, _pbVel = 5 * unitVectorAtAngle dir
|
||||
, _pbTimer = 50
|
||||
, _pbID = i
|
||||
}
|
||||
& soundStart (PBSound i) p energyReleaseS Nothing
|
||||
where
|
||||
i = IM.newKey $ w ^. cWorld . lWorld . pulseBalls
|
||||
|
||||
removeAmmoFromMag :: Int -> Maybe Int -> Creature -> World -> World
|
||||
removeAmmoFromMag x mid cr = fromMaybe id $ do
|
||||
magid <- mid
|
||||
|
||||
Reference in New Issue
Block a user