Add chapter: 18

This commit is contained in:
2022-01-28 21:21:29 +01:00
parent 0e2c91dd12
commit cb17a9c356
12 changed files with 286 additions and 49 deletions

View File

@@ -14,7 +14,10 @@ use player::*;
use visibility_system::*;
use crate::gamelog::GameLog;
use crate::inventory_system::{ItemCollectionSystem, ItemDropSystem, ItemRemoveSystem, ItemUseSystem};
use crate::inventory_system::{
ItemCollectionSystem, ItemDropSystem, ItemRemoveSystem, ItemUseSystem,
};
use crate::particle_system::ParticleSpawnSystem;
mod components;
mod damage_system;
@@ -25,6 +28,7 @@ mod map;
mod map_indexing_system;
mod melee_combat_system;
mod monster_ai_system;
mod particle_system;
mod player;
mod random_table;
mod rect;
@@ -221,6 +225,9 @@ impl State {
let mut remove_items = ItemRemoveSystem {};
remove_items.run_now(&self.ecs);
let mut particle_spawn = ParticleSpawnSystem {};
particle_spawn.run_now(&self.ecs);
self.ecs.maintain();
}
}
@@ -234,6 +241,7 @@ impl GameState for State {
}
ctx.cls();
particle_system::cull_dead_particles(&mut self.ecs, ctx);
match new_run_state {
RunState::MainMenu { .. } => {}
@@ -392,7 +400,9 @@ impl GameState for State {
gui::GameOverResult::NoSelection => {}
gui::GameOverResult::QuitToMenu => {
self.game_over_cleanup();
new_run_state = RunState::MainMenu { menu_selection: gui::MainMenuSelection::NewGame };
new_run_state = RunState::MainMenu {
menu_selection: gui::MainMenuSelection::NewGame,
};
}
}
}
@@ -417,6 +427,7 @@ fn main() -> rltk::BError {
let mut gs = State { ecs: World::new() };
gs.ecs.insert(rltk::RandomNumberGenerator::new());
gs.ecs.insert(particle_system::ParticleBuilder::new());
gs.ecs.register::<Position>();
gs.ecs.register::<Renderable>();
@@ -446,6 +457,7 @@ fn main() -> rltk::BError {
gs.ecs.register::<MeleePowerBonus>();
gs.ecs.register::<DefenseBonus>();
gs.ecs.register::<WantsToRemoveItem>();
gs.ecs.register::<ParticleLifetime>();
gs.ecs.insert(SimpleMarkerAllocator::<SerializeMe>::new());