Files
dorf/src/main.rs
T
2026-03-21 14:50:31 +00:00

79 lines
2.5 KiB
Rust

use bevy::prelude::*;
use bevy_rand::prelude::*;
use crate::entities::{
item::{initialize_item_rotation_state, item_tile_management_system, ItemRotationTimer},
livestock::pig::pig_drop_system,
};
use crate::game::SpawnDelay;
mod camera;
mod config;
mod constants;
mod cursor;
mod debug;
mod entities;
mod game;
mod system_info;
mod world;
fn main() {
let game_config = config::GameConfig::load();
system_info::print_system_info(&game_config);
App::new()
.insert_resource(game_config)
.insert_resource(game::ZIndex(0.0))
.insert_resource(camera::CameraMoved(false))
.init_resource::<SpawnDelay>()
.add_systems(PreStartup, world::textures::initialize_textures)
.add_plugins(
DefaultPlugins
.set(WindowPlugin {
primary_window: Some(Window {
title: String::from("Dorf"),
present_mode: bevy::window::PresentMode::Mailbox,
..Default::default()
}),
..Default::default()
})
.set(ImagePlugin::default_nearest()),
)
.add_plugins(EntropyPlugin::<WyRand>::with_seed(
(constants::SEED as u64).to_le_bytes(),
))
.insert_resource(ClearColor(Color::srgb(0., 0., 0.)))
.add_plugins(world::WorldPlugin)
.add_plugins(entities::pathfinding::PathfindingPlugin)
.add_systems(
FixedUpdate,
entities::livestock::rabbit::rabbit_fall_debug_system,
)
.add_systems(
Startup,
(camera::spawn_panning_camera, cursor::setup_cursor),
)
.add_systems(
Update,
(
camera::scroll_events,
camera::camera_z_movement,
camera::camera_movement,
cursor::move_cursor,
entities::sentient::dorf::spawn_dorfs,
entities::livestock::pig::spawn_pigs,
entities::livestock::rabbit::spawn_rabbits,
entities::livestock::rabbit::rabbit_dig_system,
),
)
.add_systems(Update, pig_drop_system)
.insert_resource(ItemRotationTimer::default())
.add_systems(Update, initialize_item_rotation_state)
.add_systems(
Update,
item_tile_management_system.after(initialize_item_rotation_state),
)
.add_systems(Update, debug::entity_dump::dump_entity_positions)
.run();
}