Move around ammo source checks

This commit is contained in:
2024-06-22 16:23:34 +01:00
parent 25cecb8ea6
commit c723d1b1e1
25 changed files with 218 additions and 263 deletions
+2 -2
View File
@@ -99,10 +99,10 @@ itemCombinations =
, po [cr MICROCHIP, cr TRANSMITTER, cr LIGHTSENSOR] (autoDetector ITEMDETECTOR)
, po [cr MICROCHIP, cr TRANSMITTER, cr SOUNDSENSOR] (autoDetector WALLDETECTOR)
, po [cr MICROCHIP, cr TRANSMITTER, cr HEATSENSOR] (autoDetector CREATUREDETECTOR)
, po [cr BATTERY, cr LED] torch
, po [AMMOMAG BATTERY, cr LED] torch
, po [hd TORCH, eq HAT] headLamp
, po [cr LIGHTER, cr THERMOMETER, cr MICROCHIP] (energyBallCraft IncBall)
, po [cr TRANSFORMER, cr BATTERY, cr MICROCHIP] (energyBallCraft TeslaBall)
, po [cr TRANSFORMER, AMMOMAG BATTERY, cr MICROCHIP] (energyBallCraft TeslaBall)
]
++ map (\i -> po [HELD (LASWIDE i), cr TRANSFORMER] $ lasWide (i + 1)) [2 .. 9]
++ map (\i -> po [cr PIPE, HELD (BANGSTICK i)] $ bangStick (i + 1)) [1 .. 8]
+1 -1
View File
@@ -64,7 +64,6 @@ data CraftType
| THERMOMETER
| CREATURESENSOR
| WIRE
| BATTERY
| FUELCELL
| PORTABLEFUSION
| FRAGMODULE
@@ -112,6 +111,7 @@ data AmmoMagType
| DRUMMAG
| BELTMAG
| SHELLMAG
| BATTERY
deriving (Eq, Ord, Show, Read)
+2 -2
View File
@@ -5,7 +5,7 @@
module Dodge.Data.Item.HeldUse where
import Dodge.Data.Item.Use.Consumption.Ammo
--import Dodge.Data.Item.Use.Consumption.Ammo
import Data.Aeson
import Data.Aeson.TH
import Dodge.Data.CamouflageStatus
@@ -49,7 +49,7 @@ data Euse
| EAmmoSource
{ _euseAmmoAmount :: Int
, _euseAmmoMax :: Int
, _euseAmmoSourceType :: AmmoSourceType
-- , _euseAmmoSourceType :: AmmoSourceType
, _euseAmmoLink :: Maybe Int
}
deriving (Eq, Ord, Show, Read) --Generic, Flat)
+4 -1
View File
@@ -32,7 +32,7 @@ data ItemUse
, _heldMods :: HeldMod
, _heldHammer :: HammerPosition
, _heldAim :: AimParams
, _heldConsumption :: HeldConsumption
, _heldConsumption :: [AmmoType]
, _heldParams :: HeldParams
-- , _useTargeting :: Maybe TargetType
}
@@ -64,6 +64,8 @@ data ItemUse
data HeldParams
= DefaultHeldParams
| GasSprayParams
{_gasCreation :: GasCreate}
| BulletShooterParams
{ _muzVel :: Float
, _rifling :: Float
@@ -82,6 +84,7 @@ data AmmoParams = BulletParams {_ampBullet :: Bullet}
, _ampPjDraw :: ProjectileDraw
, _ampPjCreation :: ProjectileCreate
}
| GasParams {_ampCreateGas :: GasCreate}
data ScrollAttachParams
= ZoomScrollParams
-10
View File
@@ -17,14 +17,6 @@ import Data.Aeson.TH
import Dodge.Data.Item.Use.Consumption.Ammo
import Dodge.Data.Item.Use.Consumption.LoadAction
data HeldConsumption
= LoadableAmmo
{ _laAmmoType :: AmmoType
, _laSourceType :: AmmoSourceType
}
| NoConsumption
deriving (Eq, Show, Read) --Generic, Flat)
data ReloadStatus = ReloadStatus
{ _iaMax :: Int
, _iaLoaded :: Int
@@ -54,11 +46,9 @@ newtype ItAmount = ItAmount {_getItAmount :: Int}
-- deriving stock (Generic)
-- deriving anyclass (Flat)
makeLenses ''HeldConsumption
makeLenses ''LeftConsumption
makeLenses ''ItAmount
makeLenses ''ReloadStatus
deriveJSON defaultOptions ''ReloadStatus
deriveJSON defaultOptions ''HeldConsumption
deriveJSON defaultOptions ''LeftConsumption
deriveJSON defaultOptions ''ItAmount
+2 -16
View File
@@ -34,25 +34,12 @@ data ProjectileUpdate
| PJRemoteShellCollisionCheck
deriving (Show, Eq, Ord, Read) --Generic, Flat)
data AmmoSourceType
= BulletSource
| ChargeSource
| ChemfuelSource
| BombSource
deriving (Eq, Ord, Show, Read) --Generic, Flat)
data AmmoType
= ProjectileAmmo
| SmallBulletAmmo
| LargeBulletAmmo
| BulletAmmo
| ElectricalAmmo
| DroneAmmo
| GasAmmo
{ _amCreateGas :: GasCreate
}
| ForceFieldAmmo
{ _amForceFieldType :: ForceFieldType
}
| GenericAmmo
deriving (Eq, Ord, Show, Read) --Generic, Flat)
data ForceFieldType = DefaultForceField
@@ -69,4 +56,3 @@ deriveJSON defaultOptions ''ProjectileUpdate
deriveJSON defaultOptions ''GasCreate
deriveJSON defaultOptions ''ForceFieldType
deriveJSON defaultOptions ''AmmoType
deriveJSON defaultOptions ''AmmoSourceType
+1 -1
View File
@@ -44,7 +44,7 @@ defaultCraftItem = defaultHeldItem & itUse .~ CraftUse 1
defaultBulletWeapon :: Item
defaultBulletWeapon =
defaultWeapon
& itUse . heldConsumption .~ defaultBulletLoadable
& itUse . heldConsumption .~ [BulletAmmo]
& itUse . heldUse .~ HeldUseAmmoParams -- useAmmoParams
& itType . iyModules . at ModBulletCollision ?~ EMPTYMODULE
-- & itType . iyModules . at ModBulletPayload ?~ EMPTYMODULE
+1 -1
View File
@@ -34,7 +34,7 @@ defaultHeldUse =
, _heldMods = HeldModNothing
, _heldHammer = HammerUp
, _heldAim = defaultAimParams
, _heldConsumption = defaultLoadable
, _heldConsumption = []
, _heldParams = BulletShooterParams
{ _muzVel = 0.8
, _rifling = 0.8
+2 -12
View File
@@ -1,19 +1,9 @@
module Dodge.Default.Item.Use.Consumption where
import Control.Lens
--import Control.Lens
import Dodge.Data.Item.Use.Consumption
import Dodge.Item.Weapon.Bullet
--import Dodge.Item.Weapon.Bullet
--import Dodge.Reloading.Action
defaultLoadable :: HeldConsumption
defaultLoadable =
LoadableAmmo
{ _laAmmoType = GenericAmmo
, _laSourceType = BulletSource
}
defaultBulletLoadable :: HeldConsumption
defaultBulletLoadable = defaultLoadable & laAmmoType .~ basicBulletAmmo
defaultLeftLoadable :: LeftConsumption
defaultLeftLoadable = AutoRecharging 10 10 100 100
+11 -1
View File
@@ -459,15 +459,25 @@ overNozzle eff it cr w nz =
maxa = _nzMaxWalkAngle nz
wa = min maxa $ max (negate maxa) (_nzCurrentWalkAngle nz + walkamount)
getAmmoMagazine :: Item -> Creature -> Maybe ItemUse
getAmmoMagazine itm cr = do
invid <- itm ^? itLocation . ipInvID
amtype <- itm ^? itUse . heldConsumption . ix 0
mag <- cr ^? crInv . ix (invid + 1) . itUse
magtype <- mag ^? amagType
guard $ amtype == magtype
return mag
useGasParams :: Nozzle -> Item -> Creature -> World -> World
useGasParams nz it cr =
createGas
(_amCreateGas (_laAmmoType (_heldConsumption (_itUse it))))
(_ampCreateGas (_amagParams amag))
(_nzPressure nz)
pos
dir
cr
where
amag = fromMaybe (error "cannot find gas ammo") $ getAmmoMagazine it cr
dir = _crDir cr
pos = _crPos cr +.+ (_nzLength nz *.* unitVectorAtAngle (_crDir cr))
+1
View File
@@ -33,6 +33,7 @@ itemFromAmmoMag at = case at of
REVOLVEMAG -> revolveMag
BELTMAG -> beltMag
SHELLMAG -> shellMag
BATTERY -> battery
itemFromAttachType :: AttachType -> Item
itemFromAttachType at = case at of
+9 -11
View File
@@ -14,7 +14,7 @@ tinMag =
& itUse
.~ AmmoMagUse
{ _amagParams = BulletParams defaultBullet
, _amagType = SmallBulletAmmo
, _amagType = BulletAmmo
, _amagLoadStatus =
ReloadStatus
{ _iaMax = 15
@@ -57,8 +57,8 @@ shellMag =
}
, _amagLoadStatus =
ReloadStatus
{ _iaMax = 15
, _iaLoaded = 15
{ _iaMax = 1
, _iaLoaded = 1
, _iaPrimed = True
, _iaCycle = [loadEject 10, loadInsert 10, loadPrime 10]
, _iaProgress = Nothing
@@ -66,19 +66,17 @@ shellMag =
, _amagType = ProjectileAmmo
}
smallBattery :: Item
smallBattery =
defaultHeldItem & itType . iyBase .~ AMMOMAG TINMAG
& itType . iyModules . at ModBulletPayload ?~ EMPTYMODULE
& itType . iyModules . at ModBulletTrajectory ?~ EMPTYMODULE
battery :: Item
battery =
defaultHeldItem & itType . iyBase .~ AMMOMAG BATTERY
& itUse
.~ AmmoMagUse
{ _amagParams = BulletParams defaultBullet
, _amagType = SmallBulletAmmo
, _amagType = ElectricalAmmo
, _amagLoadStatus =
ReloadStatus
{ _iaMax = 15
, _iaLoaded = 15
{ _iaMax = 100
, _iaLoaded = 100
, _iaPrimed = True
, _iaCycle = [loadEject 10, loadInsert 10, loadPrime 10]
, _iaProgress = Nothing
+4 -2
View File
@@ -77,7 +77,8 @@ bulletBeltPack =
& itUse . equipEffect . eeSite .~ GoesOnBack
& itType . iyBase .~ EQUIP BULLETBELTPACK
& itUse . equipEffect . eeAttachPos .~ V3 (-9) 0 10
& itUse . equipEffect . eeUse .~ EAmmoSource 2000 2000 BulletSource Nothing
& itUse . equipEffect . eeUse .~ EAmmoSource 2000 2000 --BulletSource
Nothing
bulletBeltBracer :: Item
bulletBeltBracer =
@@ -85,7 +86,8 @@ bulletBeltBracer =
& itUse . equipEffect . eeSite .~ GoesOnWrist
& itType . iyBase .~ EQUIP BULLETBELTBRACER
& itUse . equipEffect . eeAttachPos .~ V3 (-9) 0 10
& itUse . equipEffect . eeUse .~ EAmmoSource 100 100 BulletSource Nothing
& itUse . equipEffect . eeUse .~ EAmmoSource 100 100 --BulletSource
Nothing
jetPack :: Item
jetPack =
+1 -6
View File
@@ -36,9 +36,7 @@ teslaGun =
lasGun :: Item
lasGun =
defaultAutoBatteryGun
& itUse . heldConsumption
.~ ( defaultLoadable
)
& itUse . heldConsumption .~ [ElectricalAmmo]
& itParams
.~ Refracting
{ _phaseV = 1
@@ -75,9 +73,6 @@ lasGunTweak =
tractorGun :: Item
tractorGun =
lasGun
& itUse . heldConsumption
.~ ( defaultLoadable
)
& itParams .~ Attracting{_attractionPower = 1}
& itTweaks
.~ Tweakable
+1 -2
View File
@@ -32,8 +32,7 @@ launcher =
-- & itUse . heldAim . aimHandlePos .~ V2 3 0
-- & itUse . heldAim . aimMuzPos .~ 20
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0]
& itUse . heldConsumption . laAmmoType
.~ ProjectileAmmo
& itUse . heldConsumption .~ [BulletAmmo]
& itType . iyBase .~ HELD LAUNCHER
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
+4 -11
View File
@@ -17,10 +17,8 @@ poisonSprayer :: Item
poisonSprayer =
flameThrower
& itType . iyBase .~ HELD POISONSPRAYER
& itUse . heldConsumption . laAmmoType
.~ GasAmmo
{ _amCreateGas = CreatePoisonGas --aGasCloud
}
& itUse . heldConsumption .~ [GasAmmo]
& itUse . heldParams .~ GasSprayParams CreatePoisonGas --aGasCloud
& itUse . heldMods .~ PoisonSprayerMod
flameSpitter :: Item
@@ -91,11 +89,6 @@ flameThrower =
& itUse . heldAim . aimStance .~ TwoHandUnder
-- & itUse . heldAim . aimHandlePos .~ 0
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 18 0) 0 0]
& itUse . heldConsumption
.~ ( defaultLoadable
& laAmmoType
.~ GasAmmo
{ _amCreateGas = CreateFlame --aFlame
}
)
& itUse . heldConsumption .~ [GasAmmo]
& itType . iyBase .~ HELD FLAMETHROWER
& itUse . heldParams .~ GasSprayParams CreateFlame --aGasCloud
+1 -3
View File
@@ -38,9 +38,7 @@ baseStickSpread = 0.2
pistol :: Item
pistol =
bangStick 1
& itUse . heldConsumption
.~ ( defaultBulletLoadable
)
& itUse . heldConsumption .~ [BulletAmmo]
& itUse . heldDelay . rateMax .~ 6
& itUse . heldMods .~ PistolMod
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 10 0) 0 0.05]
+1 -1
View File
@@ -43,7 +43,7 @@ forceFieldGun =
-- than the list below
--[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
& itType . iyBase .~ HELD FORCEFIELDGUN
& itUse . heldConsumption .~ (defaultLoadable & laAmmoType .~ ForceFieldAmmo DefaultForceField)
& itUse . heldConsumption .~ [ElectricalAmmo]
{- |
Sends out pulses that display walls.
+1 -1
View File
@@ -191,7 +191,7 @@ craftInfo fit = case fit of
MICROPHONE -> "A device that measures air vibration."
CREATURESENSOR -> "A device for detecting living beings."
WIRE -> "A small thin object that conducts electricity."
BATTERY -> "A store of electical potential energy."
-- BATTERY -> "A store of electical potential energy."
FUELCELL -> "A devices that converts chemical energy into electricity."
PORTABLEFUSION -> "A miniature nuclear reactor."
GASINJECTOR -> "A device that can inject small quantities of gas into objects."
-6
View File
@@ -1,5 +1,4 @@
module Dodge.Item.Weapon.Bullet (
basicBulletAmmo,
hvBulletAmmo,
defaultBullet,
) where
@@ -8,11 +7,6 @@ import Control.Lens
import Dodge.Data.Item.Use.Consumption.Ammo
import Geometry.Data
basicBulletAmmo :: AmmoType
basicBulletAmmo = SmallBulletAmmo
-- , _amBullet = defaultBullet
defaultBullet :: Bullet
defaultBullet =
Bullet
+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
& itUse . heldConsumption .~ [DroneAmmo]
& itType . iyBase .~ HELD DRONELAUNCHER
lasDronesPic :: Item -> SPic