Fix odd frontline unit spawns

* Modfied frontline vector to ensure start point stays outside of
  exclusion zone.  (Previously it could be up to 100m inside)

* Change randomization in offset distance from frontline to be based
  on a percentage of the unit type's fixed offset instead of the
  width of frontline.
  (Prevents units from being far from their expected distance from
  frontline)

* Change visualgen to use the same frontline vector calculation as the
  unit spawns
This commit is contained in:
walterroach
2020-11-28 18:43:32 -06:00
parent 55573bf40a
commit 29b894f8b0
4 changed files with 22 additions and 25 deletions

View File

@@ -103,15 +103,12 @@ class VisualGenerator:
if from_cp.is_global or to_cp.is_global:
continue
frontline = Conflict.frontline_position(from_cp, to_cp, self.game.theater)
if not frontline:
plane_start, heading, distance = Conflict.frontline_vector(from_cp, to_cp, self.game.theater)
if not plane_start:
continue
point, heading = frontline
plane_start = point.point_from_heading(turn_heading(heading, 90), FRONTLINE_LENGTH / 2)
for offset in range(0, FRONTLINE_LENGTH, FRONT_SMOKE_SPACING):
position = plane_start.point_from_heading(turn_heading(heading, - 90), offset)
for offset in range(0, distance, FRONT_SMOKE_SPACING):
position = plane_start.point_from_heading(heading, offset)
for k, v in FRONT_SMOKE_TYPE_CHANCES.items():
if random.randint(0, 100) <= k: