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

Make edit mode usable; complete #11

This commit is contained in:
NGnius (Graham)
2025-03-15 11:03:35 -04:00
parent 47eb32056c
commit 6fd4d673ca
40 changed files with 5313 additions and 2162 deletions

View File

@@ -0,0 +1,47 @@
#[allow(dead_code)]
#[derive(Debug)]
pub struct UserToken {
pub uuid: String,
pub token: String,
pub refresh_token: String,
}
pub trait UserProvider<C> {
fn authenticate(&self, user: UserToken) -> Result<Box<dyn User<C> + Send + Sync>, String>;
}
pub trait User<C> {
fn token(&self) -> &'_ super::UserToken;
fn is_mod(&self) -> bool;
fn is_admin(&self) -> bool;
fn is_dev(&self) -> bool;
fn unlocked_parts(&self) -> Vec<u32>;
fn selected_garage_uuid(&self) -> String;
fn selected_garage_slot(&self) -> u32;
fn all_slots_by_id(&self) -> UserSlots<C>;
fn slot_by_id(&self, id: i32) -> Result<UserSlotData<C>, i16>;
fn save_slot(&self, vehicle: VehicleData) -> Result<(), i16>;
}
pub struct UserSlots<C> {
pub slot_info: polariton::operation::Typed<C>,
pub slot_order: polariton::operation::Typed<C>,
}
pub struct UserSlotData<C> {
pub data: polariton::operation::Typed<C>,
pub colour_data: polariton::operation::Typed<C>,
pub cube_count: polariton::operation::Typed<C>,
pub weapon_order: polariton::operation::Typed<C>,
pub movement_categories: polariton::operation::Typed<C>,
pub control_type: polariton::operation::Typed<C>,
pub control_options: polariton::operation::Typed<C>,
pub mastery_level: polariton::operation::Typed<C>,
}
pub struct VehicleData {
pub id: i32,
pub robot_data: Vec<u8>,
pub colour_data: Vec<u8>,
pub weapon_order: Vec<i32>,
}