Make launcherX use multiple ammo sources
This commit is contained in:
@@ -101,6 +101,7 @@ miniGunUse i =
|
||||
& heldAim . aimRange .~ 1
|
||||
& heldAim . aimStance .~ TwoHandUnder
|
||||
& heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
& heldConsumption .~ [BulletAmmo]
|
||||
|
||||
miniGunX :: Int -> Item
|
||||
miniGunX i =
|
||||
|
||||
@@ -32,7 +32,7 @@ launcher =
|
||||
-- & itUse . heldAim . aimHandlePos .~ V2 3 0
|
||||
-- & itUse . heldAim . aimMuzPos .~ 20
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0]
|
||||
& itUse . heldConsumption .~ [BulletAmmo]
|
||||
& itUse . heldConsumption .~ [ProjectileAmmo]
|
||||
& itType . iyBase .~ HELD LAUNCHER
|
||||
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
|
||||
|
||||
@@ -42,6 +42,10 @@ launcherX i =
|
||||
& itType . iyBase .~ HELD (LAUNCHERX i)
|
||||
& itUse . heldUse .~ HeldPJCreationX i
|
||||
& itUse . heldMods .~ LauncherXMod i
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) a 0 | a <- angles]
|
||||
where
|
||||
angles = take i [0,2*pi/ fromIntegral i ..]
|
||||
--angles = take i [1,2 ..]
|
||||
|
||||
remoteLauncher :: Item
|
||||
remoteLauncher =
|
||||
|
||||
@@ -22,23 +22,6 @@ import Picture
|
||||
|
||||
--import Control.Monad.State
|
||||
|
||||
--lasPulse :: Item
|
||||
--lasPulse = lasGun
|
||||
-- & itType . iyBase .~ LASPULSE
|
||||
-- & itUse . useMods .~
|
||||
-- [ ammoCheckI
|
||||
-- , withItem $ \it -> withTempLight 1 (100 * frac it) (xyzV4 (_lasColor $ _itParams it))
|
||||
-- , withItem $ \it -> withSoundForVol (frac it) tone440sawtoothquietS 2
|
||||
-- , withItemUpdate itup
|
||||
-- $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) (frac it * 0.8)
|
||||
-- , useAmmoAmount 1
|
||||
-- ]
|
||||
-- where
|
||||
-- itup it = it
|
||||
-- & itParams . lasCycle %~ (\i -> (i+1) `mod` 20)
|
||||
-- & itParams . lasDamage .~ ceiling ((22 :: Float) * frac it)
|
||||
-- & itParams . lasColor .~ frac it * orange
|
||||
-- frac it = 0.5 * (1 + sin (pi * fromIntegral (_lasCycle $ _itParams it) * 0.1))
|
||||
|
||||
--lasWidePulse :: Item
|
||||
--lasWidePulse = lasGun
|
||||
@@ -89,43 +72,10 @@ import Picture
|
||||
-- x it = [ 15 * sin (pi * fromIntegral x' * 0.05) ]
|
||||
-- where
|
||||
-- x' = _lasCycle $ _itParams it
|
||||
--lasFocus :: Int -> Item
|
||||
--lasFocus n = lasGunWide n
|
||||
-- & itType . iyBase .~ LASGUNFOCUS n
|
||||
-- & itParams . lasColor .~ red
|
||||
-- & itUse . useMods .~
|
||||
-- [ ammoCheckI
|
||||
-- , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
-- , withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
-- , withSoundForI tone440sawtoothquietS 2
|
||||
-- , useAmmoAmount 1
|
||||
-- , duplicateOffsetsFocus xs
|
||||
-- ]
|
||||
-- where
|
||||
-- n' = 9 * n
|
||||
-- xs = [ 0.25 * (fromIntegral x - fromIntegral (n'-1) /2) | x <- [0..n'-1] ]
|
||||
|
||||
--lasSwing :: Item
|
||||
--lasSwing = lasGun
|
||||
-- & itType . iyBase .~ LASGUNSWING
|
||||
-- & itParams . lasColor .~ orange
|
||||
-- & itUse . useMods .~
|
||||
-- [ ammoCheckI
|
||||
-- , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
-- , withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
-- , withSoundForI tone440sawtoothquietS 2
|
||||
-- , useAmmoAmount 1
|
||||
-- , withItemUpdate itup $ \it -> duplicateOffsetsFocus (x it)
|
||||
-- ]
|
||||
-- where
|
||||
-- itup = itParams . lasCycle %~ (\i -> (i+1) `mod` 200)
|
||||
-- x it = [-y,y]
|
||||
-- where
|
||||
-- y = 15 * sin (pi * fromIntegral x' * 0.01)
|
||||
-- x' = _lasCycle $ _itParams it
|
||||
|
||||
shootLaser :: [Item] -> Item -> Creature -> World -> World
|
||||
shootLaser ams it cr =
|
||||
shootLaser _ it cr =
|
||||
cWorld . lWorld . lasers
|
||||
.:~ lasRayAt
|
||||
(_lasColor $ _itParams it)
|
||||
|
||||
@@ -18,25 +18,6 @@ module Dodge.Item.Weapon.SonicGuns where
|
||||
----import Data.Tuple
|
||||
----import qualified IntMapHelp as IM
|
||||
--
|
||||
----sonicGun :: Item
|
||||
----sonicGun = defaultAutoGun
|
||||
---- { _itConsumption = defaultLoadable
|
||||
---- & laMax .~ 10
|
||||
---- & laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
|
||||
---- , _itParams = NoParams
|
||||
---- , _itTweaks = NoTweaks
|
||||
---- }
|
||||
---- & itDimension . dimRad .~ 10
|
||||
---- & itDimension . dimCenter .~ V3 15 0 0
|
||||
---- & itUse . useDelay . rateMax .~ 8
|
||||
---- & itUse . rUse .~ HeldSonicWave --aSonicWave
|
||||
---- & itUse . useMods .~ AmmoHammerTimeUseOneMod
|
||||
---- & itUse . useAim . aimWeight .~ 6
|
||||
---- & itUse . useAim . aimRange .~ 1
|
||||
---- & itUse . useAim . aimStance .~ TwoHandTwist
|
||||
---- & itUse . useAim . aimMuzPos .~ 25
|
||||
---- & itType . iyBase .~ HELD SONICGUN
|
||||
--
|
||||
----aSonicWave :: Item -> Creature -> World -> World
|
||||
----aSonicWave it cr = instantParticles .:~ sonicWave pos dir cpos
|
||||
---- where
|
||||
|
||||
@@ -73,7 +73,7 @@ import Dodge.Reloading
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.WorldEvent
|
||||
import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
--import qualified IntMapHelp as IM
|
||||
import LensHelp
|
||||
import RandomHelp
|
||||
import qualified SDL
|
||||
@@ -145,6 +145,9 @@ ammoCheckI :: ChainEffect
|
||||
ammoCheckI eff ams itm cr w = fromMaybe (failsound w) $ do
|
||||
x <- ams ^? ix 0 . itUse . amagLoadStatus . iaLoaded
|
||||
guard $ x > 0
|
||||
matype <- ams ^? ix 0 . itUse . amagType
|
||||
iatype <- itm ^? itUse . heldConsumption . ix 0
|
||||
guard $ matype == iatype
|
||||
return $ eff ams itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
|
||||
where
|
||||
failsound = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
|
||||
@@ -239,7 +242,7 @@ withSoundStart ::
|
||||
SoundID ->
|
||||
ChainEffect
|
||||
withSoundStart soundid f ams item cr =
|
||||
soundMultiFrom [CrWeaponSound cid 0, CrWeaponSound cid 1, CrWeaponSound cid 2] (_crPos cr) soundid Nothing
|
||||
soundMultiFrom [CrWeaponSound cid j | j <- [0..3]] (_crPos cr) soundid Nothing
|
||||
. f ams item cr
|
||||
where
|
||||
cid = _crID cr
|
||||
@@ -346,7 +349,7 @@ useAllAmmo eff ams item cr w = fromMaybe w $ do
|
||||
|
||||
useAmmoUpTo :: Int -> ChainEffect
|
||||
useAmmoUpTo amAmount eff ams itm cr = fromMaybe id $ do
|
||||
x <- ams ^? ix 0 . itUse . amagLoadStatus . iaLoaded
|
||||
_ <- ams ^? ix 0 . itUse . amagLoadStatus . iaLoaded
|
||||
invid <- ams ^? ix 0 . itLocation . ipInvID
|
||||
return $ eff ams itm cr
|
||||
. ( cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . amagLoadStatus . iaLoaded
|
||||
|
||||
Reference in New Issue
Block a user