Offset formations by 22.5 degrees when full (#5754)

This stops the annoying "unit bumping" problem on servers (at least with full formations), removed the other 2 lines as they didnt actually do anything.

Before: https://mee6.is-terrible.com/56YkB59o8.webm
After: I really cant be bothered
This commit is contained in:
buthed010203 2021-08-13 17:45:12 -04:00 committed by GitHub
parent 031b1abe0a
commit 74468855c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,21 +5,17 @@ import arc.math.geom.*;
import mindustry.ai.formations.*;
public class CircleFormation extends FormationPattern{
/** Angle offset. */
public float angleOffset = 0;
@Override
public Vec3 calculateSlotLocation(Vec3 outLocation, int slotNumber){
if(slots > 1){
float angle = (360f * slotNumber) / slots;
float angle = (360f * slotNumber) / slots + slots == 8 ? 22.5f : 0;
float radius = spacing / (float)Math.sin(180f / slots * Mathf.degRad);
outLocation.set(Angles.trnsx(angle, radius), Angles.trnsy(angle, radius), angle);
}else{
outLocation.set(0, spacing * 1.1f, 360f * slotNumber);
}
outLocation.z += angleOffset;
return outLocation;
}