Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed collapse_check logic #72962

Merged
merged 1 commit into from
Apr 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3724,6 +3724,13 @@ int map::collapse_check( const tripoint &p ) const
const bool collapses = has_flag( ter_furn_flag::TFLAG_COLLAPSES, p );
const bool supports_roof = has_flag( ter_furn_flag::TFLAG_SUPPORTS_ROOF, p );

if( has_flag( ter_furn_flag::TFLAG_SINGLE_SUPPORT, p ) ) {
// We should definitely collapse if there's no support below, and
// given that a single wall as a support below isn't sufficient, a tree
// is deemed not to be sufficient either.
return 0;
}

int num_supports = p.z == OVERMAP_DEPTH ? 0 : -5;
// if there's support below, things are less likely to collapse
if( p.z > -OVERMAP_DEPTH ) {
Expand All @@ -3737,9 +3744,6 @@ int map::collapse_check( const tripoint &p ) const
if( tbelow == pbelow ) {
num_supports += 2;
}
if( has_flag( ter_furn_flag::TFLAG_SINGLE_SUPPORT, p ) ) {
num_supports = 0;
}
}
}
}
Expand All @@ -3764,9 +3768,6 @@ int map::collapse_check( const tripoint &p ) const
}
}
}
if( has_flag( ter_furn_flag::TFLAG_SINGLE_SUPPORT, p ) ) {
num_supports = 0;
}
}

return 1.7 * num_supports;
Expand Down
Loading