generated from GarandPLG/rust-flake-template
Add comprehensive CLI options for game settings
- Expanded `Cli` with arguments for username, game mode, map size, perk deck, resources, supply limit, XP modifier, and skill points limit. - Enabled the `cli` module in `lib.rs` and activated argument parsing in `main.rs`. - Added placeholder (commented) fields to `App` for future configuration integration.
This commit is contained in:
+10
@@ -7,6 +7,16 @@ use std::{
|
|||||||
|
|
||||||
pub struct App {
|
pub struct App {
|
||||||
pub exit: bool,
|
pub exit: bool,
|
||||||
|
// pub username: String,
|
||||||
|
// pub game_mode: String,
|
||||||
|
// pub map_width: u8,
|
||||||
|
// pub map_height: u8,
|
||||||
|
// pub perk_deck: String,
|
||||||
|
// pub starting_wood: u8,
|
||||||
|
// pub starting_iron: u8,
|
||||||
|
// pub supply_limit: u8,
|
||||||
|
// pub xp_modifier: f32,
|
||||||
|
// pub skill_points_limit: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum Event {
|
pub enum Event {
|
||||||
|
|||||||
+35
-1
@@ -2,7 +2,41 @@ use clap::Parser;
|
|||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
#[command(version, about = "War in Tunnels", long_about = "War in Tunnels")]
|
#[command(version, about = "War in Tunnels", long_about = "War in Tunnels")]
|
||||||
pub struct Cli {}
|
pub struct Cli {
|
||||||
|
#[arg(long, help = "Username", value_name = "String")]
|
||||||
|
pub username: String,
|
||||||
|
|
||||||
|
#[arg(long, help = "Game mode", value_name = "LastManStanding or FrontLines")]
|
||||||
|
pub game_mode: String,
|
||||||
|
|
||||||
|
#[arg(long, help = "Map width", value_name = "Positive integer [20; 100]")]
|
||||||
|
pub map_width: u8,
|
||||||
|
|
||||||
|
#[arg(long, help = "Map height", value_name = "Positive integer [11; 50]")]
|
||||||
|
pub map_height: u8,
|
||||||
|
|
||||||
|
#[arg(long, help = "Perk Deck", value_name = "String (check Perk Deck tab)")]
|
||||||
|
pub perk_deck: String,
|
||||||
|
|
||||||
|
#[arg(long, help = "Starting wood", value_name = "Positive integer")]
|
||||||
|
pub starting_wood: u8,
|
||||||
|
|
||||||
|
#[arg(long, help = "Starting iron", value_name = "Positive integer")]
|
||||||
|
pub starting_iron: u8,
|
||||||
|
|
||||||
|
#[arg(long, help = "Supply limit", value_name = "Positive integer")]
|
||||||
|
pub supply_limit: u8,
|
||||||
|
|
||||||
|
#[arg(long, help = "XP modifier", value_name = "Float [0.5; 2.0]")]
|
||||||
|
pub xp_modifier: f32,
|
||||||
|
|
||||||
|
#[arg(
|
||||||
|
long,
|
||||||
|
help = "Skill points limit",
|
||||||
|
value_name = "Positive integer [120; 690]"
|
||||||
|
)]
|
||||||
|
pub skill_points_limit: u16,
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_args() -> Cli {
|
pub fn get_args() -> Cli {
|
||||||
Cli::parse()
|
Cli::parse()
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
pub mod app;
|
pub mod app;
|
||||||
// pub mod cli;
|
pub mod cli;
|
||||||
|
|||||||
+2
-2
@@ -6,11 +6,11 @@ use std::{
|
|||||||
};
|
};
|
||||||
use war_in_tunnels::{
|
use war_in_tunnels::{
|
||||||
app::{App, Event, handle_input_events},
|
app::{App, Event, handle_input_events},
|
||||||
// cli::{Cli, get_args},
|
cli::{Cli, get_args},
|
||||||
};
|
};
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
// let args: Cli = get_args();
|
let args: Cli = get_args();
|
||||||
let mut terminal: Terminal<CrosstermBackend<Stdout>> = ratatui::init();
|
let mut terminal: Terminal<CrosstermBackend<Stdout>> = ratatui::init();
|
||||||
let mut app: App = App { exit: false };
|
let mut app: App = App { exit: false };
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,3 @@
|
|||||||
Ant (rozbudowa bazy)
|
|
||||||
Mole (kopanie tuneli)
|
|
||||||
Scorpion (walka z przeciwnikiem)
|
|
||||||
Trapdoor (infiltracja wrogich tuneli)
|
|
||||||
Bombardier (wysadzanie / materiały wybuchowe)
|
|
||||||
|
|
||||||
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||||
│┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐│
|
│┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐│
|
||||||
││War in Tunnels ││
|
││War in Tunnels ││
|
||||||
@@ -13,7 +7,7 @@ Bombardier (wysadzanie / materiały wybuchowe)
|
|||||||
││ ││
|
││ ││
|
||||||
││ ┌─────┬──────┬──────────┬──────────┬────────────┐ ┌─[A]──────────────────────────────────┐ ││
|
││ ┌─────┬──────┬──────────┬──────────┬────────────┐ ┌─[A]──────────────────────────────────┐ ││
|
||||||
││ │ Ant │ Mole │ Scorpion │ Trapdoor │ Bombardier │ │ │ ││
|
││ │ Ant │ Mole │ Scorpion │ Trapdoor │ Bombardier │ │ │ ││
|
||||||
││ │ └──────┴──────────┴──────────┴────────────┴────────┐ │ Basic (+): │ ││
|
││ ├─────┘ └──────────┴──────────┴────────────┴────────┐ │ Basic (+): │ ││
|
||||||
││ │ │ │ │ ││
|
││ │ │ │ │ ││
|
||||||
││ │ 18 ┌─────┐ │ ┌─────┐ │ ┌─────┐ │ │ ---------------------------------- │ ││
|
││ │ 18 ┌─────┐ │ ┌─────┐ │ ┌─────┐ │ │ ---------------------------------- │ ││
|
||||||
││ │ │ │ │ │ │ │ │ │ │ │ ---------------------------------- │ ││
|
││ │ │ │ │ │ │ │ │ │ │ │ ---------------------------------- │ ││
|
||||||
|
|||||||
Reference in New Issue
Block a user