66 lines
2.0 KiB
Rust
66 lines
2.0 KiB
Rust
use bevy::prelude::*;
|
|
use bevy_rand::prelude::*;
|
|
|
|
use crate::{
|
|
entities::livestock::pig::pig_drop_system,
|
|
world::tiles::{item_tile_management_system, ItemRotationTimer},
|
|
};
|
|
|
|
mod camera;
|
|
mod constants;
|
|
mod cursor;
|
|
mod entities;
|
|
mod game;
|
|
mod world;
|
|
|
|
fn main() {
|
|
App::new()
|
|
.insert_resource(game::ZIndex(0.0))
|
|
.insert_resource(world::tiles::CurrentWorldSpriteState {
|
|
state: world::tiles::TerrainSpriteState::Inactive,
|
|
})
|
|
.insert_resource(camera::CameraMoved(false))
|
|
.insert_resource(world::tiles::QuiltCache::default())
|
|
.add_systems(PreStartup, world::textures::initialize_textures)
|
|
.add_plugins(
|
|
DefaultPlugins
|
|
.set(WindowPlugin {
|
|
primary_window: Some(Window {
|
|
title: String::from("Dorf"),
|
|
..Default::default()
|
|
}),
|
|
..Default::default()
|
|
})
|
|
.set(ImagePlugin::default_nearest()),
|
|
)
|
|
.add_plugins(bevy_rand::plugin::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(
|
|
Startup,
|
|
(
|
|
camera::spawn_panning_camera,
|
|
cursor::setup_cursor,
|
|
entities::sentient::dorf::spawn_dorfs,
|
|
entities::livestock::pig::spawn_pigs,
|
|
entities::livestock::rabbit::spawn_rabbits,
|
|
),
|
|
)
|
|
.add_systems(
|
|
Update,
|
|
(
|
|
camera::scroll_events,
|
|
camera::camera_z_movement,
|
|
camera::camera_movement,
|
|
cursor::move_cursor,
|
|
),
|
|
)
|
|
.add_systems(Update, pig_drop_system)
|
|
.insert_resource(ItemRotationTimer::default())
|
|
.add_systems(Update, item_tile_management_system)
|
|
.run();
|
|
}
|