mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Add minimal robot factory functionality and arc archive support for #6
This commit is contained in:
@@ -5,7 +5,7 @@ use serde::{Serialize, Deserialize};
|
||||
use polariton::operation::{Typed, Dict};
|
||||
use polariton::serdes::TypePrefix;
|
||||
|
||||
use super::super::{MovementCategoryData, MovementData, Cube, ItemCategory, ItemTier, BattleConfig, Settings, ChatConfig};
|
||||
use super::super::{MovementCategoryData, MovementData, Cube, ItemCategory, ItemTier, BattleConfig, Settings, ChatConfig, FactoryConfig};
|
||||
|
||||
const CUBE_CONFIG_FILENAME: &str = "config.json";
|
||||
|
||||
@@ -16,6 +16,7 @@ pub struct CubeConfig {
|
||||
lerp_value: f32,
|
||||
battle: BattleConfig,
|
||||
chat: ChatConfig,
|
||||
factory: FactoryConfig,
|
||||
settings: Settings,
|
||||
}
|
||||
|
||||
@@ -28,6 +29,7 @@ impl CubeConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl <C: Clone> super::ConfigProvider<C> for CubeConfig {
|
||||
fn cube_list(&self) -> Typed<C> {
|
||||
Typed::Dict(Dict {
|
||||
@@ -271,4 +273,8 @@ impl <C: Clone> super::ConfigProvider<C> for CubeConfig {
|
||||
}).collect(),
|
||||
}
|
||||
}
|
||||
|
||||
async fn factory(&self) -> Result<crate::factory::Factory, Box<dyn std::error::Error + 'static>> {
|
||||
crate::factory::Factory::from_config(&self.factory).await
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use polariton::operation::Typed;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
pub trait ConfigProvider<C: Clone> {
|
||||
fn cube_list(&self) -> Typed<C>;
|
||||
fn movement_list(&self) -> Typed<C>;
|
||||
@@ -20,6 +21,7 @@ pub trait ConfigProvider<C: Clone> {
|
||||
fn public_channels(&self) -> Typed<C>;
|
||||
fn server_config(&self) -> ServerConfig;
|
||||
fn garage_upgrades(&self) -> GarageUpgrades;
|
||||
async fn factory(&self) -> Result<crate::factory::Factory, Box<dyn std::error::Error + 'static>>;
|
||||
}
|
||||
|
||||
pub struct CompleteCampaignProvider {
|
||||
|
||||
Reference in New Issue
Block a user