mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-09 20:29:06 +07:00
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:
parent
031b1abe0a
commit
74468855c2
@ -5,21 +5,17 @@ import arc.math.geom.*;
|
|||||||
import mindustry.ai.formations.*;
|
import mindustry.ai.formations.*;
|
||||||
|
|
||||||
public class CircleFormation extends FormationPattern{
|
public class CircleFormation extends FormationPattern{
|
||||||
/** Angle offset. */
|
|
||||||
public float angleOffset = 0;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3 calculateSlotLocation(Vec3 outLocation, int slotNumber){
|
public Vec3 calculateSlotLocation(Vec3 outLocation, int slotNumber){
|
||||||
if(slots > 1){
|
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);
|
float radius = spacing / (float)Math.sin(180f / slots * Mathf.degRad);
|
||||||
outLocation.set(Angles.trnsx(angle, radius), Angles.trnsy(angle, radius), angle);
|
outLocation.set(Angles.trnsx(angle, radius), Angles.trnsy(angle, radius), angle);
|
||||||
}else{
|
}else{
|
||||||
outLocation.set(0, spacing * 1.1f, 360f * slotNumber);
|
outLocation.set(0, spacing * 1.1f, 360f * slotNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
outLocation.z += angleOffset;
|
|
||||||
|
|
||||||
return outLocation;
|
return outLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user