2025-02-23 16:10:21 -05:00
|
|
|
use polariton_server::operations::SimpleFunc;
|
2025-03-08 17:16:02 -05:00
|
|
|
use polariton::{operation::{Arr, ParameterTable, Typed}, serdes::TypePrefix};
|
2025-02-23 16:10:21 -05:00
|
|
|
|
|
|
|
|
use crate::data::custom_games::*;
|
|
|
|
|
|
|
|
|
|
const MAP_NAMES_PARAM_KEY: u8 = 78;
|
|
|
|
|
const VISIBILITY_PARAM_KEY: u8 = 66;
|
|
|
|
|
const MODE_PARAM_KEY: u8 = 136;
|
|
|
|
|
const AUTO_HEAL_PARAM_KEY: u8 = 37;
|
|
|
|
|
const REMAINING_TICKS_PARAM_KEY: u8 = 145;
|
|
|
|
|
|
|
|
|
|
pub(super) fn event_system_params_provider() -> SimpleFunc<24, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
|
|
|
|
|
SimpleFunc::new(|params, _| {
|
|
|
|
|
let mut params = params.to_dict();
|
|
|
|
|
params.insert(MAP_NAMES_PARAM_KEY, Typed::Arr(Arr {
|
2025-03-08 17:16:02 -05:00
|
|
|
ty: TypePrefix::Str, // str
|
2025-02-23 16:10:21 -05:00
|
|
|
items: vec![
|
2025-03-02 09:52:44 -05:00
|
|
|
Typed::Str("RC_Planet_Neptune_03_BA".into()),
|
|
|
|
|
Typed::Str("RC_Planet_Earth_01_BA".into()),
|
2025-02-23 16:10:21 -05:00
|
|
|
],
|
|
|
|
|
}));
|
|
|
|
|
params.insert(VISIBILITY_PARAM_KEY, Typed::Arr(Arr {
|
2025-03-08 17:16:02 -05:00
|
|
|
ty: TypePrefix::Int, // int
|
2025-02-23 16:10:21 -05:00
|
|
|
items: vec![
|
|
|
|
|
Typed::Int(GameMode::BattleArena as _),
|
|
|
|
|
Typed::Int(GameMode::BattleArena as _),
|
|
|
|
|
],
|
|
|
|
|
}));
|
|
|
|
|
params.insert(MODE_PARAM_KEY, Typed::Arr(Arr {
|
2025-03-08 17:16:02 -05:00
|
|
|
ty: TypePrefix::Int, // int
|
2025-02-23 16:10:21 -05:00
|
|
|
items: vec![
|
|
|
|
|
Typed::Int(MapVisibility::Good as _),
|
|
|
|
|
Typed::Int(MapVisibility::Bad as _),
|
|
|
|
|
],
|
|
|
|
|
}));
|
|
|
|
|
params.insert(AUTO_HEAL_PARAM_KEY, Typed::Arr(Arr {
|
2025-03-08 17:16:02 -05:00
|
|
|
ty: TypePrefix::Bool, // bool
|
2025-02-23 16:10:21 -05:00
|
|
|
items: vec![
|
|
|
|
|
Typed::Bool(true.into()),
|
|
|
|
|
Typed::Bool(false.into()),
|
|
|
|
|
],
|
|
|
|
|
}));
|
|
|
|
|
params.insert(REMAINING_TICKS_PARAM_KEY, Typed::Long(1_000_000));
|
|
|
|
|
Ok(params.into())
|
|
|
|
|
})
|
|
|
|
|
}
|