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

Implement minimal chat service, fix some implement bugs

This commit is contained in:
NGnius (Graham)
2025-02-23 20:17:46 -05:00
parent 2907376722
commit 2106613f62
21 changed files with 227 additions and 194 deletions

View File

@@ -9,7 +9,7 @@ pub struct CubeInfo {
pub grey_out_in_tutorial: bool,
pub visibility: VisibilityMode,
pub indestructible: bool,
pub category: u32,
pub category: super::weapon_list::ItemCategory,
pub placements: u32, // default 63
pub protonium: bool,
pub unlocked_by_league: bool,

View File

@@ -48,8 +48,8 @@ pub struct GarageSlotInfo {
pub bay_cpu: u32,
pub tutorial_robot: bool, // assumed to be false (when omitted)
pub starter_robot_index: i32, // assumed to be -1 (whem omitted)
pub control_type: i32, // enum???
pub control_options: Vec<bool>,
pub control_type: ControlType,
pub control_options: ControlOptions,
pub mastery_level: i32,
pub bay_skin_id: String,
pub weapon_order: Vec<i32>,
@@ -75,10 +75,14 @@ impl GarageSlotInfo {
(Typed::Str("bayCpu".into()), Typed::Int(self.bay_cpu as i32)),
(Typed::Str("tutorialRobot".into()), Typed::Bool(self.tutorial_robot.into())),
(Typed::Str("starterRobotIndex".into()), Typed::Int(self.starter_robot_index)),
(Typed::Str("controlType".into()), Typed::Int(self.control_type)),
(Typed::Str("controlType".into()), Typed::Int(self.control_type as i32)),
(Typed::Str("controlOptions".into()), Typed::Arr(Arr {
ty: 111, // bool
items: self.control_options.iter().map(|&x| Typed::Bool(x.into())).collect(),
items: vec![
Typed::Bool(self.control_options.vertical_strafing.into()),
Typed::Bool(self.control_options.sideways_driving.into()),
Typed::Bool(self.control_options.tracks_turn_on_spot.into()),
],
})),
(Typed::Str("masteryLevel".into()), Typed::Int(self.mastery_level)),
(Typed::Str("baySkinId".into()), Typed::Str(self.bay_skin_id.clone().into())),
@@ -90,4 +94,19 @@ impl GarageSlotInfo {
}
}
#[allow(dead_code)]
#[repr(i32)]
#[derive(Copy, Clone)]
pub enum ControlType {
Camera = 0,
Keyboard = 1,
Count = 2,
}
pub struct ControlOptions {
pub vertical_strafing: bool,
pub sideways_driving: bool,
pub tracks_turn_on_spot: bool,
}

View File

@@ -145,19 +145,19 @@ impl WeaponData {
#[repr(u32)]
#[derive(Clone, Copy)]
pub enum ItemCategory {
NoFunction,
Wheel,
Hover,
Wing,
Rudder,
Thruster,
InsectLeg,
MechLeg,
Ski,
TankTrack,
Rotor,
SrpinterLeg,
Propeller,
NoFunction = 0,
Wheel = 1,
Hover = 2,
Wing = 3,
Rudder = 4,
Thruster = 5,
InsectLeg = 6,
MechLeg = 7,
Ski = 8,
TankTrack = 9,
Rotor = 10,
SrpinterLeg = 11,
Propeller = 12,
Laser = 100,
Plasma = 200,
Mortar = 250,
@@ -169,10 +169,10 @@ pub enum ItemCategory {
Seeker = 701,
Chaingun = 750,
ShieldModule = 800,
GhostModule,
BlinkModule,
EmpModule,
WindowmakerModule,
GhostModule = 801,
BlinkModule = 802,
EmpModule = 803,
WindowmakerModule = 804,
EnergyModule = 900,
}

View File

@@ -6,6 +6,7 @@ use polariton::operation::{ParameterTable, Typed, Dict};
use crate::data::cube_list::*;
const PARAM_KEY: u8 = 1;
// const DEFAULT_CUBE_ID: u32 = 227205318;
pub(super) fn cube_list_provider() -> SimpleFunc<2, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
SimpleFunc::new(|params, _| {
@@ -22,7 +23,7 @@ pub(super) fn cube_list_provider() -> SimpleFunc<2, crate::UserTy, impl (Fn(Para
grey_out_in_tutorial: false,
visibility: VisibilityMode::All,
indestructible: true,
category: 1,
category: crate::data::weapon_list::ItemCategory::NoFunction,
placements: 63,
protonium: false,
unlocked_by_league: false,
@@ -35,7 +36,133 @@ pub(super) fn cube_list_provider() -> SimpleFunc<2, crate::UserTy, impl (Fn(Para
cosmetic: false,
variant_of: "0".to_string(),
ignore_in_weapon_list: true,
}.as_transmissible())
}.as_transmissible()),
(Typed::Str("0".into()), CubeInfo {
cpu: 1,
health: 1,
health_boost: 1.0,
grey_out_in_tutorial: false,
visibility: VisibilityMode::All,
indestructible: true,
category: crate::data::weapon_list::ItemCategory::Laser,
placements: 63,
protonium: false,
unlocked_by_league: false,
league_unlock_index: 1,
stats: HashMap::default(),
description: "This is a very descriptive description".to_string(),
size: ItemTier::T0,
type_: ItemType::Weapon,
ranking: 1,
cosmetic: false,
variant_of: "0".to_string(),
ignore_in_weapon_list: true,
}.as_transmissible()),
(Typed::Str("1".into()), CubeInfo {
cpu: 1,
health: 1,
health_boost: 1.0,
grey_out_in_tutorial: false,
visibility: VisibilityMode::All,
indestructible: true,
category: crate::data::weapon_list::ItemCategory::Laser,
placements: 63,
protonium: false,
unlocked_by_league: false,
league_unlock_index: 1,
stats: HashMap::default(),
description: "This is a very descriptive description".to_string(),
size: ItemTier::T1,
type_: ItemType::Weapon,
ranking: 1,
cosmetic: false,
variant_of: "0".to_string(),
ignore_in_weapon_list: true,
}.as_transmissible()),
(Typed::Str("2".into()), CubeInfo {
cpu: 1,
health: 1,
health_boost: 1.0,
grey_out_in_tutorial: false,
visibility: VisibilityMode::All,
indestructible: true,
category: crate::data::weapon_list::ItemCategory::Laser,
placements: 63,
protonium: false,
unlocked_by_league: false,
league_unlock_index: 1,
stats: HashMap::default(),
description: "This is a very descriptive description".to_string(),
size: ItemTier::T2,
type_: ItemType::Weapon,
ranking: 1,
cosmetic: false,
variant_of: "0".to_string(),
ignore_in_weapon_list: true,
}.as_transmissible()),
(Typed::Str("3".into()), CubeInfo {
cpu: 1,
health: 1,
health_boost: 1.0,
grey_out_in_tutorial: false,
visibility: VisibilityMode::All,
indestructible: true,
category: crate::data::weapon_list::ItemCategory::Laser,
placements: 63,
protonium: false,
unlocked_by_league: false,
league_unlock_index: 1,
stats: HashMap::default(),
description: "This is a very descriptive description".to_string(),
size: ItemTier::T3,
type_: ItemType::Weapon,
ranking: 1,
cosmetic: false,
variant_of: "0".to_string(),
ignore_in_weapon_list: true,
}.as_transmissible()),
(Typed::Str("4".into()), CubeInfo {
cpu: 1,
health: 1,
health_boost: 1.0,
grey_out_in_tutorial: false,
visibility: VisibilityMode::All,
indestructible: true,
category: crate::data::weapon_list::ItemCategory::Laser,
placements: 63,
protonium: false,
unlocked_by_league: false,
league_unlock_index: 1,
stats: HashMap::default(),
description: "This is a very descriptive description".to_string(),
size: ItemTier::T4,
type_: ItemType::Weapon,
ranking: 1,
cosmetic: false,
variant_of: "0".to_string(),
ignore_in_weapon_list: true,
}.as_transmissible()),
(Typed::Str("5".into()), CubeInfo {
cpu: 1,
health: 1,
health_boost: 1.0,
grey_out_in_tutorial: false,
visibility: VisibilityMode::All,
indestructible: true,
category: crate::data::weapon_list::ItemCategory::Laser,
placements: 63,
protonium: false,
unlocked_by_league: false,
league_unlock_index: 1,
stats: HashMap::default(),
description: "This is a very descriptive description".to_string(),
size: ItemTier::T5,
type_: ItemType::Weapon,
ranking: 1,
cosmetic: false,
variant_of: "0".to_string(),
ignore_in_weapon_list: true,
}.as_transmissible()),
].into(),
}));
Ok(params.into())

View File

@@ -1,5 +1,5 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Dict, Arr};
use polariton::operation::{ParameterTable, Typed, Dict};
use crate::data::custom_games::*;
@@ -11,26 +11,22 @@ pub(super) fn allowed_maps_provider() -> SimpleFunc<146, crate::UserTy, impl (Fn
let mut params = params.to_dict();
params.insert(MODE_MAP_PARAM_KEY, Typed::Dict(Dict {
key_ty: 115, // str
val_ty: 121, // arr
val_ty: 122, // obj arr
items: vec![
(Typed::Str(GameMode::BattleArena.as_str().into()), Typed::Arr(Arr {
ty: 115, // str
items: vec![
(Typed::Str(GameMode::BattleArena.as_str().into()), Typed::ObjArr(vec![
Typed::Str("Assets/Scenes/Planet_Neptune/RC_Planet_Neptune_02_BA".into()),
Typed::Str("Assets/Scenes/Planet_Mars/RC_Planet_Mars_03_BA".into()),
Typed::Str("Assets/Scenes/Planet_Mars/RC_Planet_Mars_02_BA".into()),
Typed::Str("Assets/Scenes/Planet_Earth/RC_Planet_Earth_02_BA".into()),
Typed::Str("Assets/Scenes/Planet_Earth/RC_Planet_Earth_01_BA".into()),
Typed::Str("Assets/Scenes/Planet_Neptune/RC_Planet_Neptune_03_BA".into()),
]
})),
(Typed::Str(GameMode::TeamDeathmatch.as_str().into()), Typed::Arr(Arr {
ty: 115, // str
items: vec![
].into())
),
(Typed::Str(GameMode::TeamDeathmatch.as_str().into()), Typed::ObjArr(vec![
Typed::Str("Assets/Scenes/Planet_Neptune/RC_Planet_Neptune_01_CTF".into()),
Typed::Str("Assets/Scenes/Planet_Mars/RC_Planet_Mars_01_CTF".into()),
]
})),
].into())
),
],
}));
params.insert(MAP_NAMES_PARAM_KEY, Typed::Dict(Dict {

View File

@@ -1,12 +1,14 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed};
const PARAM_KEY: u8 = 2;
const MESSAGE_PARAM_KEY: u8 = 2;
const DISPLAY_TIME_PARAM_KEY: u8 = 15;
pub(super) fn dev_message_provider() -> SimpleFunc<8, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
SimpleFunc::new(|params, _| {
let mut params = params.to_dict();
params.insert(PARAM_KEY, Typed::Bytes(Vec::from("No jam was harmed in the reverse-engineering of this game".as_bytes()).into()));
params.insert(MESSAGE_PARAM_KEY, Typed::Bytes(Vec::from("No jam was harmed in the reverse-engineering of this game".as_bytes()).into()));
params.insert(DISPLAY_TIME_PARAM_KEY, Typed::Int(60 /* seconds??? */));
Ok(params.into())
})
}

View File

@@ -1,5 +1,5 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Dict, Arr};
use polariton::operation::{ParameterTable, Typed, Dict};
use crate::data::garage_bay::*;
@@ -28,8 +28,8 @@ pub(super) fn garage_slot_provider() -> SimpleFunc<40, crate::UserTy, impl (Fn(P
bay_cpu: 2_000,
tutorial_robot: false,
starter_robot_index: -1,
control_type: 0,
control_options: vec![false, false],
control_type: ControlType::Camera,
control_options: ControlOptions { vertical_strafing: false, sideways_driving: false, tracks_turn_on_spot: false, },
mastery_level: 1,
bay_skin_id: "".to_owned(), // TODO
weapon_order: vec![0],
@@ -37,10 +37,9 @@ pub(super) fn garage_slot_provider() -> SimpleFunc<40, crate::UserTy, impl (Fn(P
],
}));
params.insert(SELECTED_SLOT_PARAM_KEY, Typed::Int(0));
params.insert(SLOT_ORDER_PARAM_KEY, Typed::Arr(Arr {
ty: 105, // int
items: vec![Typed::Int(0)],
}));
params.insert(SLOT_ORDER_PARAM_KEY, Typed::ObjArr(vec![
Typed::Int(0),
].into()));
Ok(params.into())
})
}