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

Port over two improvements to simple deconstruct #3334

Merged
merged 2 commits into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion data/json/construction.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"group": "deconstruct_simple_furniture",
"category": "FURN",
"required_skills": [ [ "fabrication", 0 ] ],
"time": "10 m",
"time": "10 s",
"pre_note": "Certain terrain and furniture can be deconstructed without any tools.",
"pre_flags": "EASY_DECONSTRUCT",
"pre_special": "check_deconstruct",
Expand Down
6 changes: 4 additions & 2 deletions src/construction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,8 +977,10 @@ bool can_construct( const construction &con, const tripoint &p )
place_okay &= has_pre_terrain( con, p );
// see if the flags check out
place_okay &= std::all_of( con.pre_flags.begin(), con.pre_flags.end(),
[&p]( const std::string & flag ) {
return get_map().has_flag( flag, p );
[&p, &here]( const std::string & flag ) -> bool {
const furn_id &furn = here.furn( p );
const ter_id &ter = here.ter( p );
return furn == f_null ? ter->has_flag( flag ) : furn->has_flag( flag );
} );
// make sure the construction would actually do something
if( !con.post_terrain.is_empty() ) {
Expand Down