Browse Source

Clean up more imports

Getty Ritter 2 years ago
parent
commit
b79fb06fd3

+ 0 - 3
chapter-07-damage/src/components.rs

@@ -1,7 +1,4 @@
-extern crate specs;
 use specs::prelude::*;
-extern crate rltk;
-extern crate specs_derive;
 use rltk::RGB;
 
 #[derive(Component)]

+ 3 - 4
chapter-07-damage/src/map.rs

@@ -1,9 +1,8 @@
-extern crate rltk;
-use super::Rect;
-use rltk::{Algorithm2D, BaseMap, Console, Point, RandomNumberGenerator, Rltk, RGB};
 use std::cmp::{max, min};
-extern crate specs;
+use crate::rect::Rect;
+
 use specs::prelude::*;
+use rltk::{Algorithm2D, BaseMap, Console, Point, RandomNumberGenerator, Rltk, RGB};
 
 const MAPWIDTH: usize = 80;
 const MAPHEIGHT: usize = 43;

+ 1 - 3
chapter-07-damage/src/player.rs

@@ -1,7 +1,5 @@
-extern crate rltk;
 use rltk::{Rltk, VirtualKeyCode};
-extern crate specs;
-use super::{CombatStats, Map, Position, MoveEvent, RunState, State, WantsToMelee, InputEvent};
+use crate::{CombatStats, Map, Position, MoveEvent, RunState, State, WantsToMelee, InputEvent};
 use specs::prelude::*;
 
 

+ 1 - 3
chapter-07-damage/src/systems/damage_system.rs

@@ -1,6 +1,4 @@
-extern crate specs;
 use crate::{CombatStats, Player, SufferDamage};
-use rltk::console;
 use specs::prelude::*;
 
 pub struct DamageSystem;
@@ -37,7 +35,7 @@ impl<'a> System<'a> for CleanupDead {
         for (entity, stats) in (&entities, &stats).join() {
             if stats.hp < 1 {
                 if player.contains(entity) {
-                    console::log("You are dead");
+                    rltk::console::log("You are dead");
                 } else {
                     dead.push(entity)
                 }

+ 0 - 1
chapter-07-damage/src/systems/map_indexing_system.rs

@@ -1,4 +1,3 @@
-extern crate specs;
 use crate::{BlocksTile, Map, Position};
 use specs::prelude::*;
 

+ 2 - 4
chapter-07-damage/src/systems/melee_combat_system.rs

@@ -1,6 +1,4 @@
-extern crate specs;
 use crate::{CombatStats, Name, SufferDamage, WantsToMelee};
-use rltk::console;
 use specs::prelude::*;
 
 pub struct MeleeCombatSystem;
@@ -28,12 +26,12 @@ impl<'a> System<'a> for MeleeCombatSystem {
                     let damage = i32::max(0, stats.power - target_stats.defense);
 
                     if damage == 0 {
-                        console::log(&format!(
+                        rltk::console::log(&format!(
                             "{} is unable to hurt {}",
                             &name.name, &target_name.name
                         ));
                     } else {
-                        console::log(&format!(
+                        rltk::console::log(&format!(
                             "{} hits {}, for {} hp.",
                             &name.name, &target_name.name, damage
                         ));

+ 0 - 2
chapter-07-damage/src/systems/monster_ai_system.rs

@@ -1,7 +1,5 @@
-extern crate specs;
 use crate::{Map, Monster, Position, RunState, Viewshed, WantsToMelee};
 use specs::prelude::*;
-extern crate rltk;
 use rltk::Point;
 
 pub struct MonsterAI;

+ 0 - 2
chapter-07-damage/src/systems/visibility_system.rs

@@ -1,7 +1,5 @@
-extern crate specs;
 use crate::{Map, Player, Position, Viewshed};
 use specs::prelude::*;
-extern crate rltk;
 use rltk::{field_of_view, Point};
 
 pub struct VisibilitySystem;