Added doors to houses

This commit is contained in:
Joshua Barretto 2020-04-22 10:07:50 +01:00
parent a65dbc570a
commit 60bf396e4f
4 changed files with 27 additions and 3 deletions

View File

@ -74,7 +74,7 @@ impl Route {
if vol.get(next).map(|b| b.is_solid()).unwrap_or(false) {
None
} else {
let next_tgt = next.map(|e| e as f32) + Vec3::new(0.5, 0.5, 0.0);
let next_tgt = next.map(|e| e as f32) + 0.5;
if ((pos - next_tgt) * Vec3::new(1.0, 1.0, 0.3)).magnitude_squared()
< (traversal_tolerance * 2.0).powf(2.0)
{

View File

@ -303,7 +303,7 @@ impl Block {
pub fn get_ori(&self) -> Option<u8> {
match self.kind {
BlockKind::Window1 | BlockKind::Window2 | BlockKind::Window3 | BlockKind::Window4 => {
BlockKind::Window1 | BlockKind::Window2 | BlockKind::Window3 | BlockKind::Window4 | BlockKind::Door => {
Some(self.color[0] & 0b111)
},
_ => None,

View File

@ -1607,7 +1607,7 @@ impl<V: RectRasterableVol> Terrain<V> {
(BlockKind::Door, 0),
make_model(
"voxygen.voxel.sprite.door.door-0",
Vec3::new(-6.5, -6.5, 0.0),
Vec3::new(-5.5, -5.5, 0.0),
),
),
]

View File

@ -309,6 +309,30 @@ impl Archetype for House {
// Wall
if dist == width && profile.y < roof_level {
// Doors
if center_offset.x > 0 && center_offset.y > 0
&& bound_offset.x > 0 && bound_offset.x < width
&& profile.y < ceil_height
&& branch.attr.storey_fill.has_lower()
{
return Some(if (bound_offset.x == (width - 1) / 2 || bound_offset.x == (width - 1) / 2 + 1) && profile.y <= foundation_height + 3 {
if profile.y == foundation_height + 1 {
BlockMask::new(
Block::new(BlockKind::Door, if bound_offset.x == (width - 1) / 2 {
make_meta(ori.flip())
} else {
make_meta(ori.flip()) + Rgb::new(4, 0, 0)
}),
structural_layer,
)
} else {
empty.with_priority(structural_layer)
}
} else {
wall
});
}
if bound_offset.x == bound_offset.y || profile.y == ceil_height {
// Support beams
return Some(log);