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

Implement non-multiplayer parts of custom games

This commit is contained in:
NG (Graham)
2026-03-12 22:44:04 -04:00
parent 6ce456a739
commit af04c4093c
34 changed files with 1751 additions and 78 deletions

View File

@@ -1,11 +1,20 @@
use polariton_server::operations::SimpleFunc;
use polariton::{operation::{Dict, ParameterTable, Typed}, serdes::TypePrefix};
use crate::data::custom_games::*;
const MODE_MAP_PARAM_KEY: u8 = 170;
const MAP_NAMES_PARAM_KEY: u8 = 178;
const ALL_MAPS: &[&str] = &[
"RC_Planet_Mars_01_CTF", // og flat mars
"RC_Planet_Mars_02_BA", // the one with the bridge in the middle
"RC_Planet_Mars_03_BA", // tharsis rift without the rift
"RC_Planet_Neptune_01_CTF", // og flat GJ1214b gliese lake without the lake
"RC_Planet_Neptune_02_BA", // the one with the cave
"RC_Planet_Neptune_03_BA", // spitzer dam
"RC_Planet_Earth_01_BA", // birmingham power station
"RC_Planet_Earth_02_BA", // vanguard
];
pub(super) fn allowed_maps_provider() -> SimpleFunc<146, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
SimpleFunc::new(|params, _| {
let mut params = params.to_dict();
@@ -13,19 +22,33 @@ pub(super) fn allowed_maps_provider() -> SimpleFunc<146, crate::UserTy, impl (Fn
key_ty: TypePrefix::Str, // str
val_ty: TypePrefix::ObjArr, // obj arr
items: vec![
(Typed::Str(GameMode::BattleArena.as_str().into()), Typed::ObjArr(vec![
Typed::Str("RC_Planet_Neptune_02_BA".into()),
Typed::Str("RC_Planet_Mars_03_BA".into()),
Typed::Str("RC_Planet_Mars_02_BA".into()),
Typed::Str("RC_Planet_Earth_02_BA".into()),
Typed::Str("RC_Planet_Earth_01_BA".into()),
Typed::Str("RC_Planet_Neptune_03_BA".into()),
].into())
(Typed::Str(oj_rc_core::data::game_mode::GameMode::BattleArena.as_str().into()), Typed::ObjArr(
ALL_MAPS.iter()
.map(|x| Typed::Str(x.into()))
.collect::<Vec<_>>()
.into()
)
),
(Typed::Str(GameMode::TeamDeathmatch.as_str().into()), Typed::ObjArr(vec![
Typed::Str("RC_Planet_Neptune_01_CTF".into()),
Typed::Str("RC_Planet_Mars_01_CTF".into()),
].into())
(Typed::Str(oj_rc_core::data::game_mode::GameMode::TeamDeathmatch.as_str().into()), Typed::ObjArr(
ALL_MAPS.iter()
.map(|x| Typed::Str(x.into()))
.collect::<Vec<_>>()
.into()
)
),
(Typed::Str(oj_rc_core::data::game_mode::GameMode::Pit.as_str().into()), Typed::ObjArr(
ALL_MAPS.iter()
.map(|x| Typed::Str(x.into()))
.collect::<Vec<_>>()
.into()
)
),
(Typed::Str(oj_rc_core::data::game_mode::GameMode::SuddenDeath.as_str().into()), Typed::ObjArr(
ALL_MAPS.iter()
.map(|x| Typed::Str(x.into()))
.collect::<Vec<_>>()
.into()
)
),
],
}));