Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -1394,8 +1394,25 @@ class GenericObjectCreationNugget : public ObjectCreationNugget
FindPositionOptions fpOptions;
fpOptions.minRadius = GameLogicRandomValueReal(m_minDistanceAFormation, m_minDistanceBFormation);
fpOptions.maxRadius = m_maxDistanceFormation;
#if !RETAIL_COMPATIBLE_CRC
// TheSuperHackers @bugfix bobtista 18/11/2025 Use FPF_CLEAR_CELLS_ONLY when DiesOnBadLand to prevent spawning in water/cliffs
if (m_diesOnBadLand)
{
fpOptions.flags = static_cast<FindPositionFlags>(FPF_USE_HIGHEST_LAYER | FPF_CLEAR_CELLS_ONLY);
}
else
{
fpOptions.flags = FPF_USE_HIGHEST_LAYER;
}
// TheSuperHackers @bugfix bobtista 18/11/2025 Fall back to center if no passable position found in spread formation

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it'd be better to combine both comments given their proximity.

Could be something like:

// TheSuperHackers @bugfix bobtista 18/11/2025 Spawn the object on passable terrain if it would be destroyed on impassable terrain (water / cliffs). 
// Use the original spawn position if no passable terrain was found in spread formation.

if (!ThePartitionManager->findPositionAround(pos, &fpOptions, &resultPos))
{
resultPos = *pos;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this branch ever taken in your testing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't set a breaktpoint to check, I just played a game against an easy computer with water and mountains and eventually did rebel ambushes on the water and mountains to see if anyone died.

}
#else
fpOptions.flags = FPF_USE_HIGHEST_LAYER;
ThePartitionManager->findPositionAround(pos, &fpOptions, &resultPos);
#endif
doStuffToObj( debris, m_names[pick], &resultPos, mtx, orientation, sourceObj, lifetimeFrames );
}
else
Expand Down
Loading