Skip to content

Commit

Permalink
Mandatory crabs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryankopf committed Aug 8, 2023
1 parent e987538 commit 0567aaf
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -104,14 +107,17 @@ 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),
ActorType::Wasp => (64, 24),
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 {
Expand Down
1 change: 0 additions & 1 deletion src/monstergenerator_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ pub fn monster_generator(
can_generate = false;
}
}

if !can_generate {
return;
}
Expand Down
7 changes: 6 additions & 1 deletion src/startup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn startup(
biome: Res<Biome>,
) {
// 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 => {
Expand All @@ -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
Expand Down
19 changes: 19 additions & 0 deletions src/unitgenerator_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Affliction> {
////////////////////////////
// Select some Afflictions
Expand Down

0 comments on commit 0567aaf

Please sign in to comment.