mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Implement non-event part of singleplayer for #7
This commit is contained in:
@@ -20,7 +20,7 @@ pub(super) fn all_customisations_provider() -> SimpleFunc<216, crate::UserTy, im
|
||||
items: vec![
|
||||
CustomisationData {
|
||||
id: "RC_MothershipSkin_Neptune_01".to_string(),
|
||||
localised_name: "Neptune 01".to_string(),
|
||||
localised_name: "strNeptune".to_string(),
|
||||
skin_scene_name: "RC_MothershipSkin_Neptune_01".to_string(),
|
||||
simulation_prefab: "TODO_sim_prefab".to_string(),
|
||||
preview_image_name: "TODO_preview_img".to_string(),
|
||||
@@ -31,12 +31,61 @@ pub(super) fn all_customisations_provider() -> SimpleFunc<216, crate::UserTy, im
|
||||
params.insert(SPAWNS_KEY, Typed::Arr(Arr {
|
||||
ty: TypePrefix::HashMap, // hashtable
|
||||
items: vec![
|
||||
// TODO set these up with the correct values (IDs are correct)
|
||||
CustomisationData {
|
||||
id: "spawn0".to_string(),
|
||||
localised_name: "Default".to_string(),
|
||||
skin_scene_name: "TODO_skin".to_string(),
|
||||
simulation_prefab: "TODO_sim_prefab".to_string(),
|
||||
preview_image_name: "TODO_preview_img".to_string(),
|
||||
id: "Spawn".to_string(),
|
||||
localised_name: "strSpawnFXWarpIn".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Respawn_WarpIn".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Spawn_BlackHole".to_string(),
|
||||
localised_name: "strSpawnFXWarpIn".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Respawn_WarpIn".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Spawn_Lander".to_string(),
|
||||
localised_name: "strSpawnFXWarpIn".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Respawn_WarpIn".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Spawn_Lootcrate".to_string(),
|
||||
localised_name: "strSpawnFXWarpIn".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Respawn_WarpIn".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Spawn_Warp".to_string(),
|
||||
localised_name: "strSpawnFXWarpIn".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Respawn_WarpIn".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Spawn_Present".to_string(),
|
||||
localised_name: "strSpawnFXWarpIn".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Respawn_WarpIn".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Spawn_EasterEgg".to_string(),
|
||||
localised_name: "strSpawnFXWarpIn".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Respawn_WarpIn".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
],
|
||||
@@ -44,12 +93,61 @@ pub(super) fn all_customisations_provider() -> SimpleFunc<216, crate::UserTy, im
|
||||
params.insert(DEATHS_KEY, Typed::Arr(Arr {
|
||||
ty: TypePrefix::HashMap, // hashtable
|
||||
items: vec![
|
||||
// TODO set these up with the correct values (IDs are correct)
|
||||
CustomisationData {
|
||||
id: "death0".to_string(),
|
||||
localised_name: "Default".to_string(),
|
||||
skin_scene_name: "TODO_skin".to_string(),
|
||||
simulation_prefab: "TODO_sim_prefab".to_string(),
|
||||
preview_image_name: "TODO_preview_img".to_string(),
|
||||
id: "Explosion".to_string(),
|
||||
localised_name: "strDeathFXEmergencyWarp".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Death_WarpOut".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Explosion_Toon".to_string(),
|
||||
localised_name: "strDeathFXEmergencyWarp".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Death_WarpOut".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Explosion_Feathers_Rainbow".to_string(),
|
||||
localised_name: "strDeathFXEmergencyWarp".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Death_WarpOut".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Explosion_Nuclear".to_string(),
|
||||
localised_name: "strDeathFXEmergencyWarp".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Death_WarpOut".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Explosion_Warp".to_string(),
|
||||
localised_name: "strDeathFXEmergencyWarp".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Death_WarpOut".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Explosion_BlackHole".to_string(),
|
||||
localised_name: "strDeathFXEmergencyWarp".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Death_WarpOut".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Explosion_Firework".to_string(),
|
||||
localised_name: "strDeathFXEmergencyWarp".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Death_WarpOut".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
],
|
||||
|
||||
15
rc_services_room/src/operations/game_mode_config.rs
Normal file
15
rc_services_room/src/operations/game_mode_config.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
use polariton_server::operations::SimpleFunc;
|
||||
use polariton::operation::ParameterTable;
|
||||
|
||||
use crate::persist::config::ConfigProvider;
|
||||
|
||||
const PARAM_KEY: u8 = 1;
|
||||
|
||||
pub(super) fn game_mode_config_provider(conf: &crate::persist::config::ConfigImpl) -> SimpleFunc<113, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
|
||||
let game_config = conf.game_mode_config();
|
||||
SimpleFunc::new(move |params, _| {
|
||||
let mut params = params.to_dict();
|
||||
params.insert(PARAM_KEY, game_config.clone());
|
||||
Ok(params.into())
|
||||
})
|
||||
}
|
||||
@@ -76,6 +76,9 @@ mod regen_config;
|
||||
mod pageantry;
|
||||
mod signup_time;
|
||||
mod validate_machine;
|
||||
mod game_mode_config;
|
||||
mod score_multipliers_config;
|
||||
mod player_robot_rank;
|
||||
|
||||
use polariton_server::operations::OperationsHandler;
|
||||
|
||||
@@ -170,4 +173,7 @@ pub fn handler(init_ctx: &crate::InitConfig) -> OperationsHandler<crate::UserTy>
|
||||
.without_state(pageantry::after_battle_vote_thresholds_provider(&init_ctx.cubes))
|
||||
.without_state(signup_time::user_signup_date_provider())
|
||||
.without_state(validate_machine::validate_robot_provider())
|
||||
.without_state(game_mode_config::game_mode_config_provider(&init_ctx.cubes))
|
||||
.without_state(score_multipliers_config::tdm_ai_score_config_provider())
|
||||
.without_state(player_robot_rank::player_robot_rank_provider())
|
||||
}
|
||||
|
||||
23
rc_services_room/src/operations/player_robot_rank.rs
Normal file
23
rc_services_room/src/operations/player_robot_rank.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
use polariton_server::operations::SimpleFunc;
|
||||
use polariton::operation::{ParameterTable, Typed};
|
||||
|
||||
const USERNAME_PARAM_KEY: u8 = 30; // in; str
|
||||
const RANK_PARAM_KEY: u8 = 84; // out; int
|
||||
const CPU_PARAM_KEY: u8 = 177; // out; int
|
||||
const COSMETIC_CPU_PARAM_KEY: u8 = 176; // out; int
|
||||
|
||||
pub(super) fn player_robot_rank_provider() -> SimpleFunc<79, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
|
||||
SimpleFunc::new(|params, user: &crate::UserTy| {
|
||||
let lock = user.read().unwrap();
|
||||
let user = lock.user()?;
|
||||
let mut params = params.to_dict();
|
||||
if let Some(Typed::Str(username)) = params.get(&USERNAME_PARAM_KEY) {
|
||||
log::debug!("Get robot rank for user {}", username.string);
|
||||
}
|
||||
let robot = user.slot_by_id(user.selected_garage_slot() as i32)?;
|
||||
params.insert(RANK_PARAM_KEY, robot.robot_rank);
|
||||
params.insert(CPU_PARAM_KEY, robot.cpu);
|
||||
params.insert(COSMETIC_CPU_PARAM_KEY, robot.cosmetic_cpu);
|
||||
Ok(params.into())
|
||||
})
|
||||
}
|
||||
15
rc_services_room/src/operations/score_multipliers_config.rs
Normal file
15
rc_services_room/src/operations/score_multipliers_config.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
use polariton_server::operations::SimpleFunc;
|
||||
use polariton::operation::ParameterTable;
|
||||
|
||||
use crate::data::score_multipliers::*;
|
||||
|
||||
const PARAM_KEY: u8 = 137;
|
||||
|
||||
pub(super) fn tdm_ai_score_config_provider(/*conf: &crate::persist::config::ConfigImpl*/) -> SimpleFunc<117, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
|
||||
//let game_config = conf.game_mode_config();
|
||||
SimpleFunc::new(move |params, _| {
|
||||
let mut params = params.to_dict();
|
||||
params.insert(PARAM_KEY, ScoreMultipliersData::default().as_transmissible());
|
||||
Ok(params.into())
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user