simplify
This commit is contained in:
@@ -485,10 +485,11 @@ impl GameState {
|
||||
// A solid object in the way is bumped by the player — possibly through a
|
||||
// chain of crates the player is shoving (see `bump_target`) — but a grab
|
||||
// thing fires grab() instead of bump(), so don't also bump it.
|
||||
bumped = grabbed
|
||||
.is_none()
|
||||
.then(|| board.bump_target(nx, ny, dir))
|
||||
.flatten();
|
||||
bumped = if grabbed.is_none() {
|
||||
board.bump_target(nx, ny, dir)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
if grabbed.is_some() || board.is_passable(nx, ny) || board.can_push(nx, ny, dir) {
|
||||
// Don't push a grab thing aside — walk onto it. Otherwise shove any
|
||||
// pushable chain out of the way (no-op when there's nothing to push).
|
||||
|
||||
Reference in New Issue
Block a user