diff --git a/server/src/sys/terrain.rs b/server/src/sys/terrain.rs index cb028e29ea..25b838e61a 100644 --- a/server/src/sys/terrain.rs +++ b/server/src/sys/terrain.rs @@ -2,7 +2,7 @@ use super::SysTimer; use crate::{chunk_generator::ChunkGenerator, client::Client, Tick}; use common::{ assets, - comp::{self, item, CharacterAbility, ItemConfig, Player, Pos, Alignment}, + comp::{self, item, Alignment, CharacterAbility, ItemConfig, Player, Pos}, event::{EventBus, ServerEvent}, generation::get_npc_name, msg::ServerMsg, @@ -266,7 +266,11 @@ impl<'a> System<'a> for Sys { "Gentle" }; stats = comp::Stats::new( - format!("{} Giant {}", adjective, get_npc_name(&NPC_NAMES.humanoid, body_new.race)), + format!( + "{} Giant {}", + adjective, + get_npc_name(&NPC_NAMES.humanoid, body_new.race) + ), body, ); } diff --git a/world/src/site/dungeon/mod.rs b/world/src/site/dungeon/mod.rs index c5478aa4fc..16dd5ed58b 100644 --- a/world/src/site/dungeon/mod.rs +++ b/world/src/site/dungeon/mod.rs @@ -186,7 +186,7 @@ const TILE_SIZE: i32 = 13; #[derive(Clone)] pub enum Tile { - UpStair, + UpStair(Id), DownStair(Id), Room(Id), Tunnel, @@ -196,7 +196,7 @@ pub enum Tile { impl Tile { fn is_passable(&self) -> bool { match self { - Tile::UpStair => true, + Tile::UpStair(_) => true, Tile::DownStair(_) => true, Tile::Room(_) => true, Tile::Tunnel => true, @@ -259,7 +259,7 @@ impl Floor { const STAIR_ROOM_HEIGHT: i32 = 13; // Create rooms for entrance and exit - this.create_room(Room { + let upstair_room = this.create_room(Room { seed: ctx.rng.gen(), loot_density: 0.0, enemy_density: None, @@ -268,7 +268,8 @@ impl Floor { height: STAIR_ROOM_HEIGHT, pillars: None, }); - this.tiles.set(stair_tile - tile_offset, Tile::UpStair); + this.tiles + .set(stair_tile - tile_offset, Tile::UpStair(upstair_room)); if final_level { // Boss room this.create_room(Room { @@ -376,7 +377,7 @@ impl Floor { let transition = |_a: &Vec2, b: &Vec2| match self.tiles.get(*b) { Some(Tile::Room(_)) | Some(Tile::Tunnel) => 1.0, Some(Tile::Solid) => 25.0, - Some(Tile::UpStair) | Some(Tile::DownStair(_)) => 0.0, + Some(Tile::UpStair(_)) | Some(Tile::DownStair(_)) => 0.0, _ => 100000.0, }; let satisfied = |l: &Vec2| *l == b; @@ -625,14 +626,14 @@ impl Floor { make_staircase(Vec3::new(rtile_pos.x, rtile_pos.y, z), 0.0, 0.5, 9.0) .resolve_with(empty) }, - Some(Tile::UpStair) => { + Some(Tile::UpStair(room)) => { let mut block = make_staircase( Vec3::new(rtile_pos.x, rtile_pos.y, z), TILE_SIZE as f32 / 2.0, 0.5, 9.0, ); - if z < self.hollow_depth { + if z < self.rooms[*room].height { block = block.resolve_with(empty); } block