Untested support for JSON planets

This commit is contained in:
Anuken
2022-02-06 12:47:23 -05:00
parent 5fd139261f
commit fce3cf818e
10 changed files with 112 additions and 15 deletions

View File

@@ -428,7 +428,7 @@ public class Damage{
float amount = calculateDamage(scaled ? Math.max(0, entity.dst(x, y) - entity.type.hitSize/2) : entity.dst(x, y), radius, damage);
entity.damage(amount);
//TODO better velocity displacement
float dst = tr.set(entity.getX() - x, entity.getY() - y).len();
float dst = tr.set(entity.x - x, entity.y - y).len();
entity.vel.add(tr.setLength((1f - dst / radius) * 2f / entity.mass()));
if(complete && damage >= 9999999f && entity.isPlayer()){

View File

@@ -57,20 +57,28 @@ public abstract class DrawPart{
return p -> value;
}
default float getClamp(PartParams p){
return Mathf.clamp(get(p));
}
default PartProgress inv(){
return p -> 1f - get(p);
}
default PartProgress clamp(){
return p -> Mathf.clamp(get(p));
}
default PartProgress add(float amount){
return p -> Mathf.clamp(get(p) + amount);
return p -> get(p) + amount;
}
default PartProgress delay(float amount){
return p -> Mathf.clamp((get(p) - amount) / (1f - amount));
return p -> (get(p) - amount) / (1f - amount);
}
default PartProgress shorten(float amount){
return p -> Mathf.clamp(get(p) / (1f - amount));
return p -> get(p) / (1f - amount);
}
default PartProgress blend(PartProgress other, float amount){
@@ -82,7 +90,7 @@ public abstract class DrawPart{
}
default PartProgress mul(float amount){
return p -> Mathf.clamp(get(p) * amount);
return p -> get(p) * amount;
}
default PartProgress min(PartProgress other){
@@ -90,11 +98,11 @@ public abstract class DrawPart{
}
default PartProgress sin(float scl, float mag){
return p -> Mathf.clamp(get(p) + Mathf.sin(scl, mag));
return p -> get(p) + Mathf.sin(scl, mag);
}
default PartProgress absin(float scl, float mag){
return p -> Mathf.clamp(get(p) + Mathf.absin(scl, mag));
return p -> get(p) + Mathf.absin(scl, mag);
}
default PartProgress apply(PartProgress other, PartFunc func){

View File

@@ -60,7 +60,7 @@ public class RegionPart extends DrawPart{
Draw.z(Draw.z() + layerOffset);
float prevZ = Draw.z();
float prog = progress.get(params);
float prog = progress.getClamp(params);
int len = mirror && params.sideOverride == -1 ? 2 : 1;
@@ -99,7 +99,7 @@ public class RegionPart extends DrawPart{
}
if(heat.found()){
Drawf.additive(heat, heatColor.write(Tmp.c1).a(heatProgress.get(params) * heatColor.a), rx, ry, rot, turretShading ? Layer.turretHeat : z + 1f);
Drawf.additive(heat, heatColor.write(Tmp.c1).a(heatProgress.getClamp(params) * heatColor.a), rx, ry, rot, turretShading ? Layer.turretHeat : z + 1f);
}
Draw.xscl = 1f;

View File

@@ -25,7 +25,7 @@ public class ShapePart extends DrawPart{
Draw.z(Draw.z() + layerOffset);
float prog = progress.get(params);
float prog = progress.getClamp(params);
int len = mirror && params.sideOverride == -1 ? 2 : 1;
for(int s = 0; s < len; s++){