mindustry logic execution, map- and schematic- parsing and rendering
-rw-r--r--Cargo.toml7
-rw-r--r--src/exe/edit.rs17
-rw-r--r--src/exe/mod.rs8
-rw-r--r--src/exe/print.rs11
-rw-r--r--src/lib.rs (renamed from src/main.rs)8
5 files changed, 24 insertions, 27 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 32bdc78..2816f30 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,8 +1,11 @@
[package]
name = "plandustry"
-version = "0.1.0"
+version = "1.0.0"
edition = "2021"
-publish = false
[dependencies]
flate2 = "1.0"
+
+[[bin]]
+name = "plandustry"
+path = "src/exe/mod.rs"
diff --git a/src/exe/edit.rs b/src/exe/edit.rs
index bc1d7dd..4b0ec94 100644
--- a/src/exe/edit.rs
+++ b/src/exe/edit.rs
@@ -3,14 +3,15 @@ use std::env::Args;
use std::io::{self, Write};
use std::fs;
-use crate::block::{BlockRegistry, build_registry, Rotation};
-use crate::data::dynamic::DynData;
-use crate::data::{base64, DataRead, Serializer, DataWrite, GridPos};
-use crate::data::schematic::{Placement, ResizeError, Schematic, SchematicSerializer};
-use crate::exe::print::print_schematic;
-use crate::exe::print_err;
-use crate::exe::args::{self, ArgCount, ArgOption, OptionHandler};
-use crate::registry::RegistryEntry;
+use plandustry::block::{BlockRegistry, build_registry, Rotation};
+use plandustry::data::dynamic::DynData;
+use plandustry::data::{base64, DataRead, Serializer, DataWrite, GridPos};
+use plandustry::data::schematic::{Placement, ResizeError, Schematic, SchematicSerializer};
+use plandustry::registry::RegistryEntry;
+
+use crate::print::print_schematic;
+use crate::print_err;
+use crate::args::{self, ArgCount, ArgOption, OptionHandler};
struct State<'l>
{
diff --git a/src/exe/mod.rs b/src/exe/mod.rs
index e97d77b..2c6113b 100644
--- a/src/exe/mod.rs
+++ b/src/exe/mod.rs
@@ -1,5 +1,3 @@
-use std::env::Args;
-
pub mod args;
pub mod edit;
pub mod print;
@@ -29,8 +27,10 @@ macro_rules!print_err
}
pub(crate) use print_err;
-pub fn main(mut args: Args)
+fn main()
{
+ let mut args = std::env::args();
+ args.next().unwrap(); // path to executable
match args.next()
{
None => eprintln!("Not enough arguments, valid commands are: edit, print"),
@@ -38,4 +38,4 @@ pub fn main(mut args: Args)
Some(s) if s == "print" => print::main(args, 1),
Some(s) => eprintln!("Unknown argument {s}, valid commands are: edit, print"),
}
-}
+} \ No newline at end of file
diff --git a/src/exe/print.rs b/src/exe/print.rs
index 591701b..89f6667 100644
--- a/src/exe/print.rs
+++ b/src/exe/print.rs
@@ -3,11 +3,12 @@ use std::env::Args;
use std::io::{self, Write};
use std::fs;
-use crate::block::build_registry;
-use crate::data::{DataRead, Serializer};
-use crate::data::schematic::{Schematic, SchematicSerializer};
-use crate::exe::print_err;
-use crate::exe::args::{self, ArgCount, ArgOption, OptionHandler};
+use plandustry::block::build_registry;
+use plandustry::data::{DataRead, Serializer};
+use plandustry::data::schematic::{Schematic, SchematicSerializer};
+
+use crate::print_err;
+use crate::args::{self, ArgCount, ArgOption, OptionHandler};
pub fn main(mut args: Args, arg_off: usize)
{
diff --git a/src/main.rs b/src/lib.rs
index 24edbc3..c5db7d4 100644
--- a/src/main.rs
+++ b/src/lib.rs
@@ -2,7 +2,6 @@ pub mod access;
pub mod block;
pub mod content;
pub mod data;
-pub mod exe;
pub mod fluid;
pub mod item;
pub mod logic;
@@ -11,10 +10,3 @@ pub mod registry;
pub mod team;
pub mod unit;
pub mod utils;
-
-fn main()
-{
- let mut args = std::env::args();
- args.next().unwrap(); // path to executable
- exe::main(args);
-}