feat: generate simulation numeric profiles from catalog/specs.json
catalog/specs.json is now the single copy of the numeric rows for
DroneSpec, MissileSpec and SamSpec: speed, guidance, warheads, models'
parts, RCS, seekers, launch and motor sounds, mount drives, gravity,
the Oreshnik split height and logistics limits, plus the named part
sets. tools/gen_catalog.py generates airdef-mod/src/sim/specs_generated.rs
(included by mod.rs, so the mod and airdef-core compile the same rows)
and unit_specs_generated.rs (included by units.rs). The hand-written
spec matches are gone; DroneKind::spec, MissileKind::spec and
SamKind::spec read the generated constants.
load_specs validates the schema, sound references, kind coverage against
content.json, named-part references and unused rows. gen_catalog.py
--check already runs in the CI generated-assets step, so a JSON/Rust
drift fails the build.
Every value was compared with the literals at 632061d field by field.
The only mismatch was the P1-SUN motor voice pitch in JSON (1.6 instead
of the actual 1.7, the flame == 0 branch in voices.rs); the JSON was
corrected and behaviour is unchanged. Save keys, raid order, RNG and
gameplay traces are untouched.
Verified: core release 194 passed + 8 scenarios (7 ignored), adapter
64 unit + 1 boundary + 5 scenarios, WASM contract 27 steps, catalog and
model generators fresh, asset/sound/model-bound/report tests pass.
This commit is contained in:
@@ -172,4 +172,32 @@ mod tests {
|
||||
assert_eq!(kinds, SamKind::ALL.into_iter().collect());
|
||||
assert_eq!(&RAID_KINDS[..11], &[Gerbera, Shahed, Geran3, Lancet, Kh101, Kalibr, Kh22, Zircon, Iskander, Kinzhal, Oreshnik]);
|
||||
}
|
||||
|
||||
/// The catalog is the only copy of the numbers: a kind without a row, or a row under
|
||||
/// another kind, would be a silent balance change.
|
||||
#[test]
|
||||
fn generated_specs_cover_every_kind_and_keep_their_keys() {
|
||||
let mut drones = HashSet::new();
|
||||
let mut drone_keys = HashSet::new();
|
||||
for (kind, key) in super::super::DRONE_SPEC_KEYS {
|
||||
assert_eq!(kind.spec().key, key, "profile/key mismatch for {kind:?}");
|
||||
assert!(drones.insert(kind), "duplicate drone profile {kind:?}");
|
||||
assert!(drone_keys.insert(key), "duplicate drone save key {key}");
|
||||
assert!(kind.spec().rcs > 0.0 && kind.spec().launch_sound.starts_with("airdef:"));
|
||||
}
|
||||
assert_eq!(drones, DroneKind::ALL.into_iter().collect());
|
||||
let mut missiles = HashSet::new();
|
||||
for (kind, model) in super::super::MISSILE_SPEC_MODELS {
|
||||
assert_eq!(kind.spec().model, model, "profile/model mismatch for {kind:?}");
|
||||
assert!(missiles.insert(kind), "duplicate missile profile {kind:?}");
|
||||
}
|
||||
let mut units = HashSet::new();
|
||||
let mut unit_keys = HashSet::new();
|
||||
for (kind, key) in super::super::units::UNIT_SPEC_KEYS {
|
||||
assert_eq!(kind.spec().key, key, "profile/key mismatch for {kind:?}");
|
||||
assert!(units.insert(kind), "duplicate unit profile {kind:?}");
|
||||
assert!(unit_keys.insert(key), "duplicate unit save key {key}");
|
||||
}
|
||||
assert_eq!(units, SamKind::ALL.into_iter().collect());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,6 @@
|
||||
//! reloads to the systems that wait, nearest first, and back.
|
||||
use super::*;
|
||||
|
||||
/// How near a depot a system reloads straight from it.
|
||||
const DEPOT_REACH: f64 = 60.0;
|
||||
/// How near a truck must come to hand a reload over, or to load up at a depot.
|
||||
const HANDOVER: f64 = 10.0;
|
||||
/// What a truck carries.
|
||||
const TRUCK_LOAD: u32 = 2;
|
||||
const STOCK_LIMIT: u32 = 1_000_000;
|
||||
|
||||
impl Sim {
|
||||
/// Whether ammunition is counted: a depot was set up (without one, magazines refill as
|
||||
/// before). A destroyed depot still counts: losing the last one leaves the systems short,
|
||||
|
||||
+17
-418
@@ -592,9 +592,6 @@ pub fn roles_text(mask: u8) -> String {
|
||||
Class::ALL.iter().filter(|c| mask & c.bit() != 0).map(|c| c.letter()).collect::<Vec<_>>().join("")
|
||||
}
|
||||
|
||||
/// Ballistic flight's gravity, blocks a tick².
|
||||
const GRAVITY: f64 = 0.05;
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
|
||||
pub enum DroneKind {
|
||||
Shahed,
|
||||
@@ -645,11 +642,15 @@ pub struct DroneSpec {
|
||||
pub decoy: bool,
|
||||
/// How hard it is to hit (1 normal).
|
||||
stealth: f64,
|
||||
/// Its radar cross-section (a Shahed's 0.3).
|
||||
rcs: f64,
|
||||
/// Its sound: event, pitch, every n ticks.
|
||||
sound: (&'static str, f32, u32),
|
||||
pub class: Class,
|
||||
/// Ballistic: launched this far away on a raid, flying an arc.
|
||||
pub ballistic: Option<f64>,
|
||||
/// The sound of its launch from the ground.
|
||||
launch_sound: &'static str,
|
||||
}
|
||||
|
||||
impl DroneSpec {
|
||||
@@ -680,280 +681,17 @@ impl DroneKind {
|
||||
];
|
||||
/// The sound of a launch from the ground: a light catapult shot, a rocket booster, a heavy ballistic launch.
|
||||
pub fn launch_sound(self) -> &'static str {
|
||||
match self {
|
||||
DroneKind::Shahed | DroneKind::Geran3 | DroneKind::Lancet | DroneKind::Gerbera => sound::LAUNCH_S400_EJECT,
|
||||
DroneKind::Kh101 | DroneKind::Kalibr | DroneKind::Kh22 => sound::LAUNCH_PATRIOT,
|
||||
DroneKind::Zircon => sound::LAUNCH_S400,
|
||||
DroneKind::Iskander | DroneKind::Kinzhal | DroneKind::Oreshnik | DroneKind::OreshnikBlock | DroneKind::OreshnikSub => {
|
||||
sound::LAUNCH_S500
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn spec(self) -> &'static DroneSpec {
|
||||
match self {
|
||||
DroneKind::Shahed => &DroneSpec {
|
||||
name: "Шахед-136",
|
||||
key: "shahed",
|
||||
model: "airdef:shahed",
|
||||
speed: 0.6,
|
||||
turn: 0.035,
|
||||
cruise: 45.0,
|
||||
clearance: 18.0,
|
||||
dive: 32.0,
|
||||
warhead: 3,
|
||||
scale: 1.3,
|
||||
engine: Engine::Prop(1.34, 1.0),
|
||||
decoy: false,
|
||||
stealth: 1.0,
|
||||
sound: (sound::DRONE_SHAHED, 1.0, 48),
|
||||
class: Class::Drone,
|
||||
ballistic: None,
|
||||
},
|
||||
DroneKind::Geran3 => &DroneSpec {
|
||||
name: "Герань-3",
|
||||
key: "geran3",
|
||||
model: "airdef:geran3",
|
||||
speed: 1.6,
|
||||
turn: 0.03,
|
||||
cruise: 60.0,
|
||||
clearance: 18.0,
|
||||
dive: 50.0,
|
||||
warhead: 2,
|
||||
scale: 1.15,
|
||||
engine: Engine::Jet(0.34, 1.55, 1.0),
|
||||
decoy: false,
|
||||
stealth: 1.1,
|
||||
sound: (sound::DRONE_GERAN3, 1.0, 40),
|
||||
class: Class::Jet,
|
||||
ballistic: None,
|
||||
},
|
||||
DroneKind::Lancet => &DroneSpec {
|
||||
name: "Ланцет-3",
|
||||
key: "lancet",
|
||||
model: "airdef:lancet",
|
||||
speed: 1.1,
|
||||
turn: 0.07,
|
||||
cruise: 25.0,
|
||||
clearance: 10.0,
|
||||
dive: 38.0,
|
||||
warhead: 1,
|
||||
scale: 0.9,
|
||||
engine: Engine::Prop(0.93, 0.55),
|
||||
decoy: false,
|
||||
stealth: 1.4,
|
||||
sound: (sound::DRONE_LANCET, 1.0, 32),
|
||||
class: Class::Drone,
|
||||
ballistic: None,
|
||||
},
|
||||
DroneKind::Gerbera => &DroneSpec {
|
||||
name: "Гербера",
|
||||
key: "gerbera",
|
||||
model: "airdef:gerbera",
|
||||
speed: 0.5,
|
||||
turn: 0.04,
|
||||
cruise: 40.0,
|
||||
clearance: 15.0,
|
||||
dive: 30.0,
|
||||
warhead: 0,
|
||||
scale: 1.1,
|
||||
engine: Engine::Prop(1.03, 0.9),
|
||||
decoy: true,
|
||||
stealth: 0.9,
|
||||
sound: (sound::DRONE_SHAHED, 1.3, 40),
|
||||
class: Class::Drone,
|
||||
ballistic: None,
|
||||
},
|
||||
DroneKind::Kh101 => &DroneSpec {
|
||||
name: "Х-101",
|
||||
key: "kh101",
|
||||
model: "airdef:kh101",
|
||||
speed: 2.4,
|
||||
turn: 0.025,
|
||||
cruise: 0.0,
|
||||
clearance: 12.0,
|
||||
dive: 26.0,
|
||||
warhead: 6,
|
||||
scale: 1.6,
|
||||
engine: Engine::Jet(-0.27, 1.4, 0.6),
|
||||
decoy: false,
|
||||
stealth: 1.5,
|
||||
sound: (sound::DRONE_CRUISE, 1.0, 50),
|
||||
class: Class::Cruise,
|
||||
ballistic: None,
|
||||
},
|
||||
DroneKind::Kalibr => &DroneSpec {
|
||||
name: "Калибр",
|
||||
key: "kalibr",
|
||||
model: "airdef:kalibr",
|
||||
speed: 2.1,
|
||||
turn: 0.025,
|
||||
cruise: 0.0,
|
||||
clearance: 15.0,
|
||||
dive: 26.0,
|
||||
warhead: 5,
|
||||
scale: 1.5,
|
||||
engine: Engine::Jet(-0.2, 1.5, 0.6),
|
||||
decoy: false,
|
||||
stealth: 1.3,
|
||||
sound: (sound::DRONE_CRUISE, 1.2, 50),
|
||||
class: Class::Cruise,
|
||||
ballistic: None,
|
||||
},
|
||||
DroneKind::Kh22 => &DroneSpec {
|
||||
name: "Х-22",
|
||||
key: "kh22",
|
||||
model: "airdef:kh22",
|
||||
speed: 4.0,
|
||||
turn: 0.03,
|
||||
cruise: 140.0,
|
||||
clearance: 40.0,
|
||||
dive: 150.0,
|
||||
warhead: 7,
|
||||
scale: 1.8,
|
||||
engine: Engine::Rocket(1.5, 1.3),
|
||||
decoy: false,
|
||||
stealth: 1.4,
|
||||
sound: (sound::DRONE_ROCKET, 0.8, 46),
|
||||
class: Class::Supersonic,
|
||||
ballistic: None,
|
||||
},
|
||||
DroneKind::Zircon => &DroneSpec {
|
||||
name: "Циркон",
|
||||
key: "zircon",
|
||||
model: "airdef:zircon",
|
||||
speed: 5.5,
|
||||
turn: 0.025,
|
||||
cruise: 90.0,
|
||||
clearance: 30.0,
|
||||
dive: 110.0,
|
||||
warhead: 6,
|
||||
scale: 1.4,
|
||||
engine: Engine::Rocket(1.5, 1.1),
|
||||
decoy: false,
|
||||
stealth: 2.0,
|
||||
sound: (sound::DRONE_ROCKET, 1.35, 46),
|
||||
class: Class::Supersonic,
|
||||
ballistic: None,
|
||||
},
|
||||
DroneKind::Iskander => &DroneSpec {
|
||||
name: "Искандер-М",
|
||||
key: "iskander",
|
||||
model: "airdef:iskander",
|
||||
speed: 5.0,
|
||||
turn: 0.04,
|
||||
cruise: 0.0,
|
||||
clearance: 0.0,
|
||||
dive: 0.0,
|
||||
warhead: 8,
|
||||
scale: 1.8,
|
||||
engine: Engine::Rocket(1.5, 1.6),
|
||||
decoy: false,
|
||||
stealth: 1.6,
|
||||
sound: (sound::DRONE_ROCKET, 0.7, 46),
|
||||
class: Class::Ballistic,
|
||||
ballistic: Some(1000.0),
|
||||
},
|
||||
DroneKind::Kinzhal => &DroneSpec {
|
||||
name: "Кинжал",
|
||||
key: "kinzhal",
|
||||
model: "airdef:kinzhal",
|
||||
speed: 7.5,
|
||||
turn: 0.03,
|
||||
cruise: 0.0,
|
||||
clearance: 0.0,
|
||||
dive: 0.0,
|
||||
warhead: 8,
|
||||
scale: 1.7,
|
||||
engine: Engine::Rocket(1.5, 1.5),
|
||||
decoy: false,
|
||||
stealth: 2.2,
|
||||
sound: (sound::DRONE_ROCKET, 0.6, 46),
|
||||
class: Class::Ballistic,
|
||||
ballistic: Some(1500.0),
|
||||
},
|
||||
DroneKind::Oreshnik => &DroneSpec {
|
||||
name: "Орешник",
|
||||
key: "oreshnik",
|
||||
model: "airdef:iskander",
|
||||
speed: 9.0,
|
||||
turn: 0.0,
|
||||
cruise: 0.0,
|
||||
clearance: 0.0,
|
||||
dive: 0.0,
|
||||
warhead: 0,
|
||||
scale: 2.6,
|
||||
engine: Engine::Rocket(1.5, 2.4),
|
||||
decoy: false,
|
||||
stealth: 3.0,
|
||||
sound: (sound::DRONE_ROCKET, 0.5, 46),
|
||||
class: Class::Ballistic,
|
||||
ballistic: Some(2600.0),
|
||||
},
|
||||
DroneKind::OreshnikBlock => &DroneSpec {
|
||||
name: "Орешник: блок",
|
||||
key: "oreshnik_block",
|
||||
model: "airdef:reentry",
|
||||
speed: 9.0,
|
||||
turn: 0.0,
|
||||
cruise: 0.0,
|
||||
clearance: 0.0,
|
||||
dive: 0.0,
|
||||
warhead: 4,
|
||||
scale: 1.6,
|
||||
engine: Engine::Rocket(1.0, 1.0),
|
||||
decoy: false,
|
||||
stealth: 3.5,
|
||||
sound: (sound::DRONE_BALLISTIC, 0.8, 9999),
|
||||
class: Class::Ballistic,
|
||||
ballistic: None,
|
||||
},
|
||||
DroneKind::OreshnikSub => &DroneSpec {
|
||||
name: "Орешник: суббоеприпас",
|
||||
key: "oreshnik_sub",
|
||||
model: "airdef:reentry",
|
||||
speed: 9.0,
|
||||
turn: 0.05,
|
||||
cruise: 0.0,
|
||||
clearance: 0.0,
|
||||
dive: 0.0,
|
||||
warhead: 3,
|
||||
scale: 1.1,
|
||||
engine: Engine::Rocket(1.0, 1.0),
|
||||
decoy: false,
|
||||
stealth: 4.0,
|
||||
sound: (sound::DRONE_BALLISTIC, 1.0, 9999),
|
||||
class: Class::Ballistic,
|
||||
ballistic: None,
|
||||
},
|
||||
}
|
||||
self.spec().launch_sound
|
||||
}
|
||||
pub fn from_key(key: &str) -> Option<Self> {
|
||||
Self::ALL.into_iter().find(|k| k.spec().key == key)
|
||||
}
|
||||
/// Its radar cross-section, a Shahed's 0.3: radars see it from as far as its fourth root allows.
|
||||
pub fn rcs(self) -> f64 {
|
||||
match self {
|
||||
DroneKind::Shahed => 0.3,
|
||||
DroneKind::Geran3 => 0.4,
|
||||
DroneKind::Lancet => 0.08,
|
||||
// Corner reflectors make the decoy look as big as a Shahed.
|
||||
DroneKind::Gerbera => 0.4,
|
||||
DroneKind::Kh101 => 0.05,
|
||||
DroneKind::Kalibr => 0.15,
|
||||
DroneKind::Kh22 => 1.0,
|
||||
DroneKind::Zircon => 0.4,
|
||||
DroneKind::Iskander => 0.6,
|
||||
DroneKind::Kinzhal => 0.5,
|
||||
DroneKind::Oreshnik => 2.0,
|
||||
DroneKind::OreshnikBlock => 0.4,
|
||||
DroneKind::OreshnikSub => 0.08,
|
||||
}
|
||||
self.spec().rcs
|
||||
}
|
||||
}
|
||||
|
||||
/// Height over the target where the Oreshnik's blocks release their submunitions.
|
||||
const BLOCK_SPLIT: f64 = 300.0;
|
||||
|
||||
#[derive(PartialEq, Clone, Copy)]
|
||||
enum Flight {
|
||||
Cruise,
|
||||
@@ -1066,7 +804,7 @@ impl Drone {
|
||||
|
||||
// ---------------------------------------------------------------- interceptors
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
|
||||
pub enum MissileKind {
|
||||
Pac3,
|
||||
M57e6,
|
||||
@@ -1096,6 +834,12 @@ struct MissileSpec {
|
||||
flame: f64,
|
||||
/// The nozzle, model units behind the centre (z).
|
||||
rear: f64,
|
||||
/// How far its own seeker holds a target (blocks); 0: command guidance only.
|
||||
seeker: f64,
|
||||
/// The sound of its launch.
|
||||
launch_sound: &'static str,
|
||||
/// Its motor's voice: event, gain and pitch.
|
||||
voice: (&'static str, f32, f32),
|
||||
}
|
||||
|
||||
impl MissileKind {
|
||||
@@ -1106,149 +850,12 @@ impl MissileKind {
|
||||
}
|
||||
/// The sound of its launch.
|
||||
pub fn launch_sound(self) -> &'static str {
|
||||
match self {
|
||||
MissileKind::Pac3 => sound::LAUNCH_PATRIOT,
|
||||
MissileKind::M57e6 => sound::LAUNCH_PANTSIR,
|
||||
MissileKind::M48n6 => sound::LAUNCH_S400_EJECT,
|
||||
MissileKind::M77n6 => sound::LAUNCH_S500_EJECT,
|
||||
MissileKind::IrisT | MissileKind::M9m338 => sound::LAUNCH_S400_EJECT,
|
||||
MissileKind::Amraam | MissileKind::M9m317 => sound::LAUNCH_PATRIOT,
|
||||
MissileKind::P1sun => sound::DRONE_LANCET,
|
||||
}
|
||||
}
|
||||
fn spec(self) -> &'static MissileSpec {
|
||||
match self {
|
||||
MissileKind::Pac3 => &MissileSpec {
|
||||
model: "airdef:pac3",
|
||||
speed: 5.5,
|
||||
accel: 0.35,
|
||||
turn: 0.3,
|
||||
boost: 8,
|
||||
cold: 0,
|
||||
pk: 0.9,
|
||||
fuse: 4.0,
|
||||
life: 240,
|
||||
scale: 1.0,
|
||||
flame: 1.0,
|
||||
rear: 28.0,
|
||||
},
|
||||
MissileKind::M57e6 => &MissileSpec {
|
||||
model: "airdef:m57e6",
|
||||
speed: 5.0,
|
||||
accel: 0.5,
|
||||
turn: 0.32,
|
||||
boost: 5,
|
||||
cold: 0,
|
||||
pk: 0.82,
|
||||
fuse: 3.0,
|
||||
life: 160,
|
||||
scale: 0.85,
|
||||
flame: 0.65,
|
||||
rear: 28.0,
|
||||
},
|
||||
MissileKind::M48n6 => &MissileSpec {
|
||||
model: "airdef:m48n6",
|
||||
speed: 7.0,
|
||||
accel: 0.5,
|
||||
turn: 0.22,
|
||||
boost: 8,
|
||||
cold: 5,
|
||||
pk: 0.9,
|
||||
fuse: 5.0,
|
||||
life: 300,
|
||||
scale: 1.5,
|
||||
flame: 1.4,
|
||||
rear: 30.0,
|
||||
},
|
||||
MissileKind::M77n6 => &MissileSpec {
|
||||
model: "airdef:m77n6",
|
||||
speed: 9.0,
|
||||
accel: 0.6,
|
||||
turn: 0.22,
|
||||
boost: 8,
|
||||
cold: 5,
|
||||
pk: 0.95,
|
||||
fuse: 6.0,
|
||||
life: 320,
|
||||
scale: 1.7,
|
||||
flame: 1.6,
|
||||
rear: 32.0,
|
||||
},
|
||||
MissileKind::IrisT => &MissileSpec {
|
||||
model: "airdef:irist_missile",
|
||||
speed: 7.0,
|
||||
accel: 0.5,
|
||||
turn: 0.35,
|
||||
boost: 6,
|
||||
cold: 4,
|
||||
pk: 0.9,
|
||||
fuse: 4.0,
|
||||
life: 260,
|
||||
scale: 0.95,
|
||||
flame: 0.9,
|
||||
rear: 28.0,
|
||||
},
|
||||
MissileKind::Amraam => &MissileSpec {
|
||||
model: "airdef:amraam_missile",
|
||||
speed: 6.0,
|
||||
accel: 0.45,
|
||||
turn: 0.3,
|
||||
boost: 6,
|
||||
cold: 0,
|
||||
pk: 0.85,
|
||||
fuse: 4.0,
|
||||
life: 260,
|
||||
scale: 0.9,
|
||||
flame: 0.9,
|
||||
rear: 28.0,
|
||||
},
|
||||
MissileKind::M9m317 => &MissileSpec {
|
||||
model: "airdef:m48n6",
|
||||
speed: 6.5,
|
||||
accel: 0.5,
|
||||
turn: 0.25,
|
||||
boost: 8,
|
||||
cold: 0,
|
||||
pk: 0.85,
|
||||
fuse: 5.0,
|
||||
life: 300,
|
||||
scale: 1.1,
|
||||
flame: 1.2,
|
||||
rear: 32.0,
|
||||
},
|
||||
MissileKind::M9m338 => &MissileSpec {
|
||||
model: "airdef:m57e6",
|
||||
speed: 5.5,
|
||||
accel: 0.6,
|
||||
turn: 0.4,
|
||||
boost: 4,
|
||||
cold: 4,
|
||||
pk: 0.9,
|
||||
fuse: 3.0,
|
||||
life: 160,
|
||||
scale: 1.0,
|
||||
flame: 0.8,
|
||||
rear: 28.0,
|
||||
},
|
||||
MissileKind::P1sun => &MissileSpec {
|
||||
model: "airdef:p1sun",
|
||||
speed: 2.8,
|
||||
accel: 0.12,
|
||||
turn: 0.3,
|
||||
boost: 4,
|
||||
cold: 0,
|
||||
pk: 0.8,
|
||||
fuse: 3.0,
|
||||
life: 900,
|
||||
scale: 0.8,
|
||||
// Electric: no flame.
|
||||
flame: 0.0,
|
||||
rear: 10.0,
|
||||
},
|
||||
}
|
||||
self.spec().launch_sound
|
||||
}
|
||||
}
|
||||
|
||||
include!("specs_generated.rs");
|
||||
|
||||
pub struct Missile {
|
||||
pub id: u32,
|
||||
pub kind: MissileKind,
|
||||
@@ -1308,15 +915,7 @@ impl Missile {
|
||||
impl MissileKind {
|
||||
/// How far its own seeker holds a target of average size (blocks); 0: command guidance only.
|
||||
pub fn seeker(self) -> f64 {
|
||||
match self {
|
||||
MissileKind::M57e6 => 0.0,
|
||||
MissileKind::Pac3 => 110.0,
|
||||
MissileKind::M48n6 | MissileKind::M77n6 => 120.0,
|
||||
MissileKind::IrisT | MissileKind::M9m317 => 90.0,
|
||||
MissileKind::Amraam => 130.0,
|
||||
MissileKind::M9m338 => 70.0,
|
||||
MissileKind::P1sun => 60.0,
|
||||
}
|
||||
self.spec().seeker
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,524 @@
|
||||
// Generated by tools/gen_catalog.py from catalog/specs.json. Do not edit.
|
||||
// Game-scale values, not real weapon data; the catalog is the only copy.
|
||||
|
||||
/// Share of the old slew speed a launcher keeps when it has no rate of its own.
|
||||
const DRIVE_SCALE: f64 = 0.4;
|
||||
/// Ticks a drive takes to reach its top speed (and to stop from it).
|
||||
const DRIVE_RAMP: f64 = 8.0;
|
||||
const DRIVE_TRAINABLE: (f64, f64) = (0.12, 0.0);
|
||||
const DRIVE_VERTICAL: (f64, f64) = (0.15, 0.0);
|
||||
const DRIVE_OTHER: (f64, f64) = (0.05, 0.05);
|
||||
/// Ballistic flight's gravity, blocks a tick².
|
||||
const GRAVITY: f64 = 0.05;
|
||||
/// Height over the target where the Oreshnik's blocks release their submunitions.
|
||||
const BLOCK_SPLIT: f64 = 300.0;
|
||||
/// How near a depot a system reloads straight from it.
|
||||
const DEPOT_REACH: f64 = 60.0;
|
||||
/// How near a truck must come to hand a reload over, or to load up at a depot.
|
||||
const HANDOVER: f64 = 10.0;
|
||||
/// What a truck carries.
|
||||
const TRUCK_LOAD: u32 = 2;
|
||||
const STOCK_LIMIT: u32 = 1000000;
|
||||
|
||||
const DRONE_SPEC_SHAHED: DroneSpec = DroneSpec {
|
||||
name: "Шахед-136",
|
||||
key: "shahed",
|
||||
model: "airdef:shahed",
|
||||
speed: 0.6,
|
||||
turn: 0.035,
|
||||
cruise: 45.0,
|
||||
clearance: 18.0,
|
||||
dive: 32.0,
|
||||
warhead: 3,
|
||||
scale: 1.3,
|
||||
engine: Engine::Prop(1.34, 1.0),
|
||||
decoy: false,
|
||||
stealth: 1.0,
|
||||
rcs: 0.3,
|
||||
sound: (sound::DRONE_SHAHED, 1.0, 48),
|
||||
class: Class::Drone,
|
||||
ballistic: None,
|
||||
launch_sound: sound::LAUNCH_S400_EJECT,
|
||||
};
|
||||
|
||||
const DRONE_SPEC_GERAN3: DroneSpec = DroneSpec {
|
||||
name: "Герань-3",
|
||||
key: "geran3",
|
||||
model: "airdef:geran3",
|
||||
speed: 1.6,
|
||||
turn: 0.03,
|
||||
cruise: 60.0,
|
||||
clearance: 18.0,
|
||||
dive: 50.0,
|
||||
warhead: 2,
|
||||
scale: 1.15,
|
||||
engine: Engine::Jet(0.34, 1.55, 1.0),
|
||||
decoy: false,
|
||||
stealth: 1.1,
|
||||
rcs: 0.4,
|
||||
sound: (sound::DRONE_GERAN3, 1.0, 40),
|
||||
class: Class::Jet,
|
||||
ballistic: None,
|
||||
launch_sound: sound::LAUNCH_S400_EJECT,
|
||||
};
|
||||
|
||||
const DRONE_SPEC_LANCET: DroneSpec = DroneSpec {
|
||||
name: "Ланцет-3",
|
||||
key: "lancet",
|
||||
model: "airdef:lancet",
|
||||
speed: 1.1,
|
||||
turn: 0.07,
|
||||
cruise: 25.0,
|
||||
clearance: 10.0,
|
||||
dive: 38.0,
|
||||
warhead: 1,
|
||||
scale: 0.9,
|
||||
engine: Engine::Prop(0.93, 0.55),
|
||||
decoy: false,
|
||||
stealth: 1.4,
|
||||
rcs: 0.08,
|
||||
sound: (sound::DRONE_LANCET, 1.0, 32),
|
||||
class: Class::Drone,
|
||||
ballistic: None,
|
||||
launch_sound: sound::LAUNCH_S400_EJECT,
|
||||
};
|
||||
|
||||
const DRONE_SPEC_GERBERA: DroneSpec = DroneSpec {
|
||||
name: "Гербера",
|
||||
key: "gerbera",
|
||||
model: "airdef:gerbera",
|
||||
speed: 0.5,
|
||||
turn: 0.04,
|
||||
cruise: 40.0,
|
||||
clearance: 15.0,
|
||||
dive: 30.0,
|
||||
warhead: 0,
|
||||
scale: 1.1,
|
||||
engine: Engine::Prop(1.03, 0.9),
|
||||
decoy: true,
|
||||
stealth: 0.9,
|
||||
rcs: 0.4,
|
||||
sound: (sound::DRONE_SHAHED, 1.3, 40),
|
||||
class: Class::Drone,
|
||||
ballistic: None,
|
||||
launch_sound: sound::LAUNCH_S400_EJECT,
|
||||
};
|
||||
|
||||
const DRONE_SPEC_KH101: DroneSpec = DroneSpec {
|
||||
name: "Х-101",
|
||||
key: "kh101",
|
||||
model: "airdef:kh101",
|
||||
speed: 2.4,
|
||||
turn: 0.025,
|
||||
cruise: 0.0,
|
||||
clearance: 12.0,
|
||||
dive: 26.0,
|
||||
warhead: 6,
|
||||
scale: 1.6,
|
||||
engine: Engine::Jet(-0.27, 1.4, 0.6),
|
||||
decoy: false,
|
||||
stealth: 1.5,
|
||||
rcs: 0.05,
|
||||
sound: (sound::DRONE_CRUISE, 1.0, 50),
|
||||
class: Class::Cruise,
|
||||
ballistic: None,
|
||||
launch_sound: sound::LAUNCH_PATRIOT,
|
||||
};
|
||||
|
||||
const DRONE_SPEC_KALIBR: DroneSpec = DroneSpec {
|
||||
name: "Калибр",
|
||||
key: "kalibr",
|
||||
model: "airdef:kalibr",
|
||||
speed: 2.1,
|
||||
turn: 0.025,
|
||||
cruise: 0.0,
|
||||
clearance: 15.0,
|
||||
dive: 26.0,
|
||||
warhead: 5,
|
||||
scale: 1.5,
|
||||
engine: Engine::Jet(-0.2, 1.5, 0.6),
|
||||
decoy: false,
|
||||
stealth: 1.3,
|
||||
rcs: 0.15,
|
||||
sound: (sound::DRONE_CRUISE, 1.2, 50),
|
||||
class: Class::Cruise,
|
||||
ballistic: None,
|
||||
launch_sound: sound::LAUNCH_PATRIOT,
|
||||
};
|
||||
|
||||
const DRONE_SPEC_KH22: DroneSpec = DroneSpec {
|
||||
name: "Х-22",
|
||||
key: "kh22",
|
||||
model: "airdef:kh22",
|
||||
speed: 4.0,
|
||||
turn: 0.03,
|
||||
cruise: 140.0,
|
||||
clearance: 40.0,
|
||||
dive: 150.0,
|
||||
warhead: 7,
|
||||
scale: 1.8,
|
||||
engine: Engine::Rocket(1.5, 1.3),
|
||||
decoy: false,
|
||||
stealth: 1.4,
|
||||
rcs: 1.0,
|
||||
sound: (sound::DRONE_ROCKET, 0.8, 46),
|
||||
class: Class::Supersonic,
|
||||
ballistic: None,
|
||||
launch_sound: sound::LAUNCH_PATRIOT,
|
||||
};
|
||||
|
||||
const DRONE_SPEC_ZIRCON: DroneSpec = DroneSpec {
|
||||
name: "Циркон",
|
||||
key: "zircon",
|
||||
model: "airdef:zircon",
|
||||
speed: 5.5,
|
||||
turn: 0.025,
|
||||
cruise: 90.0,
|
||||
clearance: 30.0,
|
||||
dive: 110.0,
|
||||
warhead: 6,
|
||||
scale: 1.4,
|
||||
engine: Engine::Rocket(1.5, 1.1),
|
||||
decoy: false,
|
||||
stealth: 2.0,
|
||||
rcs: 0.4,
|
||||
sound: (sound::DRONE_ROCKET, 1.35, 46),
|
||||
class: Class::Supersonic,
|
||||
ballistic: None,
|
||||
launch_sound: sound::LAUNCH_S400,
|
||||
};
|
||||
|
||||
const DRONE_SPEC_ISKANDER: DroneSpec = DroneSpec {
|
||||
name: "Искандер-М",
|
||||
key: "iskander",
|
||||
model: "airdef:iskander",
|
||||
speed: 5.0,
|
||||
turn: 0.04,
|
||||
cruise: 0.0,
|
||||
clearance: 0.0,
|
||||
dive: 0.0,
|
||||
warhead: 8,
|
||||
scale: 1.8,
|
||||
engine: Engine::Rocket(1.5, 1.6),
|
||||
decoy: false,
|
||||
stealth: 1.6,
|
||||
rcs: 0.6,
|
||||
sound: (sound::DRONE_ROCKET, 0.7, 46),
|
||||
class: Class::Ballistic,
|
||||
ballistic: Some(1000.0),
|
||||
launch_sound: sound::LAUNCH_S500,
|
||||
};
|
||||
|
||||
const DRONE_SPEC_KINZHAL: DroneSpec = DroneSpec {
|
||||
name: "Кинжал",
|
||||
key: "kinzhal",
|
||||
model: "airdef:kinzhal",
|
||||
speed: 7.5,
|
||||
turn: 0.03,
|
||||
cruise: 0.0,
|
||||
clearance: 0.0,
|
||||
dive: 0.0,
|
||||
warhead: 8,
|
||||
scale: 1.7,
|
||||
engine: Engine::Rocket(1.5, 1.5),
|
||||
decoy: false,
|
||||
stealth: 2.2,
|
||||
rcs: 0.5,
|
||||
sound: (sound::DRONE_ROCKET, 0.6, 46),
|
||||
class: Class::Ballistic,
|
||||
ballistic: Some(1500.0),
|
||||
launch_sound: sound::LAUNCH_S500,
|
||||
};
|
||||
|
||||
const DRONE_SPEC_ORESHNIK: DroneSpec = DroneSpec {
|
||||
name: "Орешник",
|
||||
key: "oreshnik",
|
||||
model: "airdef:iskander",
|
||||
speed: 9.0,
|
||||
turn: 0.0,
|
||||
cruise: 0.0,
|
||||
clearance: 0.0,
|
||||
dive: 0.0,
|
||||
warhead: 0,
|
||||
scale: 2.6,
|
||||
engine: Engine::Rocket(1.5, 2.4),
|
||||
decoy: false,
|
||||
stealth: 3.0,
|
||||
rcs: 2.0,
|
||||
sound: (sound::DRONE_ROCKET, 0.5, 46),
|
||||
class: Class::Ballistic,
|
||||
ballistic: Some(2600.0),
|
||||
launch_sound: sound::LAUNCH_S500,
|
||||
};
|
||||
|
||||
const DRONE_SPEC_ORESHNIKBLOCK: DroneSpec = DroneSpec {
|
||||
name: "Орешник: блок",
|
||||
key: "oreshnik_block",
|
||||
model: "airdef:reentry",
|
||||
speed: 9.0,
|
||||
turn: 0.0,
|
||||
cruise: 0.0,
|
||||
clearance: 0.0,
|
||||
dive: 0.0,
|
||||
warhead: 4,
|
||||
scale: 1.6,
|
||||
engine: Engine::Rocket(1.0, 1.0),
|
||||
decoy: false,
|
||||
stealth: 3.5,
|
||||
rcs: 0.4,
|
||||
sound: (sound::DRONE_BALLISTIC, 0.8, 9999),
|
||||
class: Class::Ballistic,
|
||||
ballistic: None,
|
||||
launch_sound: sound::LAUNCH_S500,
|
||||
};
|
||||
|
||||
const DRONE_SPEC_ORESHNIKSUB: DroneSpec = DroneSpec {
|
||||
name: "Орешник: суббоеприпас",
|
||||
key: "oreshnik_sub",
|
||||
model: "airdef:reentry",
|
||||
speed: 9.0,
|
||||
turn: 0.05,
|
||||
cruise: 0.0,
|
||||
clearance: 0.0,
|
||||
dive: 0.0,
|
||||
warhead: 3,
|
||||
scale: 1.1,
|
||||
engine: Engine::Rocket(1.0, 1.0),
|
||||
decoy: false,
|
||||
stealth: 4.0,
|
||||
rcs: 0.08,
|
||||
sound: (sound::DRONE_BALLISTIC, 1.0, 9999),
|
||||
class: Class::Ballistic,
|
||||
ballistic: None,
|
||||
launch_sound: sound::LAUNCH_S500,
|
||||
};
|
||||
|
||||
const MISSILE_SPEC_PAC3: MissileSpec = MissileSpec {
|
||||
model: "airdef:pac3",
|
||||
speed: 5.5,
|
||||
accel: 0.35,
|
||||
turn: 0.3,
|
||||
boost: 8,
|
||||
cold: 0,
|
||||
pk: 0.9,
|
||||
fuse: 4.0,
|
||||
life: 240,
|
||||
scale: 1.0,
|
||||
flame: 1.0,
|
||||
rear: 28.0,
|
||||
seeker: 110.0,
|
||||
launch_sound: sound::LAUNCH_PATRIOT,
|
||||
voice: (sound::MISSILE_FLIGHT, 1.0, 1.0),
|
||||
};
|
||||
|
||||
const MISSILE_SPEC_M57E6: MissileSpec = MissileSpec {
|
||||
model: "airdef:m57e6",
|
||||
speed: 5.0,
|
||||
accel: 0.5,
|
||||
turn: 0.32,
|
||||
boost: 5,
|
||||
cold: 0,
|
||||
pk: 0.82,
|
||||
fuse: 3.0,
|
||||
life: 160,
|
||||
scale: 0.85,
|
||||
flame: 0.65,
|
||||
rear: 28.0,
|
||||
seeker: 0.0,
|
||||
launch_sound: sound::LAUNCH_PANTSIR,
|
||||
voice: (sound::MISSILE_FLIGHT, 1.0, 1.12),
|
||||
};
|
||||
|
||||
const MISSILE_SPEC_M48N6: MissileSpec = MissileSpec {
|
||||
model: "airdef:m48n6",
|
||||
speed: 7.0,
|
||||
accel: 0.5,
|
||||
turn: 0.22,
|
||||
boost: 8,
|
||||
cold: 5,
|
||||
pk: 0.9,
|
||||
fuse: 5.0,
|
||||
life: 300,
|
||||
scale: 1.5,
|
||||
flame: 1.4,
|
||||
rear: 30.0,
|
||||
seeker: 120.0,
|
||||
launch_sound: sound::LAUNCH_S400_EJECT,
|
||||
voice: (sound::MISSILE_FLIGHT, 1.0, 0.88),
|
||||
};
|
||||
|
||||
const MISSILE_SPEC_M77N6: MissileSpec = MissileSpec {
|
||||
model: "airdef:m77n6",
|
||||
speed: 9.0,
|
||||
accel: 0.6,
|
||||
turn: 0.22,
|
||||
boost: 8,
|
||||
cold: 5,
|
||||
pk: 0.95,
|
||||
fuse: 6.0,
|
||||
life: 320,
|
||||
scale: 1.7,
|
||||
flame: 1.6,
|
||||
rear: 32.0,
|
||||
seeker: 120.0,
|
||||
launch_sound: sound::LAUNCH_S500_EJECT,
|
||||
voice: (sound::MISSILE_FLIGHT, 1.0, 0.8),
|
||||
};
|
||||
|
||||
const MISSILE_SPEC_IRIST: MissileSpec = MissileSpec {
|
||||
model: "airdef:irist_missile",
|
||||
speed: 7.0,
|
||||
accel: 0.5,
|
||||
turn: 0.35,
|
||||
boost: 6,
|
||||
cold: 4,
|
||||
pk: 0.9,
|
||||
fuse: 4.0,
|
||||
life: 260,
|
||||
scale: 0.95,
|
||||
flame: 0.9,
|
||||
rear: 28.0,
|
||||
seeker: 90.0,
|
||||
launch_sound: sound::LAUNCH_S400_EJECT,
|
||||
voice: (sound::MISSILE_FLIGHT, 1.0, 1.05),
|
||||
};
|
||||
|
||||
const MISSILE_SPEC_AMRAAM: MissileSpec = MissileSpec {
|
||||
model: "airdef:amraam_missile",
|
||||
speed: 6.0,
|
||||
accel: 0.45,
|
||||
turn: 0.3,
|
||||
boost: 6,
|
||||
cold: 0,
|
||||
pk: 0.85,
|
||||
fuse: 4.0,
|
||||
life: 260,
|
||||
scale: 0.9,
|
||||
flame: 0.9,
|
||||
rear: 28.0,
|
||||
seeker: 130.0,
|
||||
launch_sound: sound::LAUNCH_PATRIOT,
|
||||
voice: (sound::MISSILE_FLIGHT, 1.0, 1.05),
|
||||
};
|
||||
|
||||
const MISSILE_SPEC_M9M317: MissileSpec = MissileSpec {
|
||||
model: "airdef:m48n6",
|
||||
speed: 6.5,
|
||||
accel: 0.5,
|
||||
turn: 0.25,
|
||||
boost: 8,
|
||||
cold: 0,
|
||||
pk: 0.85,
|
||||
fuse: 5.0,
|
||||
life: 300,
|
||||
scale: 1.1,
|
||||
flame: 1.2,
|
||||
rear: 32.0,
|
||||
seeker: 90.0,
|
||||
launch_sound: sound::LAUNCH_PATRIOT,
|
||||
voice: (sound::MISSILE_FLIGHT, 1.0, 0.9),
|
||||
};
|
||||
|
||||
const MISSILE_SPEC_M9M338: MissileSpec = MissileSpec {
|
||||
model: "airdef:m57e6",
|
||||
speed: 5.5,
|
||||
accel: 0.6,
|
||||
turn: 0.4,
|
||||
boost: 4,
|
||||
cold: 4,
|
||||
pk: 0.9,
|
||||
fuse: 3.0,
|
||||
life: 160,
|
||||
scale: 1.0,
|
||||
flame: 0.8,
|
||||
rear: 28.0,
|
||||
seeker: 70.0,
|
||||
launch_sound: sound::LAUNCH_S400_EJECT,
|
||||
voice: (sound::MISSILE_FLIGHT, 1.0, 1.15),
|
||||
};
|
||||
|
||||
const MISSILE_SPEC_P1SUN: MissileSpec = MissileSpec {
|
||||
model: "airdef:p1sun",
|
||||
speed: 2.8,
|
||||
accel: 0.12,
|
||||
turn: 0.3,
|
||||
boost: 4,
|
||||
cold: 0,
|
||||
pk: 0.8,
|
||||
fuse: 3.0,
|
||||
life: 900,
|
||||
scale: 0.8,
|
||||
flame: 0.0,
|
||||
rear: 10.0,
|
||||
seeker: 60.0,
|
||||
launch_sound: sound::DRONE_LANCET,
|
||||
voice: (sound::DRONE_LANCET, 0.8, 1.7),
|
||||
};
|
||||
|
||||
impl DroneKind {
|
||||
/// Its row of numbers from `catalog/specs.json`.
|
||||
pub fn spec(self) -> &'static DroneSpec {
|
||||
match self {
|
||||
DroneKind::Shahed => &DRONE_SPEC_SHAHED,
|
||||
DroneKind::Geran3 => &DRONE_SPEC_GERAN3,
|
||||
DroneKind::Lancet => &DRONE_SPEC_LANCET,
|
||||
DroneKind::Gerbera => &DRONE_SPEC_GERBERA,
|
||||
DroneKind::Kh101 => &DRONE_SPEC_KH101,
|
||||
DroneKind::Kalibr => &DRONE_SPEC_KALIBR,
|
||||
DroneKind::Kh22 => &DRONE_SPEC_KH22,
|
||||
DroneKind::Zircon => &DRONE_SPEC_ZIRCON,
|
||||
DroneKind::Iskander => &DRONE_SPEC_ISKANDER,
|
||||
DroneKind::Kinzhal => &DRONE_SPEC_KINZHAL,
|
||||
DroneKind::Oreshnik => &DRONE_SPEC_ORESHNIK,
|
||||
DroneKind::OreshnikBlock => &DRONE_SPEC_ORESHNIKBLOCK,
|
||||
DroneKind::OreshnikSub => &DRONE_SPEC_ORESHNIKSUB,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MissileKind {
|
||||
fn spec(self) -> &'static MissileSpec {
|
||||
match self {
|
||||
MissileKind::Pac3 => &MISSILE_SPEC_PAC3,
|
||||
MissileKind::M57e6 => &MISSILE_SPEC_M57E6,
|
||||
MissileKind::M48n6 => &MISSILE_SPEC_M48N6,
|
||||
MissileKind::M77n6 => &MISSILE_SPEC_M77N6,
|
||||
MissileKind::IrisT => &MISSILE_SPEC_IRIST,
|
||||
MissileKind::Amraam => &MISSILE_SPEC_AMRAAM,
|
||||
MissileKind::M9m317 => &MISSILE_SPEC_M9M317,
|
||||
MissileKind::M9m338 => &MISSILE_SPEC_M9M338,
|
||||
MissileKind::P1sun => &MISSILE_SPEC_P1SUN,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Save keys by kind; a rename needs an explicit migration.
|
||||
#[cfg(test)]
|
||||
pub(super) const DRONE_SPEC_KEYS: [(DroneKind, &str); 13] = [
|
||||
(DroneKind::Shahed, "shahed"),
|
||||
(DroneKind::Geran3, "geran3"),
|
||||
(DroneKind::Lancet, "lancet"),
|
||||
(DroneKind::Gerbera, "gerbera"),
|
||||
(DroneKind::Kh101, "kh101"),
|
||||
(DroneKind::Kalibr, "kalibr"),
|
||||
(DroneKind::Kh22, "kh22"),
|
||||
(DroneKind::Zircon, "zircon"),
|
||||
(DroneKind::Iskander, "iskander"),
|
||||
(DroneKind::Kinzhal, "kinzhal"),
|
||||
(DroneKind::Oreshnik, "oreshnik"),
|
||||
(DroneKind::OreshnikBlock, "oreshnik_block"),
|
||||
(DroneKind::OreshnikSub, "oreshnik_sub"),
|
||||
];
|
||||
|
||||
#[cfg(test)]
|
||||
pub(super) const MISSILE_SPEC_MODELS: [(MissileKind, &str); 9] = [
|
||||
(MissileKind::Pac3, "airdef:pac3"),
|
||||
(MissileKind::M57e6, "airdef:m57e6"),
|
||||
(MissileKind::M48n6, "airdef:m48n6"),
|
||||
(MissileKind::M77n6, "airdef:m77n6"),
|
||||
(MissileKind::IrisT, "airdef:irist_missile"),
|
||||
(MissileKind::Amraam, "airdef:amraam_missile"),
|
||||
(MissileKind::M9m317, "airdef:m48n6"),
|
||||
(MissileKind::M9m338, "airdef:m57e6"),
|
||||
(MissileKind::P1sun, "airdef:p1sun"),
|
||||
];
|
||||
@@ -0,0 +1,424 @@
|
||||
// Generated by tools/gen_catalog.py from catalog/specs.json. Do not edit.
|
||||
// Game-scale values, not real weapon data; the catalog is the only copy.
|
||||
|
||||
const NAMED_BATTERY_RADAR: &[(&str, f64, f64)] = &[("airdef:radar_trailer", 0.0, 4.2)];
|
||||
const NAMED_BATTERY_SPINNER: Option<(&str, f64, f64, f64, f64)> = Some(("airdef:radar_panel", 0.9, 4.2, 0.9, -0.3));
|
||||
const NAMED_TUBE_PIVOT: DVec3 = DVec3::new(0.0, -0.5, 1.5);
|
||||
|
||||
const UNIT_SPEC_PATRIOT: SamSpec = SamSpec {
|
||||
name: "Patriot",
|
||||
key: "patriot",
|
||||
missile: Some(MissileLoad { kind: MissileKind::Pac3, magazine: 4, min: 10.0, max: 450.0, interval: 16 }),
|
||||
gun: None,
|
||||
reload: 220,
|
||||
scale: 1.3,
|
||||
rest_pitch: 0.66,
|
||||
roles: 30,
|
||||
family: Family::Trainable,
|
||||
parts: Parts {
|
||||
body: "airdef:patriot_trailer",
|
||||
launcher: Some("airdef:patriot_launcher"),
|
||||
pack: None,
|
||||
dish: None,
|
||||
fixed: &[("airdef:patriot_truck", 0.0, -3.0), ("airdef:patriot_radar", 0.0, 3.6)],
|
||||
spinner: None,
|
||||
},
|
||||
mount: (0.69, 1.2),
|
||||
pivot: DVec3::new(0.0, -0.5, 1.375),
|
||||
muzzle: Muzzle::Patriot,
|
||||
sensor: 585.0,
|
||||
mast: 5.0,
|
||||
};
|
||||
|
||||
const UNIT_SPEC_GEPARD: SamSpec = SamSpec {
|
||||
name: "Гепард",
|
||||
key: "gepard",
|
||||
missile: None,
|
||||
gun: Some(GunSpec { range: 135.0, track: 195.0, p: 0.3, bursts: 160, shell: 10.0, slew: (0.22, 0.16) }),
|
||||
reload: 160,
|
||||
scale: 1.25,
|
||||
rest_pitch: 0.0,
|
||||
roles: 7,
|
||||
family: Family::Gun,
|
||||
parts: Parts {
|
||||
body: "airdef:gepard_hull",
|
||||
launcher: Some("airdef:gepard_turret"),
|
||||
pack: Some("airdef:gepard_guns"),
|
||||
dish: Some(("airdef:gepard_dish", 0.95, 0.6, 0.0)),
|
||||
fixed: &[],
|
||||
spinner: None,
|
||||
},
|
||||
mount: (1.55, 0.25),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::None,
|
||||
sensor: 255.0,
|
||||
mast: 3.0,
|
||||
};
|
||||
|
||||
const UNIT_SPEC_PANTSIR: SamSpec = SamSpec {
|
||||
name: "Панцирь-С1",
|
||||
key: "pantsir",
|
||||
missile: Some(MissileLoad { kind: MissileKind::M57e6, magazine: 12, min: 25.0, max: 225.0, interval: 14 }),
|
||||
gun: Some(GunSpec { range: 90.0, track: 135.0, p: 0.25, bursts: 140, shell: 9.0, slew: (0.25, 0.18) }),
|
||||
reload: 280,
|
||||
scale: 1.3,
|
||||
rest_pitch: 0.0,
|
||||
roles: 15,
|
||||
family: Family::Turret,
|
||||
parts: Parts {
|
||||
body: "airdef:pantsir_truck",
|
||||
launcher: Some("airdef:pantsir_turret"),
|
||||
pack: Some("airdef:pantsir_pack"),
|
||||
dish: Some(("airdef:pantsir_dish", 0.85, 0.3, 0.3)),
|
||||
fixed: &[],
|
||||
spinner: None,
|
||||
},
|
||||
mount: (1.35, 0.69),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::Pantsir,
|
||||
sensor: 292.0,
|
||||
mast: 4.0,
|
||||
};
|
||||
|
||||
const UNIT_SPEC_S400: SamSpec = SamSpec {
|
||||
name: "С-400",
|
||||
key: "s400",
|
||||
missile: Some(MissileLoad { kind: MissileKind::M48n6, magazine: 4, min: 30.0, max: 720.0, interval: 20 }),
|
||||
gun: None,
|
||||
reload: 420,
|
||||
scale: 1.5,
|
||||
rest_pitch: HALF_PI - 0.02,
|
||||
roles: 30,
|
||||
family: Family::Vertical,
|
||||
parts: Parts {
|
||||
body: "airdef:s400_chassis",
|
||||
launcher: Some("airdef:s400_tubes"),
|
||||
pack: None,
|
||||
dish: None,
|
||||
fixed: NAMED_BATTERY_RADAR,
|
||||
spinner: NAMED_BATTERY_SPINNER,
|
||||
},
|
||||
mount: (0.7, 1.45),
|
||||
pivot: NAMED_TUBE_PIVOT,
|
||||
muzzle: Muzzle::Grid(2, 2, 7.0),
|
||||
sensor: 936.0,
|
||||
mast: 5.0,
|
||||
};
|
||||
|
||||
const UNIT_SPEC_S500: SamSpec = SamSpec {
|
||||
name: "С-500",
|
||||
key: "s500",
|
||||
missile: Some(MissileLoad { kind: MissileKind::M77n6, magazine: 2, min: 40.0, max: 1050.0, interval: 20 }),
|
||||
gun: None,
|
||||
reload: 520,
|
||||
scale: 1.6,
|
||||
rest_pitch: HALF_PI - 0.02,
|
||||
roles: 24,
|
||||
family: Family::Vertical,
|
||||
parts: Parts {
|
||||
body: "airdef:s500_chassis",
|
||||
launcher: Some("airdef:s500_tubes"),
|
||||
pack: None,
|
||||
dish: None,
|
||||
fixed: NAMED_BATTERY_RADAR,
|
||||
spinner: NAMED_BATTERY_SPINNER,
|
||||
},
|
||||
mount: (0.7, 1.45),
|
||||
pivot: NAMED_TUBE_PIVOT,
|
||||
muzzle: Muzzle::Grid(2, 1, 9.5),
|
||||
sensor: 1365.0,
|
||||
mast: 5.0,
|
||||
};
|
||||
|
||||
const UNIT_SPEC_IRIST: SamSpec = SamSpec {
|
||||
name: "IRIS-T SLM",
|
||||
key: "irist",
|
||||
missile: Some(MissileLoad { kind: MissileKind::IrisT, magazine: 8, min: 15.0, max: 600.0, interval: 10 }),
|
||||
gun: None,
|
||||
reload: 300,
|
||||
scale: 1.4,
|
||||
rest_pitch: HALF_PI - 0.02,
|
||||
roles: 15,
|
||||
family: Family::Vertical,
|
||||
parts: Parts {
|
||||
body: "airdef:irist_chassis",
|
||||
launcher: Some("airdef:irist_tubes"),
|
||||
pack: None,
|
||||
dish: None,
|
||||
fixed: NAMED_BATTERY_RADAR,
|
||||
spinner: NAMED_BATTERY_SPINNER,
|
||||
},
|
||||
mount: (0.7, 1.45),
|
||||
pivot: NAMED_TUBE_PIVOT,
|
||||
muzzle: Muzzle::Grid(4, 2, 4.0),
|
||||
sensor: 780.0,
|
||||
mast: 5.0,
|
||||
};
|
||||
|
||||
const UNIT_SPEC_NASAMS: SamSpec = SamSpec {
|
||||
name: "NASAMS",
|
||||
key: "nasams",
|
||||
missile: Some(MissileLoad { kind: MissileKind::Amraam, magazine: 6, min: 10.0, max: 450.0, interval: 14 }),
|
||||
gun: None,
|
||||
reload: 260,
|
||||
scale: 1.3,
|
||||
rest_pitch: 0.5,
|
||||
roles: 14,
|
||||
family: Family::Trainable,
|
||||
parts: Parts {
|
||||
body: "airdef:nasams_trailer",
|
||||
launcher: Some("airdef:nasams_launcher"),
|
||||
pack: None,
|
||||
dish: None,
|
||||
fixed: &[("airdef:radar_trailer", 0.0, 3.4)],
|
||||
spinner: Some(("airdef:radar_panel", 0.9, 3.4, 0.6, -0.3)),
|
||||
},
|
||||
mount: (0.62, 0.4),
|
||||
pivot: NAMED_TUBE_PIVOT,
|
||||
muzzle: Muzzle::Grid(3, 2, 4.0),
|
||||
sensor: 585.0,
|
||||
mast: 5.0,
|
||||
};
|
||||
|
||||
const UNIT_SPEC_BUK: SamSpec = SamSpec {
|
||||
name: "Бук-М2",
|
||||
key: "buk",
|
||||
missile: Some(MissileLoad { kind: MissileKind::M9m317, magazine: 4, min: 20.0, max: 675.0, interval: 18 }),
|
||||
gun: None,
|
||||
reload: 400,
|
||||
scale: 1.4,
|
||||
rest_pitch: 0.0,
|
||||
roles: 14,
|
||||
family: Family::Turret,
|
||||
parts: Parts {
|
||||
body: "airdef:buk_chassis",
|
||||
launcher: Some("airdef:buk_turret"),
|
||||
pack: Some("airdef:buk_rails"),
|
||||
dish: None,
|
||||
fixed: &[],
|
||||
spinner: None,
|
||||
},
|
||||
mount: (1.55, 0.2),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::Rails(&[-9.0, -3.0, 13.0, 19.0]),
|
||||
sensor: 878.0,
|
||||
mast: 4.0,
|
||||
};
|
||||
|
||||
const UNIT_SPEC_TOR: SamSpec = SamSpec {
|
||||
name: "Тор-М2",
|
||||
key: "tor",
|
||||
missile: Some(MissileLoad { kind: MissileKind::M9m338, magazine: 8, min: 8.0, max: 240.0, interval: 8 }),
|
||||
gun: None,
|
||||
reload: 300,
|
||||
scale: 1.3,
|
||||
rest_pitch: 0.0,
|
||||
roles: 15,
|
||||
family: Family::Vertical,
|
||||
parts: Parts {
|
||||
body: "airdef:tor_chassis",
|
||||
launcher: Some("airdef:tor_turret"),
|
||||
pack: None,
|
||||
dish: None,
|
||||
fixed: &[],
|
||||
spinner: None,
|
||||
},
|
||||
mount: (1.5, 0.0),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::Cells,
|
||||
sensor: 315.0,
|
||||
mast: 3.5,
|
||||
};
|
||||
|
||||
const UNIT_SPEC_P1SUN: SamSpec = SamSpec {
|
||||
name: "P1-SUN",
|
||||
key: "p1sun",
|
||||
missile: Some(MissileLoad { kind: MissileKind::P1sun, magazine: 8, min: 5.0, max: 675.0, interval: 12 }),
|
||||
gun: None,
|
||||
reload: 240,
|
||||
scale: 1.1,
|
||||
rest_pitch: 0.35,
|
||||
roles: 1,
|
||||
family: Family::Trainable,
|
||||
parts: Parts {
|
||||
body: "airdef:nasams_trailer",
|
||||
launcher: Some("airdef:p1sun_launcher"),
|
||||
pack: None,
|
||||
dish: None,
|
||||
fixed: &[],
|
||||
spinner: None,
|
||||
},
|
||||
mount: (0.6, 0.3),
|
||||
pivot: NAMED_TUBE_PIVOT,
|
||||
muzzle: Muzzle::Grid(4, 2, 3.0),
|
||||
sensor: 0.0,
|
||||
mast: 2.0,
|
||||
};
|
||||
|
||||
const UNIT_SPEC_RADAR: SamSpec = SamSpec {
|
||||
name: "РЛС дальнего обнаружения",
|
||||
key: "radar",
|
||||
missile: None,
|
||||
gun: None,
|
||||
reload: 0,
|
||||
scale: 1.5,
|
||||
rest_pitch: 0.0,
|
||||
roles: 0,
|
||||
family: Family::Static,
|
||||
parts: Parts {
|
||||
body: "airdef:radar_truck",
|
||||
launcher: None,
|
||||
pack: None,
|
||||
dish: None,
|
||||
fixed: &[],
|
||||
spinner: Some(("airdef:radar_panel", 1.2, 1.2, 1.5, -0.25)),
|
||||
},
|
||||
mount: (0.0, 0.0),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::None,
|
||||
sensor: 2550.0,
|
||||
mast: 16.0,
|
||||
};
|
||||
|
||||
const UNIT_SPEC_DEPOT: SamSpec = SamSpec {
|
||||
name: "Склад боеприпасов",
|
||||
key: "depot",
|
||||
missile: None,
|
||||
gun: None,
|
||||
reload: 0,
|
||||
scale: 1.5,
|
||||
rest_pitch: 0.0,
|
||||
roles: 0,
|
||||
family: Family::Static,
|
||||
parts: Parts {
|
||||
body: "airdef:depot",
|
||||
launcher: None,
|
||||
pack: None,
|
||||
dish: None,
|
||||
fixed: &[],
|
||||
spinner: None,
|
||||
},
|
||||
mount: (0.0, 0.0),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::None,
|
||||
sensor: 0.0,
|
||||
mast: 1.0,
|
||||
};
|
||||
|
||||
const UNIT_SPEC_TZM: SamSpec = SamSpec {
|
||||
name: "ТЗМ",
|
||||
key: "tzm",
|
||||
missile: None,
|
||||
gun: None,
|
||||
reload: 0,
|
||||
scale: 1.3,
|
||||
rest_pitch: 0.0,
|
||||
roles: 0,
|
||||
family: Family::Truck,
|
||||
parts: Parts {
|
||||
body: "airdef:tzm_truck",
|
||||
launcher: None,
|
||||
pack: None,
|
||||
dish: None,
|
||||
fixed: &[],
|
||||
spinner: None,
|
||||
},
|
||||
mount: (0.0, 0.0),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::None,
|
||||
sensor: 0.0,
|
||||
mast: 2.0,
|
||||
};
|
||||
|
||||
const UNIT_SPEC_EW: SamSpec = SamSpec {
|
||||
name: "Станция РЭБ",
|
||||
key: "ew",
|
||||
missile: None,
|
||||
gun: None,
|
||||
reload: 0,
|
||||
scale: 1.3,
|
||||
rest_pitch: 0.0,
|
||||
roles: 0,
|
||||
family: Family::Static,
|
||||
parts: Parts {
|
||||
body: "airdef:ew_truck",
|
||||
launcher: None,
|
||||
pack: None,
|
||||
dish: None,
|
||||
fixed: &[],
|
||||
spinner: None,
|
||||
},
|
||||
mount: (0.0, 0.0),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::None,
|
||||
sensor: 0.0,
|
||||
mast: 3.0,
|
||||
};
|
||||
|
||||
const UNIT_SPEC_LIGHT: SamSpec = SamSpec {
|
||||
name: "Прожектор",
|
||||
key: "light",
|
||||
missile: None,
|
||||
gun: None,
|
||||
reload: 0,
|
||||
scale: 1.2,
|
||||
rest_pitch: 0.6,
|
||||
roles: 0,
|
||||
family: Family::Light,
|
||||
parts: Parts {
|
||||
body: "airdef:searchlight",
|
||||
launcher: Some("airdef:searchlight_head"),
|
||||
pack: None,
|
||||
dish: None,
|
||||
fixed: &[],
|
||||
spinner: None,
|
||||
},
|
||||
mount: (0.85, 0.0),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::None,
|
||||
sensor: 0.0,
|
||||
mast: 1.5,
|
||||
};
|
||||
|
||||
impl SamKind {
|
||||
/// Its row of numbers from `catalog/specs.json`.
|
||||
pub fn spec(self) -> &'static SamSpec {
|
||||
match self {
|
||||
SamKind::Patriot => &UNIT_SPEC_PATRIOT,
|
||||
SamKind::Gepard => &UNIT_SPEC_GEPARD,
|
||||
SamKind::Pantsir => &UNIT_SPEC_PANTSIR,
|
||||
SamKind::S400 => &UNIT_SPEC_S400,
|
||||
SamKind::S500 => &UNIT_SPEC_S500,
|
||||
SamKind::IrisT => &UNIT_SPEC_IRIST,
|
||||
SamKind::Nasams => &UNIT_SPEC_NASAMS,
|
||||
SamKind::Buk => &UNIT_SPEC_BUK,
|
||||
SamKind::Tor => &UNIT_SPEC_TOR,
|
||||
SamKind::P1sun => &UNIT_SPEC_P1SUN,
|
||||
SamKind::Radar => &UNIT_SPEC_RADAR,
|
||||
SamKind::Depot => &UNIT_SPEC_DEPOT,
|
||||
SamKind::Tzm => &UNIT_SPEC_TZM,
|
||||
SamKind::Ew => &UNIT_SPEC_EW,
|
||||
SamKind::Light => &UNIT_SPEC_LIGHT,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Save keys by kind; a rename needs an explicit migration.
|
||||
#[cfg(test)]
|
||||
pub(super) const UNIT_SPEC_KEYS: [(SamKind, &str); 15] = [
|
||||
(SamKind::Patriot, "patriot"),
|
||||
(SamKind::Gepard, "gepard"),
|
||||
(SamKind::Pantsir, "pantsir"),
|
||||
(SamKind::S400, "s400"),
|
||||
(SamKind::S500, "s500"),
|
||||
(SamKind::IrisT, "irist"),
|
||||
(SamKind::Nasams, "nasams"),
|
||||
(SamKind::Buk, "buk"),
|
||||
(SamKind::Tor, "tor"),
|
||||
(SamKind::P1sun, "p1sun"),
|
||||
(SamKind::Radar, "radar"),
|
||||
(SamKind::Depot, "depot"),
|
||||
(SamKind::Tzm, "tzm"),
|
||||
(SamKind::Ew, "ew"),
|
||||
(SamKind::Light, "light"),
|
||||
];
|
||||
+4
-368
@@ -107,11 +107,6 @@ pub(super) struct Drive {
|
||||
pub pitch: (f64, f64),
|
||||
}
|
||||
|
||||
/// The drives are this share of the speeds they had before they had a speed of their own.
|
||||
const DRIVE_SCALE: f64 = 0.4;
|
||||
/// Ticks a drive takes to reach its top speed (and to stop from it).
|
||||
const DRIVE_RAMP: f64 = 8.0;
|
||||
|
||||
pub struct SamSpec {
|
||||
pub name: &'static str,
|
||||
pub key: &'static str,
|
||||
@@ -140,20 +135,16 @@ impl SamSpec {
|
||||
pub(super) fn drive(&self) -> Drive {
|
||||
let (yaw, pitch) = match (&self.gun, self.family) {
|
||||
(Some(g), _) => g.slew,
|
||||
(None, Family::Trainable) => (0.12, 0.0),
|
||||
(None, Family::Vertical) => (0.15, 0.0),
|
||||
(None, _) => (0.05, 0.05),
|
||||
(None, Family::Trainable) => DRIVE_TRAINABLE,
|
||||
(None, Family::Vertical) => DRIVE_VERTICAL,
|
||||
(None, _) => DRIVE_OTHER,
|
||||
};
|
||||
let axis = |speed: f64| (speed * DRIVE_SCALE, speed * DRIVE_SCALE / DRIVE_RAMP);
|
||||
Drive { yaw: axis(yaw), pitch: axis(pitch) }
|
||||
}
|
||||
}
|
||||
|
||||
const NO_PARTS: Parts = Parts { body: "", launcher: None, pack: None, dish: None, fixed: &[], spinner: None };
|
||||
/// The battery radar trailer behind a vertical launcher.
|
||||
const BATTERY_RADAR: &[(&str, f64, f64)] = &[("airdef:radar_trailer", 0.0, 4.2)];
|
||||
const BATTERY_SPINNER: Option<(&str, f64, f64, f64, f64)> = Some(("airdef:radar_panel", 0.9, 4.2, 0.9, -0.3));
|
||||
const TUBE_PIVOT: DVec3 = DVec3::new(0.0, -0.5, 1.5);
|
||||
include!("unit_specs_generated.rs");
|
||||
|
||||
impl SamKind {
|
||||
pub const ALL: [SamKind; super::catalog::UNIT_COUNT] = super::catalog::UNIT_KINDS;
|
||||
@@ -170,361 +161,6 @@ impl SamKind {
|
||||
SamKind::Tor,
|
||||
SamKind::P1sun,
|
||||
];
|
||||
pub fn spec(self) -> &'static SamSpec {
|
||||
match self {
|
||||
SamKind::Patriot => {
|
||||
const S: SamSpec = SamSpec {
|
||||
name: "Patriot",
|
||||
key: "patriot",
|
||||
missile: Some(MissileLoad { kind: MissileKind::Pac3, magazine: 4, min: 10.0, max: 450.0, interval: 16 }),
|
||||
gun: None,
|
||||
reload: 220,
|
||||
scale: 1.3,
|
||||
rest_pitch: 0.66,
|
||||
roles: 30,
|
||||
family: Family::Trainable,
|
||||
parts: Parts {
|
||||
body: "airdef:patriot_trailer",
|
||||
launcher: Some("airdef:patriot_launcher"),
|
||||
fixed: &[("airdef:patriot_truck", 0.0, -3.0), ("airdef:patriot_radar", 0.0, 3.6)],
|
||||
..NO_PARTS
|
||||
},
|
||||
mount: (0.69, 1.2),
|
||||
pivot: DVec3::new(0.0, -0.5, 1.375),
|
||||
muzzle: Muzzle::Patriot,
|
||||
sensor: 585.0,
|
||||
mast: 5.0,
|
||||
};
|
||||
&S
|
||||
}
|
||||
SamKind::Gepard => {
|
||||
const S: SamSpec = SamSpec {
|
||||
name: "Гепард",
|
||||
key: "gepard",
|
||||
missile: None,
|
||||
gun: Some(GunSpec { range: 135.0, track: 195.0, p: 0.3, bursts: 160, shell: 10.0, slew: (0.22, 0.16) }),
|
||||
reload: 160,
|
||||
scale: 1.25,
|
||||
rest_pitch: 0.0,
|
||||
roles: 7,
|
||||
family: Family::Gun,
|
||||
parts: Parts {
|
||||
body: "airdef:gepard_hull",
|
||||
launcher: Some("airdef:gepard_turret"),
|
||||
pack: Some("airdef:gepard_guns"),
|
||||
dish: Some(("airdef:gepard_dish", 0.95, 0.6, 0.0)),
|
||||
..NO_PARTS
|
||||
},
|
||||
mount: (1.55, 0.25),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::None,
|
||||
sensor: 255.0,
|
||||
mast: 3.0,
|
||||
};
|
||||
&S
|
||||
}
|
||||
SamKind::Pantsir => {
|
||||
const S: SamSpec = SamSpec {
|
||||
name: "Панцирь-С1",
|
||||
key: "pantsir",
|
||||
missile: Some(MissileLoad { kind: MissileKind::M57e6, magazine: 12, min: 25.0, max: 225.0, interval: 14 }),
|
||||
gun: Some(GunSpec { range: 90.0, track: 135.0, p: 0.25, bursts: 140, shell: 9.0, slew: (0.25, 0.18) }),
|
||||
reload: 280,
|
||||
scale: 1.3,
|
||||
rest_pitch: 0.0,
|
||||
roles: 15,
|
||||
family: Family::Turret,
|
||||
parts: Parts {
|
||||
body: "airdef:pantsir_truck",
|
||||
launcher: Some("airdef:pantsir_turret"),
|
||||
pack: Some("airdef:pantsir_pack"),
|
||||
dish: Some(("airdef:pantsir_dish", 0.85, 0.3, 0.3)),
|
||||
..NO_PARTS
|
||||
},
|
||||
mount: (1.35, 0.69),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::Pantsir,
|
||||
sensor: 292.0,
|
||||
mast: 4.0,
|
||||
};
|
||||
&S
|
||||
}
|
||||
SamKind::S400 => {
|
||||
const S: SamSpec = SamSpec {
|
||||
name: "С-400",
|
||||
key: "s400",
|
||||
missile: Some(MissileLoad { kind: MissileKind::M48n6, magazine: 4, min: 30.0, max: 720.0, interval: 20 }),
|
||||
gun: None,
|
||||
reload: 420,
|
||||
scale: 1.5,
|
||||
rest_pitch: HALF_PI - 0.02,
|
||||
roles: 30,
|
||||
family: Family::Vertical,
|
||||
parts: Parts {
|
||||
body: "airdef:s400_chassis",
|
||||
launcher: Some("airdef:s400_tubes"),
|
||||
fixed: BATTERY_RADAR,
|
||||
spinner: BATTERY_SPINNER,
|
||||
..NO_PARTS
|
||||
},
|
||||
mount: (0.7, 1.45),
|
||||
pivot: TUBE_PIVOT,
|
||||
muzzle: Muzzle::Grid(2, 2, 7.0),
|
||||
sensor: 936.0,
|
||||
mast: 5.0,
|
||||
};
|
||||
&S
|
||||
}
|
||||
SamKind::S500 => {
|
||||
const S: SamSpec = SamSpec {
|
||||
name: "С-500",
|
||||
key: "s500",
|
||||
missile: Some(MissileLoad { kind: MissileKind::M77n6, magazine: 2, min: 40.0, max: 1050.0, interval: 20 }),
|
||||
gun: None,
|
||||
reload: 520,
|
||||
scale: 1.6,
|
||||
rest_pitch: HALF_PI - 0.02,
|
||||
roles: 24,
|
||||
family: Family::Vertical,
|
||||
parts: Parts {
|
||||
body: "airdef:s500_chassis",
|
||||
launcher: Some("airdef:s500_tubes"),
|
||||
fixed: BATTERY_RADAR,
|
||||
spinner: BATTERY_SPINNER,
|
||||
..NO_PARTS
|
||||
},
|
||||
mount: (0.7, 1.45),
|
||||
pivot: TUBE_PIVOT,
|
||||
muzzle: Muzzle::Grid(2, 1, 9.5),
|
||||
sensor: 1365.0,
|
||||
mast: 5.0,
|
||||
};
|
||||
&S
|
||||
}
|
||||
SamKind::IrisT => {
|
||||
const S: SamSpec = SamSpec {
|
||||
name: "IRIS-T SLM",
|
||||
key: "irist",
|
||||
missile: Some(MissileLoad { kind: MissileKind::IrisT, magazine: 8, min: 15.0, max: 600.0, interval: 10 }),
|
||||
gun: None,
|
||||
reload: 300,
|
||||
scale: 1.4,
|
||||
rest_pitch: HALF_PI - 0.02,
|
||||
roles: 15,
|
||||
family: Family::Vertical,
|
||||
parts: Parts {
|
||||
body: "airdef:irist_chassis",
|
||||
launcher: Some("airdef:irist_tubes"),
|
||||
fixed: BATTERY_RADAR,
|
||||
spinner: BATTERY_SPINNER,
|
||||
..NO_PARTS
|
||||
},
|
||||
mount: (0.7, 1.45),
|
||||
pivot: TUBE_PIVOT,
|
||||
muzzle: Muzzle::Grid(4, 2, 4.0),
|
||||
sensor: 780.0,
|
||||
mast: 5.0,
|
||||
};
|
||||
&S
|
||||
}
|
||||
SamKind::Nasams => {
|
||||
const S: SamSpec = SamSpec {
|
||||
name: "NASAMS",
|
||||
key: "nasams",
|
||||
missile: Some(MissileLoad { kind: MissileKind::Amraam, magazine: 6, min: 10.0, max: 450.0, interval: 14 }),
|
||||
gun: None,
|
||||
reload: 260,
|
||||
scale: 1.3,
|
||||
rest_pitch: 0.5,
|
||||
roles: 14,
|
||||
family: Family::Trainable,
|
||||
parts: Parts {
|
||||
body: "airdef:nasams_trailer",
|
||||
launcher: Some("airdef:nasams_launcher"),
|
||||
fixed: &[("airdef:radar_trailer", 0.0, 3.4)],
|
||||
spinner: Some(("airdef:radar_panel", 0.9, 3.4, 0.6, -0.3)),
|
||||
..NO_PARTS
|
||||
},
|
||||
mount: (0.62, 0.4),
|
||||
pivot: TUBE_PIVOT,
|
||||
muzzle: Muzzle::Grid(3, 2, 4.0),
|
||||
sensor: 585.0,
|
||||
mast: 5.0,
|
||||
};
|
||||
&S
|
||||
}
|
||||
SamKind::Buk => {
|
||||
const S: SamSpec = SamSpec {
|
||||
name: "Бук-М2",
|
||||
key: "buk",
|
||||
missile: Some(MissileLoad { kind: MissileKind::M9m317, magazine: 4, min: 20.0, max: 675.0, interval: 18 }),
|
||||
gun: None,
|
||||
reload: 400,
|
||||
scale: 1.4,
|
||||
rest_pitch: 0.0,
|
||||
roles: 14,
|
||||
family: Family::Turret,
|
||||
parts: Parts {
|
||||
body: "airdef:buk_chassis",
|
||||
launcher: Some("airdef:buk_turret"),
|
||||
pack: Some("airdef:buk_rails"),
|
||||
..NO_PARTS
|
||||
},
|
||||
mount: (1.55, 0.2),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::Rails(&[-9.0, -3.0, 13.0, 19.0]),
|
||||
sensor: 878.0,
|
||||
mast: 4.0,
|
||||
};
|
||||
&S
|
||||
}
|
||||
SamKind::Tor => {
|
||||
const S: SamSpec = SamSpec {
|
||||
name: "Тор-М2",
|
||||
key: "tor",
|
||||
missile: Some(MissileLoad { kind: MissileKind::M9m338, magazine: 8, min: 8.0, max: 240.0, interval: 8 }),
|
||||
gun: None,
|
||||
reload: 300,
|
||||
scale: 1.3,
|
||||
rest_pitch: 0.0,
|
||||
roles: 15,
|
||||
family: Family::Vertical,
|
||||
parts: Parts { body: "airdef:tor_chassis", launcher: Some("airdef:tor_turret"), ..NO_PARTS },
|
||||
mount: (1.5, 0.0),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::Cells,
|
||||
sensor: 315.0,
|
||||
mast: 3.5,
|
||||
};
|
||||
&S
|
||||
}
|
||||
SamKind::P1sun => {
|
||||
const S: SamSpec = SamSpec {
|
||||
name: "P1-SUN",
|
||||
key: "p1sun",
|
||||
missile: Some(MissileLoad { kind: MissileKind::P1sun, magazine: 8, min: 5.0, max: 675.0, interval: 12 }),
|
||||
gun: None,
|
||||
reload: 240,
|
||||
scale: 1.1,
|
||||
rest_pitch: 0.35,
|
||||
roles: 1,
|
||||
family: Family::Trainable,
|
||||
parts: Parts { body: "airdef:nasams_trailer", launcher: Some("airdef:p1sun_launcher"), ..NO_PARTS },
|
||||
mount: (0.6, 0.3),
|
||||
pivot: TUBE_PIVOT,
|
||||
muzzle: Muzzle::Grid(4, 2, 3.0),
|
||||
// No radar of its own: it fires on the network's tracks.
|
||||
sensor: 0.0,
|
||||
mast: 2.0,
|
||||
};
|
||||
&S
|
||||
}
|
||||
SamKind::Radar => {
|
||||
const S: SamSpec = SamSpec {
|
||||
name: "РЛС дальнего обнаружения",
|
||||
key: "radar",
|
||||
missile: None,
|
||||
gun: None,
|
||||
reload: 0,
|
||||
scale: 1.5,
|
||||
rest_pitch: 0.0,
|
||||
roles: 0,
|
||||
family: Family::Static,
|
||||
parts: Parts {
|
||||
body: "airdef:radar_truck",
|
||||
spinner: Some(("airdef:radar_panel", 1.2, 1.2, 1.5, -0.25)),
|
||||
..NO_PARTS
|
||||
},
|
||||
mount: (0.0, 0.0),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::None,
|
||||
sensor: 2550.0,
|
||||
mast: 16.0,
|
||||
};
|
||||
&S
|
||||
}
|
||||
SamKind::Depot => {
|
||||
const S: SamSpec = SamSpec {
|
||||
name: "Склад боеприпасов",
|
||||
key: "depot",
|
||||
missile: None,
|
||||
gun: None,
|
||||
reload: 0,
|
||||
scale: 1.5,
|
||||
rest_pitch: 0.0,
|
||||
roles: 0,
|
||||
family: Family::Static,
|
||||
parts: Parts { body: "airdef:depot", ..NO_PARTS },
|
||||
mount: (0.0, 0.0),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::None,
|
||||
sensor: 0.0,
|
||||
mast: 1.0,
|
||||
};
|
||||
&S
|
||||
}
|
||||
SamKind::Tzm => {
|
||||
const S: SamSpec = SamSpec {
|
||||
name: "ТЗМ",
|
||||
key: "tzm",
|
||||
missile: None,
|
||||
gun: None,
|
||||
reload: 0,
|
||||
scale: 1.3,
|
||||
rest_pitch: 0.0,
|
||||
roles: 0,
|
||||
family: Family::Truck,
|
||||
parts: Parts { body: "airdef:tzm_truck", ..NO_PARTS },
|
||||
mount: (0.0, 0.0),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::None,
|
||||
sensor: 0.0,
|
||||
mast: 2.0,
|
||||
};
|
||||
&S
|
||||
}
|
||||
SamKind::Ew => {
|
||||
const S: SamSpec = SamSpec {
|
||||
name: "Станция РЭБ",
|
||||
key: "ew",
|
||||
missile: None,
|
||||
gun: None,
|
||||
reload: 0,
|
||||
scale: 1.3,
|
||||
rest_pitch: 0.0,
|
||||
roles: 0,
|
||||
family: Family::Static,
|
||||
parts: Parts { body: "airdef:ew_truck", ..NO_PARTS },
|
||||
mount: (0.0, 0.0),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::None,
|
||||
sensor: 0.0,
|
||||
mast: 3.0,
|
||||
};
|
||||
&S
|
||||
}
|
||||
SamKind::Light => {
|
||||
const S: SamSpec = SamSpec {
|
||||
name: "Прожектор",
|
||||
key: "light",
|
||||
missile: None,
|
||||
gun: None,
|
||||
reload: 0,
|
||||
scale: 1.2,
|
||||
rest_pitch: 0.6,
|
||||
roles: 0,
|
||||
family: Family::Light,
|
||||
parts: Parts { body: "airdef:searchlight", launcher: Some("airdef:searchlight_head"), ..NO_PARTS },
|
||||
mount: (0.85, 0.0),
|
||||
pivot: DVec3::ZERO,
|
||||
muzzle: Muzzle::None,
|
||||
sensor: 0.0,
|
||||
mast: 1.5,
|
||||
};
|
||||
&S
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn name(self) -> &'static str {
|
||||
self.spec().name
|
||||
}
|
||||
|
||||
@@ -18,20 +18,7 @@ impl MissileKind {
|
||||
/// The sound of its motor, its gain and its pitch: a rocket's roar, or the electric whine of
|
||||
/// a motor without a flame.
|
||||
pub fn engine_voice(self) -> (&'static str, f32, f32) {
|
||||
if self.spec().flame == 0.0 {
|
||||
return (super::catalog::sound::DRONE_LANCET, 0.8, 1.6);
|
||||
}
|
||||
let pitch = match self {
|
||||
MissileKind::Pac3 => 1.0,
|
||||
MissileKind::M57e6 => 1.12,
|
||||
MissileKind::M48n6 => 0.88,
|
||||
MissileKind::M77n6 => 0.8,
|
||||
MissileKind::IrisT | MissileKind::Amraam => 1.05,
|
||||
MissileKind::M9m317 => 0.9,
|
||||
MissileKind::M9m338 => 1.15,
|
||||
MissileKind::P1sun => 1.7,
|
||||
};
|
||||
(super::catalog::sound::MISSILE_FLIGHT, 1.0, pitch)
|
||||
self.spec().voice
|
||||
}
|
||||
/// Ticks from the launch until the motor lights (a cold launch throws it out of the tube first).
|
||||
pub fn lit_after(self) -> u32 {
|
||||
|
||||
Reference in New Issue
Block a user