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

Implement basic battle arena functionality #32

This commit is contained in:
NG (Graham)
2025-08-30 21:36:01 -04:00
parent 1403a6e3d0
commit 7f9ed8bf35
41 changed files with 1836 additions and 327 deletions

View File

@@ -1,44 +0,0 @@
use polariton::operation::Typed;
use base64::{Engine, engine::general_purpose::STANDARD};
pub struct BattleArenaData {
pub protonium_health: i64,
pub respawn_time_seconds: i64,
pub heal_over_time_per_tower: Vec<u64>,
pub base_machine_map: Vec<u8>, // aka team base model, converted into base64
pub equalizer_model: Vec<u8>, // converted into base64
pub equalizer_health: i64,
pub equalizer_trigger_time_seconds: Vec<u64>,
pub equalizer_warning_seconds: i64,
pub equalizer_duration_seconds: Vec<u64>,
pub capture_time_seconds_per_player: Vec<i64>,
pub num_segments: i32,
pub heal_escalation_time_seconds: i64,
}
fn to_obj_arr_u(slice: &[u64]) -> Typed {
Typed::ObjArr(slice.iter().map(|x| Typed::Long(*x as i64)).collect::<Vec<Typed>>().into())
}
fn to_obj_arr_i(slice: &[i64]) -> Typed {
Typed::ObjArr(slice.iter().map(|x| Typed::Long(*x)).collect::<Vec<Typed>>().into())
}
impl BattleArenaData {
pub fn as_transmissible(&self) -> Typed {
Typed::HashMap(vec![
(Typed::Str("protoniumHealth".into()), Typed::Long(self.protonium_health)),
(Typed::Str("respawnTimeSeconds".into()), Typed::Long(self.respawn_time_seconds)),
(Typed::Str("healOverTimePerTower".into()), to_obj_arr_u(&self.heal_over_time_per_tower)),
(Typed::Str("baseMachineMap".into()), Typed::Str(STANDARD.encode(&self.base_machine_map).into())),
(Typed::Str("equalizerModel".into()), Typed::Str(STANDARD.encode(&self.equalizer_model).into())),
(Typed::Str("equalizerHealth".into()), Typed::Long(self.equalizer_health)),
(Typed::Str("equalizerTriggerTimeSeconds".into()), to_obj_arr_u(&self.equalizer_trigger_time_seconds)),
(Typed::Str("equalizerWarningSeconds".into()), Typed::Long(self.equalizer_warning_seconds)),
(Typed::Str("equalizerDurationSeconds".into()), to_obj_arr_u(&self.equalizer_duration_seconds)),
(Typed::Str("captureTimeSecondsPerPlayer".into()), to_obj_arr_i(&self.capture_time_seconds_per_player)),
(Typed::Str("numSegments".into()), Typed::Int(self.num_segments)),
(Typed::Str("healEscalationTimeSeconds".into()), Typed::Long(self.heal_escalation_time_seconds)),
].into())
}
}

View File

@@ -7,7 +7,7 @@ pub mod crf_config;
pub use oj_rc_core::data::weapon_list;
//pub use oj_rc_core::data::movement_list;
pub mod damage_boost;
pub mod battle_arena_config;
//pub mod battle_arena_config;
pub mod cpu_limits;
pub mod cosmetic_limits;
pub mod taunts_config;