This commit is contained in:
Llywelwyn 2023-07-24 04:32:56 +01:00
parent 0472c8a8bf
commit 1c435f8d60
3 changed files with 11 additions and 4 deletions

View file

@ -176,7 +176,10 @@ pub fn print_options(inventory: BTreeMap<(String, String), i32>, mut y: i32, ctx
x += 2;
ctx.print(x, y, name.1.to_string());
} else {
if ['a', 'e', 'i', 'o', 'u'].iter().any(|&v| name.0.starts_with(v)) {
if name.0.ends_with("s") {
ctx.print(x, y, "some");
x += 5;
} else if ['a', 'e', 'i', 'o', 'u'].iter().any(|&v| name.0.starts_with(v)) {
// If one and starts with a vowel, print 'an'
// i.e. (a) an apple
ctx.print(x, y, "an");

View file

@ -134,8 +134,8 @@ impl State {
let mut particle_system = particle_system::ParticleSpawnSystem {};
vis.run_now(&self.ecs);
mob.run_now(&self.ecs);
mapindex.run_now(&self.ecs);
mob.run_now(&self.ecs);
trigger_system.run_now(&self.ecs);
inventory_system.run_now(&self.ecs);
item_use_system.run_now(&self.ecs);

View file

@ -31,6 +31,9 @@ pub fn try_door(i: i32, j: i32, ecs: &mut World) -> RunState {
{
let destination_idx = map.xy_idx(pos.x + delta_x, pos.y + delta_y);
if map.tile_content[destination_idx].len() == 0 {
gamelog::Logger::new().append("You see no door there.").log();
}
for potential_target in map.tile_content[destination_idx].iter() {
let door = doors.get_mut(*potential_target);
if let Some(door) = door {
@ -62,7 +65,6 @@ pub fn try_door(i: i32, j: i32, ecs: &mut World) -> RunState {
}
}
}
gamelog::Logger::new().append("You see no door there.").log();
return RunState::AwaitingInput;
}
@ -90,6 +92,9 @@ pub fn open(i: i32, j: i32, ecs: &mut World) -> RunState {
{
let destination_idx = map.xy_idx(pos.x + delta_x, pos.y + delta_y);
if map.tile_content[destination_idx].len() == 0 {
gamelog::Logger::new().append("You see no door there.").log();
}
for potential_target in map.tile_content[destination_idx].iter() {
let door = doors.get_mut(*potential_target);
if let Some(door) = door {
@ -111,7 +116,6 @@ pub fn open(i: i32, j: i32, ecs: &mut World) -> RunState {
}
}
}
gamelog::Logger::new().append("You see no door there.").log();
return RunState::AwaitingInput;
}