DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

6ce97fb3e6f2f67b91c1db01dd4f3dfbffb97312 — Jonni Liljamo 1 year, 7 months ago d499b27
feat(client): seed_gen macro
3 files changed, 15 insertions(+), 8 deletions(-)

M client/src/main.rs
M client/src/plugins/game/supply/mod.rs
M client/src/plugins/game/ui/mod.rs
M client/src/main.rs => client/src/main.rs +7 -0
@@ 26,6 26,13 @@ mod plugins;

mod game_status;

#[macro_export]
macro_rules! seed_gen {
    () => {
        fastrand::u64(u64::MIN..=u64::MAX)
    };
}

#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, States)]
enum AppState {
    #[default]

M client/src/plugins/game/supply/mod.rs => client/src/plugins/game/supply/mod.rs +2 -2
@@ 10,7 10,7 @@ use bevy::prelude::*;
use bevy_mod_picking::prelude::*;
use bevy_rapier3d::prelude::*;

use crate::{plugins::GameActionCreateCallEvent, api::game::{Action, Command}, Global, game_status::PlayerState};
use crate::{plugins::GameActionCreateCallEvent, api::game::{Action, Command}, Global, game_status::PlayerState, seed_gen};

use super::{
    card::{visual_card_kind, VisualCard, VisualCardBundle, ClickedCard},


@@ 139,7 139,7 @@ fn handle_clicked_supply_pile(
                index: card_kind.0,
                for_cost: card.card.cost,
            },
            fastrand::u64(u64::MIN..=u64::MAX),
            seed_gen!(),
        ),
    });
}

M client/src/plugins/game/ui/mod.rs => client/src/plugins/game/ui/mod.rs +6 -6
@@ 13,7 13,7 @@ use crate::{
    api::game::{Action, Command, Game},
    game_status::{Card, PlayerState},
    plugins::{GameActionCreateCallEvent, GameDetailsCallEvent},
    AppState, Global,
    AppState, Global, seed_gen,
};

use super::{supply::SpawnSupplyPilesEvent, GameData};


@@ 459,7 459,7 @@ fn hardcoded_init(game: &Game, create_action_ev_w: &mut EventWriter<GameActionCr
                },
                amount: 10,
            },
            fastrand::u64(u64::MIN..=u64::MAX),
            seed_gen!(),
        ),
    });
    create_action_ev_w.send(GameActionCreateCallEvent {


@@ 477,7 477,7 @@ fn hardcoded_init(game: &Game, create_action_ev_w: &mut EventWriter<GameActionCr
                },
                amount: 10,
            },
            fastrand::u64(u64::MIN..=u64::MAX),
            seed_gen!(),
        ),
    });
    create_action_ev_w.send(GameActionCreateCallEvent {


@@ 495,7 495,7 @@ fn hardcoded_init(game: &Game, create_action_ev_w: &mut EventWriter<GameActionCr
                },
                amount: 10,
            },
            fastrand::u64(u64::MIN..=u64::MAX),
            seed_gen!(),
        ),
    });
    create_action_ev_w.send(GameActionCreateCallEvent {


@@ 513,7 513,7 @@ fn hardcoded_init(game: &Game, create_action_ev_w: &mut EventWriter<GameActionCr
                },
                amount: 10,
            },
            fastrand::u64(u64::MIN..=u64::MAX),
            seed_gen!(),
        ),
    });



@@ 526,7 526,7 @@ fn hardcoded_init(game: &Game, create_action_ev_w: &mut EventWriter<GameActionCr
            &Command::ChangePlayerState {
                state: PlayerState::PlayPhase,
            },
            fastrand::u64(u64::MIN..=u64::MAX),
            seed_gen!(),
        ),
    });
}