Move bullet modifications from weapons to magazines

This commit is contained in:
2024-06-22 10:40:11 +01:00
parent a3eca3a674
commit a9ac974a2c
18 changed files with 254 additions and 277 deletions
+10 -1
View File
@@ -1 +1,10 @@
All good (615 modules, at 00:01:24)
/home/justin/Haskell/loop/src/Dodge/Bullet.hs:75:5-11: warning: [-Wunused-local-binds]
Defined but not used: bultype
|
75 | bultype = _laAmmoType $ _heldConsumption $ _itUse it
| ^^^^^^^
/home/justin/Haskell/loop/src/Dodge/HeldUse.hs:371:14: warning: [-Wunused-matches]
Defined but not used: x
|
371 | moddelay x = id
| ^
+1 -1
View File
File diff suppressed because one or more lines are too long
+5 -3
View File
@@ -59,9 +59,11 @@ updateBulVel bt = case _buTrajectory bt of
-- should be made safe?
-- should be renamed to shootBullet or something
useAmmoParams :: Item -> Creature -> World -> World
useAmmoParams it cr w =
w & cWorld . lWorld . instantBullets
.:~ ( _amBullet bultype
useAmmoParams it cr w = fromMaybe (error "cannot find bullet ammo when expected to") $ do
invid <- it ^? itLocation . ipInvID
thebullet <- cr ^? crInv . ix (invid + 1) . itUse . attachParams . ammoParams . ampBullet
return $ w & cWorld . lWorld . instantBullets
.:~ ( thebullet
& buPos .~ _crPos cr
& buTrajectory %~ settrajectory
& buVel %~ (rotateV dir . (muzvel *.*))
+9 -1
View File
@@ -158,7 +158,7 @@ moduleCombinations =
)
,
( ModBulletPayload
, bulletWeapons
, bulletMagazines
,
[ amod [cr (ENERGYBALLCRAFT x)] (BULPAY (BulBall x)) | x <- [minBound ..]
] ++
@@ -229,6 +229,14 @@ batteryGuns =
teleportableWeapons :: [Item]
teleportableWeapons = bulletWeapons ++ batteryGuns ++ homingLaunchers
bulletMagazines :: [Item]
bulletMagazines =
[tinMag
,revolveMag
,drumMag
,beltMag
]
bulletWeapons :: [Item]
bulletWeapons =
[bangStick i | i <- [1 .. 9]]
+8 -8
View File
@@ -12,19 +12,19 @@ moduleModification imt = case imt of
EMPTYMODULE -> id
-- BELTMAG -> itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 150
MAGNETMAG -> itUse . heldDelay . rateMax .~ 4
BULPAY BulFlak -> (itUse . heldConsumption . laAmmoType . amBullet . buSpawn .~ BulFlak)
. (itUse . heldConsumption . laAmmoType . amBullet . buTimer .~ 3)
BULPAY thepayload -> itUse . heldConsumption . laAmmoType . amBullet . buSpawn .~ thepayload
BULBODY thebody -> itUse . heldConsumption . laAmmoType . amBullet . buEffect .~ thebody
BULPAY BulFlak -> (itUse . attachParams . ammoParams . ampBullet . buSpawn .~ BulFlak)
. (itUse . attachParams . ammoParams . ampBullet . buTimer .~ 3)
BULPAY thepayload -> itUse . attachParams . ammoParams . ampBullet . buSpawn .~ thepayload
BULBODY thebody -> itUse . attachParams . ammoParams . ampBullet . buEffect .~ thebody
TARGET {} -> id -- itUse . useTargeting ?~ t
BULTRAJ BasicBulletTrajectoryType -> id
BULTRAJ MagnetTrajectoryType ->
(itUse . heldConsumption . laAmmoType . amBullet . buTrajectory .~ MagnetTrajectory 0)
. (itUse . heldConsumption . laAmmoType . amBullet . buVel .~ V2 10 0)
(itUse . attachParams . ammoParams . ampBullet . buTrajectory .~ MagnetTrajectory 0)
. (itUse . attachParams . ammoParams . ampBullet . buVel .~ V2 10 0)
BULTRAJ FlechetteTrajectoryType ->
itUse . heldConsumption . laAmmoType . amBullet . buTrajectory .~ FlechetteTrajectory 0
itUse . attachParams . ammoParams . ampBullet . buTrajectory .~ FlechetteTrajectory 0
BULTRAJ BezierTrajectoryType ->
itUse . heldConsumption . laAmmoType . amBullet . buTrajectory .~ BezierTrajectory 0 0 0
itUse . attachParams . ammoParams . ampBullet . buTrajectory .~ BezierTrajectory 0 0 0
INCENDLAS -> itParams . lasBeam .~ BeamCombine FlameBeamCombine
SPLITLAS -> itParams . lasBeam .~ BeamCombine SplitBeamCombine
STATICLAS ->
-1
View File
@@ -44,7 +44,6 @@ data ItemParams
, _dbGap :: Float
}
| Attracting {_attractionPower :: Point2}
| BulletShooter
| Sprayer {_sprayNozzles :: [Nozzle]}
| AngleWalk
{ _maxWalkAngle :: Float
+1 -9
View File
@@ -75,15 +75,7 @@ data AttachParams
}
| TargetAttachParams
data AmmoParams = DefaultAmmoParams
| BulletParams
{ _bupEffect :: BulletEffect
, _bupSpawn :: BulletSpawn
, _bupDrag :: Float
, _bupWidth :: Float
, _bupTimer :: Int
, _bupDamages :: [Damage]
}
data AmmoParams = BulletParams {_ampBullet :: Bullet}
data ScrollAttachParams
= ZoomScrollParams
+3 -8
View File
@@ -44,19 +44,14 @@ data AmmoSourceType
data AmmoType
= ProjectileAmmo
{ _amPayload :: Payload
, _amString :: String
, _amPjDraw :: ProjectileDraw
, _amPjCreation :: ProjectileCreate
}
| BulletAmmo
{ _amString :: String
, _amBullet :: Bullet
}
| SmallBulletAmmo
| LargeBulletAmmo
| DroneAmmo
{_amString :: String}
| GasAmmo
{ _amString :: String
, _amCreateGas :: GasCreate
{ _amCreateGas :: GasCreate
}
| ForceFieldAmmo
{ _amForceFieldType :: ForceFieldType
+2 -2
View File
@@ -47,8 +47,8 @@ defaultBulletWeapon =
& itUse . heldConsumption .~ defaultBulletLoadable
& itUse . heldUse .~ HeldUseAmmoParams -- useAmmoParams
& itType . iyModules . at ModBulletCollision ?~ EMPTYMODULE
& itType . iyModules . at ModBulletPayload ?~ EMPTYMODULE
& itType . iyModules . at ModBulletTrajectory ?~ EMPTYMODULE
-- & itType . iyModules . at ModBulletPayload ?~ EMPTYMODULE
-- & itType . iyModules . at ModBulletTrajectory ?~ EMPTYMODULE
defaultWeapon :: Item
defaultWeapon =
+6 -4
View File
@@ -368,7 +368,8 @@ useMod hm = case hm of
where
p = fromMaybe (_crPos cr) $ cr ^? crTargeting . ctPos . _Just
a = argV (mouseWorldPos (w ^. input) (w ^. wCam) -.- p)
moddelay x = itUse . heldConsumption . laAmmoType . amBullet . buDelayFraction .~ x
moddelay x = id
--moddelay x = itUse . heldConsumption . laAmmoType . amBullet . buDelayFraction .~ x
modcrpos x cr =
cr & crDir %~ tweenAngles x (_crOldDir cr)
& crPos %~ alongSegBy x (_crOldPos cr)
@@ -493,9 +494,10 @@ bangStickSoundChoice :: Item -> SoundID
bangStickSoundChoice = caneStickSoundChoice
coneRandItemUpdate :: State StdGen (Item -> Item)
coneRandItemUpdate = do
wth <- state $ randomR (1, 5)
return (itUse . heldConsumption . laAmmoType . amBullet . buWidth .~ wth)
coneRandItemUpdate = return id
-- do
-- wth <- state $ randomR (1, 5)
-- return (itUse . heldConsumption . laAmmoType . amBullet . buWidth .~ wth)
coneRandItemParams :: State StdGen (Item -> Item)
coneRandItemParams = do
+11 -19
View File
@@ -1,37 +1,22 @@
module Dodge.Item.Ammo where
import Dodge.Item.Weapon.Bullet
import Control.Lens
import Dodge.Data.World
import Dodge.Default.Item
import Dodge.Reloading.Action
revolveMag :: Item
revolveMag =
defaultHeldItem & itType . iyBase .~ ATTACH (AMMOATTACH REVOLVEMAG)
& itUse
.~ AttachUse
{ _attachParams =
AmmoAttachParams
{ _ammoParams = DefaultAmmoParams
, _ammoLoadStatus =
InternalAmmo
{ _iaMax = 6
, _iaLoaded = 6
, _iaPrimed = True
, _iaCycle = [loadPartialInsert 10 1]
, _iaProgress = Nothing
}
}
}
tinMag :: Item
tinMag =
defaultHeldItem & itType . iyBase .~ ATTACH (AMMOATTACH TINMAG)
& itType . iyModules . at ModBulletPayload ?~ EMPTYMODULE
& itType . iyModules . at ModBulletTrajectory ?~ EMPTYMODULE
& itUse
.~ AttachUse
{ _attachParams =
AmmoAttachParams
{ _ammoParams = DefaultAmmoParams
{ _ammoParams = BulletParams defaultBullet
, _ammoLoadStatus =
InternalAmmo
{ _iaMax = 15
@@ -43,6 +28,13 @@ tinMag =
}
}
revolveMag :: Item
revolveMag = tinMag
& itType . iyBase .~ ATTACH (AMMOATTACH REVOLVEMAG)
& itUse . attachParams . ammoLoadStatus . iaMax .~ 6
& itUse . attachParams . ammoLoadStatus . iaLoaded .~ 6
& itUse . attachParams . ammoLoadStatus . iaCycle .~ [loadPartialInsert 10 1]
drumMag :: Item
drumMag =
tinMag & itType . iyBase .~ ATTACH (AMMOATTACH DRUMMAG)
-3
View File
@@ -10,9 +10,6 @@ import Linear
bangCone :: Item
bangCone =
defaultBulletWeapon
{ _itParams =
BulletShooter
}
& itDimension . dimRad .~ 8
& itDimension . dimCenter .~ V3 5 0 0
& itUse . heldDelay . rateMax .~ 20
-1
View File
@@ -35,7 +35,6 @@ launcher =
& itUse . heldConsumption . laAmmoType
.~ ProjectileAmmo
{ _amPayload = ExplosionPayload
, _amString = "EXPLOSIVE SHELL"
, _amPjDraw = DrawShell
, _amPjCreation = CreateShell
}
+2 -2
View File
@@ -9,7 +9,7 @@ module Dodge.Item.Held.Rod (
import Dodge.Data.Item
import Dodge.Default
import Dodge.Item.Weapon.Bullet
--import Dodge.Item.Weapon.Bullet
--import Dodge.Reloading.Action
import Geometry
import LensHelp
@@ -36,7 +36,7 @@ bangRod =
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
-- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0.1]
& itUse . heldConsumption . laAmmoType .~ hvBulletAmmo
-- & itUse . heldConsumption . laAmmoType .~ hvBulletAmmo
elephantGun :: Item
elephantGun =
+2 -4
View File
@@ -19,8 +19,7 @@ poisonSprayer =
& itType . iyBase .~ HELD POISONSPRAYER
& itUse . heldConsumption . laAmmoType
.~ GasAmmo
{ _amString = "POISONGAS"
, _amCreateGas = CreatePoisonGas --aGasCloud
{ _amCreateGas = CreatePoisonGas --aGasCloud
}
& itUse . heldMods .~ PoisonSprayerMod
@@ -96,8 +95,7 @@ flameThrower =
.~ ( defaultLoadable
& laAmmoType
.~ GasAmmo
{ _amString = "FLAME"
, _amCreateGas = CreateFlame --aFlame
{ _amCreateGas = CreateFlame --aFlame
}
)
& itType . iyBase .~ HELD FLAMETHROWER
+4 -12
View File
@@ -9,11 +9,8 @@ import Control.Lens
import Geometry.Data
basicBulletAmmo :: AmmoType
basicBulletAmmo =
BulletAmmo
{ _amString = "BASIC"
, _amBullet = defaultBullet
}
basicBulletAmmo = SmallBulletAmmo
-- , _amBullet = defaultBullet
defaultBullet :: Bullet
defaultBullet =
@@ -36,16 +33,11 @@ basicBulDams =
[ Damage PIERCING 100 0 0 0 $ PushBackDamage 2
]
hvBulletAmmo :: AmmoType
hvBulletAmmo =
BulletAmmo
{ _amString = "HVBULLET"
, _amBullet =
defaultBullet
hvBulletAmmo :: Bullet
hvBulletAmmo = defaultBullet
& buWidth .~ 6
& buVel .~ V2 80 0
& buDamages .~ heavyBulDams
}
heavyBulDams :: [Damage]
heavyBulDams =
+1 -1
View File
@@ -16,7 +16,7 @@ droneLauncher =
& itUse . heldAim . aimWeight .~ 8
& itUse . heldAim . aimRange .~ 0.5
& itUse . heldAim . aimStance .~ TwoHandOver
& itUse . heldConsumption . laAmmoType .~ DroneAmmo{_amString = "LASDRONE"}
& itUse . heldConsumption . laAmmoType .~ DroneAmmo
& itType . iyBase .~ HELD DRONELAUNCHER
lasDronesPic :: Item -> SPic
+189 -197
View File
File diff suppressed because it is too large Load Diff