This commit is contained in:
Anuken
2020-02-08 16:00:54 -05:00
parent ba1f59aa71
commit 5169e197b6
8 changed files with 9 additions and 11 deletions

View File

@ -272,7 +272,7 @@ public class EntityProcess extends BaseProcessor{
err("Type " + type + " has multiple components implementing non-void method " + entry.key + ".");
}
entry.value.sort(m -> m.has(MethodPriority.class) ? m.annotation(MethodPriority.class).value() : 0);
entry.value.sort(Structs.comps(Structs.comparingFloat(m -> m.has(MethodPriority.class) ? m.annotation(MethodPriority.class).value() : 0), Structs.comparing(Selement::name)));
//representative method
Smethod first = entry.value.first();

View File

@ -269,6 +269,7 @@ public class Blocks implements ContentList{
ice = new Floor("ice"){{
dragMultiplier = 0.35f;
speedMultiplier = 0.9f;
attributes.set(Attribute.water, 0.4f);
}};

View File

@ -115,8 +115,7 @@ public class EntityCollisions{
tree.clear();
group.each(s -> {
s.lastX(s.getX());
s.lastY(s.getY());
s.updateLastPosition();
tree.insert(s);
});
}

View File

@ -19,8 +19,6 @@ abstract class EntityComp{
return added;
}
void init(){}
void update(){}
void remove(){

View File

@ -32,7 +32,6 @@ abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{
}
void moveAt(Vec2 vector){
Floor on = isFlying() ? Blocks.air.asFloor() : floorOn();
Vec2 t = Tmp.v3.set(vector).scl(floorSpeedMultiplier()); //target vector
float mag = Tmp.v3.len();
vel.x = Mathf.approach(vel.x, t.x, mag);

View File

@ -13,10 +13,9 @@ abstract class LegsComp implements Posc, Flyingc, Hitboxc, DrawLayerGroundUnderc
@Override
public void update(){
if(vel().len() > 0.5f){
baseRotation = Angles.moveToward(baseRotation, vel().angle(), type().baseRotateSpeed);
walkTime += Time.delta()*vel().len()/1f;
}
float len = vel().len();
baseRotation = Angles.moveToward(baseRotation, vel().angle(), type().baseRotateSpeed * Mathf.clamp(len / type().speed));
walkTime += Time.delta()*len/1f;
}
@Override

View File

@ -12,6 +12,8 @@ abstract class VelComp implements Posc{
final Vec2 vel = new Vec2();
float drag = 0f;
//velocity needs to be called first, as it affects delta and lastPosition
@MethodPriority(-1)
@Override
public void update(){
move(vel.x, vel.y);

View File

@ -1,3 +1,3 @@
org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=0328073f1993cd1d72a237781c3cc1f82395234b
archash=68b2451bd0f8c6252ccf2c065a1c4b4896605183