Move shells to external magazines
This commit is contained in:
@@ -31,7 +31,8 @@ moduleModification imt = case imt of
|
||||
(itParams . lasBeam .~ BeamCombine TeslaBeamCombine)
|
||||
. (itParams . subParams ?~ teslaParams)
|
||||
WEPTELE -> makeDirectedTele
|
||||
LAUNCHHOME -> itUse . heldConsumption . laAmmoType . amPjCreation .~ CreateTrackingShell
|
||||
--LAUNCHHOME -> itUse . heldConsumption . laAmmoType . amPjCreation .~ CreateTrackingShell
|
||||
LAUNCHHOME -> id
|
||||
ATTACHTORCH -> id
|
||||
where
|
||||
makeDirectedTele it =
|
||||
|
||||
@@ -254,6 +254,8 @@ stackedInventory :: [Item]
|
||||
stackedInventory =
|
||||
[ burstRifle
|
||||
, tinMag
|
||||
, launcher
|
||||
, shellMag
|
||||
, pipe
|
||||
, scrollWatch
|
||||
, rewindWatch
|
||||
@@ -275,7 +277,6 @@ stackedInventory =
|
||||
, lasWide 20
|
||||
, flameThrower
|
||||
, poisonSprayer
|
||||
, launcher
|
||||
, bulletBeltPack
|
||||
, bulletBeltBracer
|
||||
]
|
||||
|
||||
@@ -57,7 +57,9 @@ data ItemUse
|
||||
{_attachParams :: AttachParams}
|
||||
| AmmoMagUse
|
||||
{ _amagLoadStatus :: ReloadStatus
|
||||
, _amagParams :: AmmoParams }
|
||||
, _amagParams :: AmmoParams
|
||||
, _amagType :: AmmoType
|
||||
}
|
||||
--deriving (Eq, Show, Read) --Generic, Flat)
|
||||
|
||||
data HeldParams
|
||||
@@ -75,6 +77,11 @@ data AttachParams
|
||||
| TargetAttachParams
|
||||
|
||||
data AmmoParams = BulletParams {_ampBullet :: Bullet}
|
||||
| ProjectileParams
|
||||
{ _ampPayload :: Payload
|
||||
, _ampPjDraw :: ProjectileDraw
|
||||
, _ampPjCreation :: ProjectileCreate
|
||||
}
|
||||
|
||||
data ScrollAttachParams
|
||||
= ZoomScrollParams
|
||||
|
||||
@@ -43,10 +43,6 @@ data AmmoSourceType
|
||||
|
||||
data AmmoType
|
||||
= ProjectileAmmo
|
||||
{ _amPayload :: Payload
|
||||
, _amPjDraw :: ProjectileDraw
|
||||
, _amPjCreation :: ProjectileCreate
|
||||
}
|
||||
| SmallBulletAmmo
|
||||
| LargeBulletAmmo
|
||||
| DroneAmmo
|
||||
|
||||
+16
-5
@@ -402,16 +402,24 @@ useHeld hu = case hu of
|
||||
HeldExplodeRemoteShell itid pjid -> const $ const $ explodeRemoteRocket itid pjid
|
||||
|
||||
usePjCreation :: Item -> Creature -> World -> World
|
||||
usePjCreation it = createProjectile (_amPjCreation (_laAmmoType (_heldConsumption (_itUse it)))) it
|
||||
usePjCreation itm cr = createProjectile apm itm cr
|
||||
where
|
||||
apm = fromMaybe (error "cannot find shell ammo projectile") $ do
|
||||
invid <- itm ^? itLocation . ipInvID
|
||||
cr ^? crInv . ix (invid + 1) . itUse . amagParams
|
||||
|
||||
|
||||
usePjCreationX :: Int -> Item -> Creature -> World -> World
|
||||
usePjCreationX i it cr =
|
||||
usePjCreationX i itm cr =
|
||||
foldr
|
||||
f
|
||||
(createProjectile (_amPjCreation (_laAmmoType (_heldConsumption (_itUse it)))) it cr)
|
||||
(createProjectile apm itm cr)
|
||||
[1 .. i -1]
|
||||
where
|
||||
f n = (. createProjectile (_amPjCreation (_laAmmoType (_heldConsumption (_itUse it)))) it (cr & crDir +~ (2 * pi * fromIntegral n / fromIntegral i)))
|
||||
apm = fromMaybe (error "cannot find shell ammo projectile") $ do
|
||||
invid <- itm ^? itLocation . ipInvID
|
||||
cr ^? crInv . ix (invid + 1) . itUse . amagParams
|
||||
f n = (. createProjectile apm itm (cr & crDir +~ (2 * pi * fromIntegral n / fromIntegral i)))
|
||||
|
||||
overNozzles ::
|
||||
(Nozzle -> Item -> Creature -> World -> World) ->
|
||||
@@ -473,8 +481,11 @@ fireRemoteShell it cr w =
|
||||
itid = _itID it
|
||||
i = IM.newKey $ w ^. cWorld . lWorld . props
|
||||
cid = _crID cr
|
||||
apm = fromMaybe (error "cannot find shell ammo projectile") $ do
|
||||
invid <- it ^? itLocation . ipInvID
|
||||
cr ^? crInv . ix (invid + 1) . itUse . amagParams
|
||||
addRemRocket =
|
||||
makeShell
|
||||
makeShell apm
|
||||
it
|
||||
cr
|
||||
[ PJRemoteShellCollisionCheck
|
||||
|
||||
@@ -14,6 +14,7 @@ tinMag =
|
||||
& itUse
|
||||
.~ AmmoMagUse
|
||||
{ _amagParams = BulletParams defaultBullet
|
||||
, _amagType = SmallBulletAmmo
|
||||
, _amagLoadStatus =
|
||||
ReloadStatus
|
||||
{ _iaMax = 15
|
||||
@@ -47,9 +48,33 @@ beltMag =
|
||||
shellMag :: Item
|
||||
shellMag =
|
||||
defaultHeldItem & itType . iyBase .~ AMMOMAG SHELLMAG
|
||||
& itUse
|
||||
.~ AmmoMagUse
|
||||
{ _amagParams = ProjectileParams
|
||||
{ _ampPayload = ExplosionPayload
|
||||
, _ampPjDraw = DrawShell
|
||||
, _ampPjCreation = CreateShell
|
||||
}
|
||||
, _amagLoadStatus =
|
||||
ReloadStatus
|
||||
{ _iaMax = 15
|
||||
, _iaLoaded = 15
|
||||
, _iaPrimed = True
|
||||
, _iaCycle = [loadEject 10, loadInsert 10, loadPrime 10]
|
||||
, _iaProgress = Nothing
|
||||
}
|
||||
, _amagType = ProjectileAmmo
|
||||
}
|
||||
|
||||
smallBattery :: Item
|
||||
smallBattery =
|
||||
defaultHeldItem & itType . iyBase .~ AMMOMAG TINMAG
|
||||
& itType . iyModules . at ModBulletPayload ?~ EMPTYMODULE
|
||||
& itType . iyModules . at ModBulletTrajectory ?~ EMPTYMODULE
|
||||
& itUse
|
||||
.~ AmmoMagUse
|
||||
{ _amagParams = BulletParams defaultBullet
|
||||
, _amagType = SmallBulletAmmo
|
||||
, _amagLoadStatus =
|
||||
ReloadStatus
|
||||
{ _iaMax = 15
|
||||
|
||||
@@ -34,10 +34,6 @@ launcher =
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0]
|
||||
& itUse . heldConsumption . laAmmoType
|
||||
.~ ProjectileAmmo
|
||||
{ _amPayload = ExplosionPayload
|
||||
, _amPjDraw = DrawShell
|
||||
, _amPjCreation = CreateShell
|
||||
}
|
||||
& itType . iyBase .~ HELD LAUNCHER
|
||||
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
|
||||
|
||||
@@ -54,7 +50,7 @@ remoteLauncher =
|
||||
& itType . iyBase .~ HELD REMOTELAUNCHER
|
||||
& itUse . heldUse .~ HeldFireRemoteShell --fireRemoteShell
|
||||
& itScope .~ RemoteScope (V2 0 0) 1
|
||||
& itUse . heldConsumption . laAmmoType . amPjDraw .~ DrawRemoteShell
|
||||
-- & itUse . heldConsumption . laAmmoType . amPjDraw .~ DrawRemoteShell
|
||||
|
||||
basicAmPjMoves :: IM.IntMap TweakParam
|
||||
basicAmPjMoves =
|
||||
|
||||
@@ -4,15 +4,19 @@ import Dodge.Data.World
|
||||
import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
import LensHelp
|
||||
--import Data.Maybe
|
||||
|
||||
createProjectile :: ProjectileCreate -> Item -> Creature -> World -> World
|
||||
createProjectile pt = case pt of
|
||||
CreateShell -> fireShell
|
||||
CreateTrackingShell -> fireTrackingShell
|
||||
createProjectile :: AmmoParams -> Item -> Creature -> World -> World
|
||||
createProjectile apm itm cr = case pt of
|
||||
CreateShell -> fireShell apm itm cr
|
||||
CreateTrackingShell -> fireTrackingShell apm itm cr
|
||||
where
|
||||
pt = _ampPjCreation apm
|
||||
|
||||
fireShell :: Item -> Creature -> World -> World
|
||||
fireShell it cr =
|
||||
fireShell :: AmmoParams -> Item -> Creature -> World -> World
|
||||
fireShell ap it cr =
|
||||
makeShell
|
||||
ap
|
||||
it
|
||||
cr
|
||||
[ PJShellCollisionCheck
|
||||
@@ -27,8 +31,8 @@ fireShell it cr =
|
||||
spinamount = _shellSpinAmount params
|
||||
thrustdelay = _shellThrustDelay params
|
||||
|
||||
makeShell :: Item -> Creature -> [ProjectileUpdate] -> World -> World
|
||||
makeShell it cr theupdate w =
|
||||
makeShell :: AmmoParams -> Item -> Creature -> [ProjectileUpdate] -> World -> World
|
||||
makeShell ap it cr theupdate w =
|
||||
w & cWorld . lWorld . projectiles . at i
|
||||
?~ Shell
|
||||
{ _prjPos = pos
|
||||
@@ -40,7 +44,7 @@ makeShell it cr theupdate w =
|
||||
, _prjAcc = rotateV dir (V2 3 0)
|
||||
, _prjDir = dir
|
||||
, _prjSpin = 0
|
||||
, _prjPayload = _amPayload $ _laAmmoType am
|
||||
, _prjPayload = _ampPayload ap
|
||||
, _prjTimer = 350
|
||||
, _prjUpdates = theupdate
|
||||
, _prjMITID = Just $ _itID it
|
||||
@@ -49,11 +53,12 @@ makeShell it cr theupdate w =
|
||||
i = IM.newKey $ w ^. cWorld . lWorld . props-- _props (_cWorld w)
|
||||
dir = _crDir cr
|
||||
pos = _crPos cr +.+ rotateV dir (V2 (_crRad cr + 1) 0)
|
||||
am = _heldConsumption $ _itUse it
|
||||
--am = _heldConsumption $ _itUse it
|
||||
|
||||
fireTrackingShell :: Item -> Creature -> World -> World
|
||||
fireTrackingShell it cr =
|
||||
fireTrackingShell :: AmmoParams -> Item -> Creature -> World -> World
|
||||
fireTrackingShell ap it cr =
|
||||
makeShell
|
||||
ap
|
||||
it
|
||||
cr
|
||||
[ PJRemoteShellCollisionCheck
|
||||
|
||||
Reference in New Issue
Block a user