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

feat: allow treating steel targets as practice targets #4143

Merged
merged 6 commits into from
Feb 4, 2024
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/furniture_and_terrain/furniture-recreation.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"move_cost_mod": 2,
"coverage": 40,
"required_str": 5,
"flags": [ "PLACE_ITEM", "TRANSPARENT" ],
"flags": [ "PLACE_ITEM", "TRANSPARENT", "SHOOT_ME" ],
"bash": {
"str_min": 6,
"str_max": 40,
Expand Down
2 changes: 2 additions & 0 deletions doc/src/content/docs/en/mod/json/reference/json_flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,8 @@ List of known flags, used in both `terrain.json` and `furniture.json`.
- `SEALED` Can't use <kbd>e</kbd> to retrieve items; must smash them open first.
- `SEEN_FROM_ABOVE` Visible from a higher level (provided the tile above has no floor)
- `SHARP` May do minor damage to players/monsters passing through it.
- `SHOOT_ME` Players can aim at terrain or furniture with this flag like they can with
`tr_practice_target` to train marksmanship.
- `SHORT` Feature too short to collide with vehicle protrusions. (mirrors, blades).
- `SIGN` Show written message on examine.
- `SMALL_PASSAGE` This terrain or furniture is too small for large or huge creatures to pass
Expand Down
6 changes: 5 additions & 1 deletion src/ranged.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ static const bionic_id bio_ups( "bio_ups" );
static const trait_id trait_PYROMANIA( "PYROMANIA" );
static const trait_id trait_NORANGEDCRIT( "NO_RANGED_CRIT" );

// not to confuse with item flags (json_flag)
static const std::string flag_SHOOT_ME( "SHOOT_ME" );

// Maximum duration of aim-and-fire loop, in turns
static constexpr int AIF_DURATION_LIMIT = 10;

Expand Down Expand Up @@ -2757,7 +2760,8 @@ tripoint target_ui::choose_initial_target()
const std::vector<tripoint> nearby = closest_points_first( src, range );
const auto target_spot = std::find_if( nearby.begin(), nearby.end(),
[this, &here]( const tripoint & pt ) {
return here.tr_at( pt ).id == tr_practice_target && this->you->sees( pt );
return ( here.has_flag_ter_or_furn( flag_SHOOT_ME, pt ) ||
here.tr_at( pt ).id == tr_practice_target ) && this->you->sees( pt );
} );
if( target_spot != nearby.end() ) {
return *target_spot;
Expand Down
Loading