Skip to content

Commit

Permalink
Fix levers and buttons hard powering blocks next to them when placed …
Browse files Browse the repository at this point in the history
…on ceiling or floor
  • Loading branch information
StackDoubleFlow committed Dec 18, 2023
1 parent 6ae0623 commit 58b9d6b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 4 additions & 2 deletions crates/core/src/redpiler/passes/input_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,15 @@ impl<'a, W: World> InputSearchState<'a, W> {
Block::Lever { lever } => match side {
BlockFace::Top if lever.face == LeverFace::Floor => true,
BlockFace::Bottom if lever.face == LeverFace::Ceiling => true,
_ if lever.facing == side.to_direction() => true,
_ if lever.face == LeverFace::Wall && lever.facing == side.to_direction() => true,
_ => false,
},
Block::StoneButton { button } => match side {
BlockFace::Top if button.face == ButtonFace::Floor => true,
BlockFace::Bottom if button.face == ButtonFace::Ceiling => true,
_ if button.facing == side.to_direction() => true,
_ if button.face == ButtonFace::Wall && button.facing == side.to_direction() => {
true
}
_ => false,
},
Block::RedstoneRepeater { .. } => self.provides_weak_power(block, side),
Expand Down
14 changes: 12 additions & 2 deletions crates/core/src/redstone/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,23 @@ fn get_strong_power(
Block::Lever { lever } => match side {
BlockFace::Top if lever.face == LeverFace::Floor && lever.powered => 15,
BlockFace::Bottom if lever.face == LeverFace::Ceiling && lever.powered => 15,
_ if lever.facing == side.to_direction() && lever.powered => 15,
_ if lever.face == LeverFace::Wall
&& lever.facing == side.to_direction()
&& lever.powered =>
{
15
}
_ => 0,
},
Block::StoneButton { button } => match side {
BlockFace::Top if button.face == ButtonFace::Floor && button.powered => 15,
BlockFace::Bottom if button.face == ButtonFace::Ceiling && button.powered => 15,
_ if button.facing == side.to_direction() && button.powered => 15,
_ if button.face == ButtonFace::Wall
&& button.facing == side.to_direction()
&& button.powered =>
{
15
}
_ => 0,
},
Block::StonePressurePlate { powered: true } if side == BlockFace::Top => 15,
Expand Down

0 comments on commit 58b9d6b

Please sign in to comment.