Fixed unit legs not resetting properly

This commit is contained in:
Anuken 2022-07-14 21:56:29 -04:00
parent 5ce95d7fc7
commit 25e82d927f
3 changed files with 7 additions and 6 deletions

View File

@ -74,7 +74,6 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
tree = new FileTree();
assets.setLoader(Sound.class, new SoundLoader(tree){
@Override
public void loadAsync(AssetManager manager, String fileName, Fi file, SoundParameter parameter){
@ -109,7 +108,6 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
@Override
public Music loadSync(AssetManager manager, String fileName, Fi file, MusicParameter parameter){
if(parameter != null && parameter.music != null){
mainExecutor.submit(() -> {
try{

View File

@ -202,8 +202,8 @@ public class SectorPresets{
rules = r -> {
r.objectives.addAll(
new BuildCountObjective(Blocks.shipFabricator, 1),
new UnitCountObjective(UnitTypes.elude, 1)
new BuildCountObjective(Blocks.shipFabricator, 1),
new UnitCountObjective(UnitTypes.elude, 1)
);
};
}};

View File

@ -89,16 +89,19 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
resetLegs(type.legLength);
}
//TODO clearly broken for many units
public void resetLegs(float legLength){
int count = type.legCount;
this.legs = new Leg[count];
if(type.lockLegBase){
baseRotation = rotation;
}
for(int i = 0; i < legs.length; i++){
Leg l = new Leg();
float dstRot = legAngle(i) + (type.lockLegBase ? rotation - baseRotation : baseRotation);
float dstRot = legAngle(i);
Vec2 baseOffset = legOffset(Tmp.v5, i).add(x, y);
l.joint.trns(dstRot, legLength/2f).add(baseOffset);