Skip to content

Commit

Permalink
Refactor game_version.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
tGitzHub committed Jan 29, 2024
1 parent 50d041d commit 26927d4
Showing 1 changed file with 21 additions and 25 deletions.
46 changes: 21 additions & 25 deletions src/game_version.rs
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
use serde_derive::{Serialize, Deserialize};
use derive_builder::Builder;
use serde_derive::{Deserialize, Serialize};

#[derive(Serialize, Deserialize)]
pub struct FactorioVersion{

pub struct FactorioVersion {
game_version_name: &'static str,
game_version_number: &'static str,

modded_factorio: bool,

module: Module,
/*
/*
building_list: BuildingList,
beacon_list: BeaconList,
recipe_list: RecipeList,
module_list: ModuleList,
*/
}

impl FactorioVersion{
impl FactorioVersion {
pub fn factorio_1_1() -> Self {
FactorioVersion{
FactorioVersion {
game_version_name: "Factorio",
game_version_number: "1.1",
modded_factorio: false,
module: Module::new(ModuleKind::Efficiency, ModulePower::One),

/*
/*
building_list: BuildingList::new(),
beacon_list: BeaconList::new(),
recipe_list: RecipeList::new(),
Expand All @@ -36,37 +34,36 @@ impl FactorioVersion{
}
}


#[derive(Serialize, Deserialize, Clone)]
enum ModuleKind{
enum ModuleKind {
Efficiency,
Productivity,
Speed,
}
#[derive(Serialize, Deserialize, Clone)]
enum ModulePower{
enum ModulePower {
One,
Two,
Three,
}

#[derive(Serialize, Deserialize, Clone)]
struct Module{
struct Module {
module_kind: ModuleKind,
module_power: ModulePower,
}

impl Module{
fn new(module_kind: ModuleKind, module_power: ModulePower) -> Module{
Module{
impl Module {
fn new(module_kind: ModuleKind, module_power: ModulePower) -> Module {
Module {
module_kind,
module_power,
}
}
}

#[derive(Builder)]
pub struct Assembler{
pub struct Assembler {
id: usize,
//assembler_kind: AssemblerKind,
recipe: Recipe,
Expand All @@ -75,15 +72,13 @@ pub struct Assembler{
}

#[derive(Clone)]
struct AssemblerKind{
struct AssemblerKind {
tier: u8,
crafting_speed: f32,
}
#[derive(Clone)]
struct Recipe{

}
/*
struct Recipe {}
/*
struct BuildingList{
assembler: [Assembler; N],
furnace: Furnace,
Expand Down Expand Up @@ -194,7 +189,7 @@ struct ModuleSpecification{
module_slots: u8,
module_kind_allowed: Vec<ModuleKind>,
}
/*
/*
let assembler_1 = Assembler{
name: "assembling-machine-1",
crafting_speed: 0.5,
Expand Down Expand Up @@ -231,4 +226,5 @@ let assembler_1 = Assembler{
module_info_multi_row_initial_height_modifier: -0.3
}
*/
*/
*/

0 comments on commit 26927d4

Please sign in to comment.