mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Populate garage data from factory purchase better #6
This commit is contained in:
@@ -6,7 +6,7 @@ pub enum Factory {
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl rc_factory::VehicleFactoryAdapter for Factory {
|
||||
async fn vehicle(&self, id: u32) -> Result<Option<rc_factory::VehicleInfo>, Box<dyn std::error::Error>> {
|
||||
async fn vehicle(&self, id: u32) -> Result<Option<(rc_factory::VehicleInfo, rc_factory::VehicleQueryInfo)>, Box<dyn std::error::Error>> {
|
||||
match self {
|
||||
Self::Arc(x) => x.vehicle(id).await,
|
||||
Self::Custom(x) => x.vehicle(id).await,
|
||||
|
||||
@@ -333,6 +333,8 @@ impl <C: Clone> super::User<C> for UserData {
|
||||
weapon_order: rc_database::sea_orm::ActiveValue::Set(rc_database::schema::dump_csv(&vehicle.weapon_order)),
|
||||
robot_data: rc_database::sea_orm::ActiveValue::Set(vehicle.robot_data),
|
||||
colour_data: rc_database::sea_orm::ActiveValue::Set(vehicle.colour_data),
|
||||
crf_id: if let Some(crf_id) = vehicle.crf_id { rc_database::sea_orm::ActiveValue::Set(Some(crf_id as u32)) } else { Default::default() },
|
||||
name: if let Some(new_name) = vehicle.name { rc_database::sea_orm::ActiveValue::Set(new_name) } else { Default::default() },
|
||||
..Default::default()
|
||||
};
|
||||
self.save_garage_by_slot(entity, vehicle.slot as u32).await.map_err(|e| {
|
||||
|
||||
@@ -104,8 +104,10 @@ pub struct NewSlotData<C> {
|
||||
}
|
||||
|
||||
pub struct VehicleData {
|
||||
pub name: Option<String>,
|
||||
pub slot: i32,
|
||||
pub robot_data: Vec<u8>,
|
||||
pub colour_data: Vec<u8>,
|
||||
pub weapon_order: Vec<i32>,
|
||||
pub crf_id: Option<i32>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user