Skip to content

Commit

Permalink
feat(port): increase default search range for mission placement, sani…
Browse files Browse the repository at this point in the history
…ty-check search properties for scenario missions (#5900)

* feat(port): increase default search range for mission placement,

Co-Authored-By: RenechCDDA <[email protected]>
Co-Authored-By: Maleclypse <[email protected]>

* style(autofix.ci): automated formatting

---------

Co-authored-by: RenechCDDA <[email protected]>
Co-authored-by: Maleclypse <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Jan 8, 2025
1 parent f2dee9f commit 8bcd3b5
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 39 deletions.
37 changes: 17 additions & 20 deletions data/json/npcs/missiondef.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"value": 50000,
"start": {
"effect": [ "follow", { "u_buy_item": "sarcophagus_access_code" } ],
"assign_mission_target": { "om_terrain": "haz_sar_1_1", "om_special": "Hazardous Waste Sarcophagus", "reveal_radius": 3, "search_range": 360 }
"assign_mission_target": { "om_terrain": "haz_sar_1_1", "om_special": "Hazardous Waste Sarcophagus", "reveal_radius": 3 }
},
"origins": [ "ORIGIN_SECONDARY" ],
"destination": "haz_sar_b_1",
Expand Down Expand Up @@ -129,10 +129,7 @@
"difficulty": 2,
"value": 150000,
"item": "black_box_transcript",
"start": {
"effect": { "u_buy_item": "black_box" },
"assign_mission_target": { "om_terrain": "lab", "reveal_radius": 3, "search_range": 360 }
},
"start": { "effect": { "u_buy_item": "black_box" }, "assign_mission_target": { "om_terrain": "lab", "reveal_radius": 3 } },
"origins": [ "ORIGIN_SECONDARY" ],
"followup": "MISSION_EXPLORE_SARCOPHAGUS",
"dialogue": {
Expand Down Expand Up @@ -339,7 +336,7 @@
"item": "software_blood_data",
"start": {
"effect": [ { "u_buy_item": "vacutainer" }, { "u_buy_item": "usb_drive" } ],
"assign_mission_target": { "om_terrain": "hospital_2", "om_special": "hospital", "reveal_radius": 3, "search_range": 360 }
"assign_mission_target": { "om_terrain": "hospital_2", "om_special": "hospital", "reveal_radius": 3 }
},
"origins": [ "ORIGIN_SECONDARY" ],
"dialogue": {
Expand All @@ -362,9 +359,7 @@
"difficulty": 2,
"value": 150000,
"item": "etched_skull",
"start": {
"assign_mission_target": { "om_terrain": "cabin_strange", "om_special": "Strange Cabin", "reveal_radius": 3, "search_range": 360 }
},
"start": { "assign_mission_target": { "om_terrain": "cabin_strange", "om_special": "Strange Cabin", "reveal_radius": 3 } },
"origins": [ "ORIGIN_SECONDARY" ],
"followup": "MISSION_INVESTIGATE_PRISON_VISIONARY",
"dialogue": {
Expand All @@ -388,7 +383,7 @@
"value": 150000,
"item": "visions_solitude",
"start": {
"assign_mission_target": { "om_terrain": "prison_1_4", "om_special": "Prison", "reveal_radius": 3, "search_range": 360 },
"assign_mission_target": { "om_terrain": "prison_1_4", "om_special": "Prison", "reveal_radius": 3 },
"update_mapgen": {
"set": [ { "point": "terrain", "id": "t_door_bar_o", "x": 12, "y": 19 } ],
"place_fields": [
Expand Down Expand Up @@ -580,10 +575,7 @@
"goal": "MGOAL_GO_TO_TYPE",
"difficulty": 2,
"value": 60000,
"start": {
"effect": "follow_only",
"assign_mission_target": { "om_terrain": "fema_entrance", "reveal_radius": 3, "search_range": 256 }
},
"start": { "effect": "follow_only", "assign_mission_target": { "om_terrain": "fema_entrance", "reveal_radius": 3 } },
"origins": [ "ORIGIN_SECONDARY" ],
"followup": "MISSION_REACH_FARM_HOUSE",
"destination": "fema_entrance",
Expand All @@ -608,9 +600,7 @@
"destination": "s_air_hangars",
"difficulty": 1,
"value": 0,
"start": {
"assign_mission_target": { "om_terrain": "s_air_hangars", "reveal_radius": 5, "om_special": "o_airport", "search_range": 100 }
},
"start": { "assign_mission_target": { "om_terrain": "s_air_hangars", "reveal_radius": 5, "om_special": "o_airport" } },
"origins": [ "ORIGIN_GAME_START" ]
},
{
Expand All @@ -632,7 +622,15 @@
"destination": "mansion_c3",
"difficulty": 1,
"value": 0,
"start": { "assign_mission_target": { "om_terrain": "mansion_c3", "om_special": "Mansion_Wild", "search_range": 200 } },
"start": {
"assign_mission_target": {
"om_terrain": "mansion_c3",
"om_special": "Mansion_Wild",
"reveal_radius": 1,
"search_range": 200,
"min_distance": 45
}
},
"origins": [ "ORIGIN_GAME_START" ]
},
{
Expand Down Expand Up @@ -842,8 +840,7 @@
"om_terrain": "s_air_term",
"om_special": "o_airport",
"reveal_radius": 6,
"random": true,
"search_range": 90,
"search_range": 200,
"min_distance": 45,
"z": 0
},
Expand Down
4 changes: 1 addition & 3 deletions data/json/npcs/necropolis/NPC_Old_Guard_Captain.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@
"difficulty": 5,
"value": 250000,
"monster_type": "mon_charred_nightmare",
"start": {
"assign_mission_target": { "om_terrain": "necropolis_c_44", "om_special": "Necropolis", "z": -2, "search_range": 360 }
},
"start": { "assign_mission_target": { "om_terrain": "necropolis_c_44", "om_special": "Necropolis", "z": -2 } },
"monster_kill_goal": 20,
"origins": [ "ORIGIN_SECONDARY" ],
"dialogue": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@
"value": 50000,
"item": "commune_prospectus",
"start": {
"assign_mission_target": { "om_terrain": "ranch_camp_67", "om_special": "ranch_camp", "reveal_radius": 1, "search_range": 200 },
"assign_mission_target": { "om_terrain": "ranch_camp_67", "om_special": "ranch_camp", "reveal_radius": 1 },
"update_mapgen": {
"place_npcs": [
{ "class": "ranch_foreman", "x": 16, "y": 15, "target": true, "add_trait": "NPC_MISSION_LEV_1" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"difficulty": 5,
"value": 50000,
"start": {
"assign_mission_target": { "om_terrain": "bandit_cabin", "om_special": "bandit_cabin", "reveal_radius": 1, "search_range": 60 },
"assign_mission_target": { "om_terrain": "bandit_cabin", "om_special": "bandit_cabin", "reveal_radius": 1 },
"update_mapgen": {
"set": [
{ "point": "trap", "id": "tr_landmine_buried", "x": 7, "y": 6 },
Expand Down Expand Up @@ -214,13 +214,7 @@
"difficulty": 10,
"value": 300000,
"start": {
"assign_mission_target": {
"om_terrain": "bandit_camp_1",
"om_special": "bandit_camp",
"reveal_radius": 1,
"min_distance": 10,
"search_range": 120
},
"assign_mission_target": { "om_terrain": "bandit_camp_1", "om_special": "bandit_camp", "reveal_radius": 1, "min_distance": 10 },
"update_mapgen": { "place_npcs": [ { "class": "bandit", "x": 17, "y": 9, "target": true } ] },
"effect": [
{ "u_buy_item": "ruger_redhawk" },
Expand Down Expand Up @@ -253,9 +247,7 @@
"difficulty": 8,
"value": 200000,
"item": "necropolis_datasheet",
"start": {
"assign_mission_target": { "om_terrain": "necropolis_a_29", "om_special": "Necropolis", "reveal_radius": 5, "search_range": 360 }
},
"start": { "assign_mission_target": { "om_terrain": "necropolis_a_29", "om_special": "Necropolis", "reveal_radius": 5 } },
"origins": [ "ORIGIN_SECONDARY" ],
"followup": "MISSION_FREE_MERCHANTS_EVAC_4",
"dialogue": {
Expand Down
2 changes: 1 addition & 1 deletion data/json/npcs/robofac/NPC_ROBOFAC_MERC_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
"difficulty": 0,
"value": 0,
"start": {
"assign_mission_target": { "om_terrain": "robofachq_surface_entrance", "om_special": "hub_01", "reveal_radius": 1, "search_range": 90, "z": 0 }
"assign_mission_target": { "om_terrain": "robofachq_surface_entrance", "om_special": "hub_01", "reveal_radius": 1, "z": 0 }
},
"end": {
"effect": [
Expand Down
2 changes: 1 addition & 1 deletion data/json/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@
"start_name": "A Stop On The Road",
"allowed_locs": [ "sloc_gas_station" ],
"missions": [ "MISSION_LAST_DELIVERY" ],
"flags": [ "LONE_START" ]
"flags": [ "LONE_START", "CITY_START" ]
},
{
"type": "scenario",
Expand Down
2 changes: 1 addition & 1 deletion src/mission.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ struct mission_target_params {
bool cant_see = false;
bool random = false;
bool create_if_necessary = true;
int search_range = OMAPX;
int search_range = OMAPX * 14;
std::optional<int> z;
npc *guy = nullptr;
};
Expand Down
3 changes: 2 additions & 1 deletion src/mission_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ static std::optional<tripoint_abs_omt> find_or_create_om_terrain(
// If we got here and this is still invalid, it means that we couldn't find it nor create it
// on any overmap (new or existing) within the allowed search range.
if( target_pos == overmap::invalid_tripoint ) {
debugmsg( "Unable to find and assign mission target %s.", params.overmap_terrain );
debugmsg( "Unable to find and assign mission target %s within %d tiles.",
params.overmap_terrain, find_params.search_range );
return std::nullopt;
}
return target_pos;
Expand Down

0 comments on commit 8bcd3b5

Please sign in to comment.