diff --git a/data/json/furniture_and_terrain/furniture-recreation.json b/data/json/furniture_and_terrain/furniture-recreation.json index 93e83819b6bf..501f44e66590 100644 --- a/data/json/furniture_and_terrain/furniture-recreation.json +++ b/data/json/furniture_and_terrain/furniture-recreation.json @@ -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, diff --git a/doc/src/content/docs/en/mod/json/reference/json_flags.md b/doc/src/content/docs/en/mod/json/reference/json_flags.md index ca66466e4088..f65b75ea86f5 100644 --- a/doc/src/content/docs/en/mod/json/reference/json_flags.md +++ b/doc/src/content/docs/en/mod/json/reference/json_flags.md @@ -597,6 +597,8 @@ List of known flags, used in both `terrain.json` and `furniture.json`. - `SEALED` Can't use e 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 diff --git a/src/ranged.cpp b/src/ranged.cpp index a4503e7ff643..3e9b7b6c48b4 100644 --- a/src/ranged.cpp +++ b/src/ranged.cpp @@ -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; @@ -2757,7 +2760,8 @@ tripoint target_ui::choose_initial_target() const std::vector 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;