diff --git a/src/components.rs b/src/components.rs index 9768180..73bd8a0 100644 --- a/src/components.rs +++ b/src/components.rs @@ -81,14 +81,17 @@ pub enum ActorType { // Entity? Character? Creature? Actor? Avatar? Unit? Agent? ManCave, Pig, Rat, - Spider, + OrbSpider, Bear, Ant, Locust, Wasp, Dingo, Kangaroo, - IceFox + IceFox, + BrownRat, + Spider, + Crab } impl ActorType { pub fn sprite_row_and_col(&self) -> (usize, usize) { @@ -104,7 +107,7 @@ impl ActorType { ActorType::ManCave => (60, 25), ActorType::Pig => (64, 0), ActorType::Rat => (64, 19), - ActorType::Spider => (64, 20), + ActorType::OrbSpider => (64, 20), ActorType::Bear => (64, 21), ActorType::Ant => (64, 22), ActorType::Locust => (64, 23), @@ -112,6 +115,9 @@ impl ActorType { ActorType::Dingo => (64, 25), ActorType::Kangaroo => (64, 26), ActorType::IceFox => (64, 27), + ActorType::BrownRat => (64, 28), + ActorType::Spider => (64, 29), + ActorType::Crab => (63, 29), } } pub fn sprite_index(&self) -> usize { diff --git a/src/monstergenerator_system.rs b/src/monstergenerator_system.rs index 62fdd10..3fac549 100644 --- a/src/monstergenerator_system.rs +++ b/src/monstergenerator_system.rs @@ -41,7 +41,6 @@ pub fn monster_generator( can_generate = false; } } - if !can_generate { return; } diff --git a/src/startup.rs b/src/startup.rs index 9f7aa97..7aba697 100644 --- a/src/startup.rs +++ b/src/startup.rs @@ -22,7 +22,7 @@ pub fn startup( biome: Res, ) { // GENERATE UNITS - for i in 1..6 { + for i in 1..=5 { let position = Position { x: 3, y: 3*i, z: 0 }; match i { 1 => { @@ -36,6 +36,11 @@ pub fn startup( } } } + // SPAWN MANDATORY RUSTACEANS + for i in 1..=3 { + let position = Position { x: 20, y: 3*i, z: 0 }; + spawn_unit_from_template(&mut commands, position, &sprite_sheet, &UnitTemplate::crab()); + } let position = Position { x: 10, y: 10, z: 0 }; commands diff --git a/src/unitgenerator_system.rs b/src/unitgenerator_system.rs index a52669b..e27bcea 100644 --- a/src/unitgenerator_system.rs +++ b/src/unitgenerator_system.rs @@ -181,6 +181,25 @@ impl UnitTemplate { ], } } + pub fn crab() -> Self { + let actor_type = ActorType::Crab; + let random_afflictions = vec![];//Self::random_afflictions_animal(); + Self { + actor_type, + food_need: None, + entertainment_need: None, + sleep_need: None, + personality: vec![PersonalityTrait::Creature], + afflictions: random_afflictions.to_vec(), + skillset: Skillset::default(), + attributes: Attributeset::default(), + component_builders: vec![ + |commands: &mut Commands, entity: Entity| { + commands.entity(entity).insert(HasName { name: ["Crab", "Carl", "Rusty"][rand::thread_rng().gen_range(0..3)].to_string() }); + }, + ], + } + } pub fn random_afflictions_humanoid() -> Vec { //////////////////////////// // Select some Afflictions