Remove road vehicles from mine field #79908
Open
+23
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
None
Purpose of change
Fix #79889, i.e. minefield placement generating errors due to collision with road generated vehicles.
Describe the solution
Remove all vehicles that may have been generated by the road generation before placing the mine field stuff.
Describe alternatives you've considered
Only remove vehicles that overlap with placed vehicles. Decided against it as it doesn't make sense to have both sets of vehicles at the OMT (and it can presumably cause other problems as well).
Testing
Created a new coded map extra placed on roads with a southern road connection (to match the double humvee minefield orientation) and added the JSON for it with a weight of 1000000.
Created a test for this map extra based on the one for the mine field.
Added log output in the map extra code to print what vehicles were present before the code got to work.
Ran the new test and saw similar symptoms as for the failed minefield test.
Changed the code to remove the pre generated vehicles.
Saw there were still weird errors generated.
Changed the map load to load vehicles properly.
Only saw the logs stating vehicles were detected (line before they were removed), but no errors.
Changed the minefield code as per this PR based on the above.
Additional context
This problem may occur with other map extras that spawn on top of a base that can spawn vehicles on the base OMT. I have made no attempt to investigate this.
I haven't tracked down why the vehicle placement on top of other vehicles resulted in out of bounds errors. There may still be a bug hiding there. My debug output didn't report any vehicles placements that seemed dangerous as far as I noted.