1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Add equalizer support and partial fast-charge (dominating) support #32

This commit is contained in:
NG (Graham)
2025-09-07 15:50:56 -04:00
parent 35c6f136f6
commit 4639778eeb
6 changed files with 457 additions and 19 deletions

View File

@@ -418,10 +418,16 @@ impl <C: Clone + Send> super::ConfigProvider<C> for CubeConfig {
z: point.z,
}
}, point.percent_per_second)).collect();
let equalizer = super::Point {
x: conf.equalizer.x,
y: conf.equalizer.y,
z: conf.equalizer.z,
};
let map_conf = super::MapConfig {
spawns,
bases,
capture_points,
equalizer,
};
(map.into_conf(), map_conf)
}).collect()

View File

@@ -361,6 +361,7 @@ pub struct MapConfig {
pub spawns: std::collections::HashMap<u8, Vec<Point>>, // team -> points
pub bases: std::collections::HashMap<u8, (Sphere, f32)>, // team -> (base, capture speed)
pub capture_points: Vec<(Sphere, f32)>, // (capture point, capture speed)
pub equalizer: Point,
}
#[derive(Clone, Debug)]
@@ -404,9 +405,13 @@ impl BattleArenaResolver {
base_machine_map: base_data.robot_map,
equalizer_model: equalizer_data.robot_map,
equalizer_health: self.data.equalizer_health as i64,
equalizer_trigger_time_seconds: vec![10, 10, 10, 10, 10], // TODO
equalizer_trigger_time_seconds: if let Some(trigger_time) = self.data.equalizer_trigger_time_s {
vec![trigger_time; 5]
} else {
Vec::default()
},
equalizer_warning_seconds: self.data.equalizer_warning_s as i64, // TODO
equalizer_duration_seconds: vec![20, 20, 20, 20, 20], // TODO
equalizer_duration_seconds: vec![self.data.equalizer_duration_s; 5],
capture_time_seconds_per_player: vec![30, 20, 10, 5, 1], // TODO
num_segments: self.data.num_segments as i32,
heal_escalation_time_seconds: 5, // Unused?

View File

@@ -11,6 +11,7 @@ pub struct MapConfig {
pub spawn_points: Vec<SpawnPoint>,
pub bases: Vec<CaptureBase>,
pub capture_points: Vec<CapturePoint>,
pub equalizer: Point,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
@@ -92,6 +93,33 @@ impl CapturePoint {
}
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Point {
pub x: f32,
pub y: f32,
pub z: f32,
}
impl Point {
#[allow(dead_code)]
const fn offset(mut self, x: f32, y: f32, z: f32) -> Self {
self.x += x;
self.y += y;
self.z += z;
self
}
#[allow(dead_code)]
fn rotated(mut self, rot: num_quaternion::Quaternion<f32>) -> Self {
let unit_rot = rot.normalize().expect("Bad rotation quaternion for Point");
let rotated = unit_rot.rotate_vector([self.x, self.y, self.z]);
self.x = rotated[0];
self.y = rotated[1];
self.z = rotated[2];
self
}
}
const DEFAULT_BASE_PERCENT_PER_SECOND: f32 = 2.5;
const DEFAULT_BASE_RADIUS: f32 = 20.0;
const DEFAULT_CAPTURE_PERCENT_PER_SECOND: f32 = DEFAULT_BASE_PERCENT_PER_SECOND * 1.5;
@@ -273,6 +301,11 @@ pub(super) fn default_map() -> std::collections::HashMap<super::combat::GameMap,
y: 0.707107,
z: 0.0,
}).offset(13.320, 0.0, -9.84)).collect(),
equalizer: Point {
x: 1.404,
y: 14.3,
z: -0.588,
},
});
map.insert(super::combat::GameMap::Earth2, MapConfig { // level4
spawn_points: vec![
@@ -483,6 +516,11 @@ pub(super) fn default_map() -> std::collections::HashMap<super::combat::GameMap,
},
],
capture_points: vec![], // TODO
equalizer: Point { // TODO
x: 0.0,
y: 0.0,
z: 0.0,
},
});
map.insert(super::combat::GameMap::Mars1, MapConfig {
spawn_points: vec![
@@ -628,6 +666,11 @@ pub(super) fn default_map() -> std::collections::HashMap<super::combat::GameMap,
},
],
capture_points: vec![], // TODO
equalizer: Point { // TODO
x: 0.0,
y: 0.0,
z: 0.0,
},
});
map.insert(super::combat::GameMap::Mars2, MapConfig {
spawn_points: vec![
@@ -773,6 +816,11 @@ pub(super) fn default_map() -> std::collections::HashMap<super::combat::GameMap,
},
].into_iter().map(|x| x.offset(-434.640, 0.0, -414.720)).collect(),
capture_points: vec![], // TODO
equalizer: Point { // TODO
x: 0.0,
y: 0.0,
z: 0.0,
},
});
map.insert(super::combat::GameMap::Mars3, MapConfig {
spawn_points: vec![
@@ -918,6 +966,11 @@ pub(super) fn default_map() -> std::collections::HashMap<super::combat::GameMap,
},
].into_iter().map(|x| x.offset(49.608, 0.0, 52.493)).collect(),
capture_points: vec![], // TODO
equalizer: Point { // TODO
x: 0.0,
y: 0.0,
z: 0.0,
},
});
map.insert(super::combat::GameMap::Neptune1, MapConfig {
spawn_points: vec![
@@ -1063,6 +1116,11 @@ pub(super) fn default_map() -> std::collections::HashMap<super::combat::GameMap,
},
].into_iter().map(|x| x.offset(405.542, 0.0, 10.668)).collect(),
capture_points: vec![], // TODO
equalizer: Point { // TODO
x: 0.0,
y: 0.0,
z: 0.0,
},
});
map.insert(super::combat::GameMap::Neptune2, MapConfig {
spawn_points: vec![
@@ -1208,6 +1266,11 @@ pub(super) fn default_map() -> std::collections::HashMap<super::combat::GameMap,
},
],
capture_points: vec![], // TODO
equalizer: Point { // TODO
x: 0.0,
y: 0.0,
z: 0.0,
},
});
map.insert(super::combat::GameMap::Neptune3, MapConfig {
spawn_points: vec![
@@ -1353,6 +1416,11 @@ pub(super) fn default_map() -> std::collections::HashMap<super::combat::GameMap,
},
],
capture_points: vec![], // TODO
equalizer: Point { // TODO
x: 0.0,
y: 0.0,
z: 0.0,
},
});
map
}

View File

@@ -97,7 +97,7 @@ pub struct BattleArenaConfig {
pub equalizer: super::garage::PrefabVehicle,
#[serde(default = "default_equalizer_health")]
pub equalizer_health: u64,
//pub equalizer_trigger_time_s: Vec<u64>,
pub equalizer_trigger_time_s: Option<u64>,
#[serde(default = "default_equalizer_warning")]
pub equalizer_warning_s: u64,
#[serde(default = "default_equalizer_duration")]
@@ -114,6 +114,7 @@ pub(super) fn default_ba_conf() -> BattleArenaConfig {
respawn_time_s: default_respawn_time(),
equalizer: default_equalizer(),
equalizer_health: default_equalizer_health(),
equalizer_trigger_time_s: None,
equalizer_warning_s: default_equalizer_warning(),
equalizer_duration_s: default_equalizer_duration(),
base: default_ba_base(),
@@ -154,7 +155,7 @@ fn default_respawn_time() -> u64 {
}
fn default_equalizer_health() -> u64 {
1_000
1_000_000
}
fn default_equalizer_warning() -> u64 {