Leg collision bugfixes

This commit is contained in:
Anuken
2021-08-22 18:48:12 -04:00
parent 6388e8da56
commit 5e737510a3
6 changed files with 21 additions and 3 deletions

View File

@@ -50,10 +50,18 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
resetLegs();
}
@Override
public void unloaded(){
resetLegs(1f);
}
public void resetLegs(){
resetLegs(type.legLength);
}
public void resetLegs(float legLength){
float rot = baseRotation;
int count = type.legCount;
float legLength = type.legLength;
this.legs = new Leg[count];

View File

@@ -122,6 +122,7 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
//decrement count to prevent double increment
if(!u.isAdded()) u.team.data().updateCount(u.type, -1);
u.add();
u.unloaded();
return true;
}

View File

@@ -51,6 +51,11 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
private transient boolean wasPlayer;
private transient boolean wasHealed;
/** Called when this unit was unloaded from a factory or spawn point. */
public void unloaded(){
}
/** Move based on preferred unit movement type. */
public void movePref(Vec2 movement){
if(type.omniMovement){