mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-12-22 22:54:16 +07:00
Allow JSON Mods To Disable Progress Clamping (#10114)
* par * 1. im dumb 2. im stupid
This commit is contained in:
parent
78cc5bef36
commit
d96667679e
@ -96,9 +96,13 @@ public abstract class DrawPart{
|
||||
}
|
||||
|
||||
default float getClamp(PartParams p){
|
||||
return Mathf.clamp(get(p));
|
||||
return getClamp(p, true);
|
||||
}
|
||||
|
||||
|
||||
default float getClamp(PartParams p, boolean clamp){
|
||||
return clamp ? Mathf.clamp(get(p)) : get(p);
|
||||
}
|
||||
|
||||
default PartProgress inv(){
|
||||
return p -> 1f - get(p);
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ public class FlarePart extends DrawPart{
|
||||
public float x, y, rotation, rotMove, spinSpeed;
|
||||
public boolean followRotation;
|
||||
public Color color1 = Pal.techBlue, color2 = Color.white;
|
||||
public boolean clampProgress = true;
|
||||
public PartProgress progress = PartProgress.warmup;
|
||||
public float layer = Layer.effect;
|
||||
|
||||
@ -20,7 +21,7 @@ public class FlarePart extends DrawPart{
|
||||
float z = Draw.z();
|
||||
if(layer > 0) Draw.z(layer);
|
||||
|
||||
float prog = progress.getClamp(params);
|
||||
float prog = progress.getClamp(params, clampProgress);
|
||||
int i = params.sideOverride == -1 ? 0 : params.sideOverride;
|
||||
|
||||
float sign = (i == 0 ? 1 : -1) * params.sideMultiplier;
|
||||
|
@ -20,6 +20,7 @@ public class HaloPart extends DrawPart{
|
||||
public Color color = Color.white;
|
||||
public @Nullable Color colorTo;
|
||||
public boolean mirror = false;
|
||||
public boolean clampProgress = true;
|
||||
public PartProgress progress = PartProgress.warmup;
|
||||
public float layer = -1f, layerOffset = 0f;
|
||||
|
||||
@ -32,7 +33,7 @@ public class HaloPart extends DrawPart{
|
||||
Draw.z(Draw.z() + layerOffset);
|
||||
|
||||
float
|
||||
prog = progress.getClamp(params),
|
||||
prog = progress.getClamp(params, clampProgress),
|
||||
baseRot = Time.time * rotateSpeed,
|
||||
rad = radiusTo < 0 ? radius : Mathf.lerp(radius, radiusTo, prog),
|
||||
triLen = triLengthTo < 0 ? triLength : Mathf.lerp(triLength, triLengthTo, prog),
|
||||
|
@ -27,6 +27,8 @@ public class RegionPart extends DrawPart{
|
||||
public boolean drawRegion = true;
|
||||
/** If true, the heat region produces light. */
|
||||
public boolean heatLight = false;
|
||||
/** Whether to clamp progress to (0-1). If false, allows usage of interps that go past the range, but may have unwanted visual bugs depending on values. */
|
||||
public boolean clampProgress = true;
|
||||
/** Progress function for determining position/rotation. */
|
||||
public PartProgress progress = PartProgress.warmup;
|
||||
/** Progress function for scaling. */
|
||||
@ -67,14 +69,14 @@ public class RegionPart extends DrawPart{
|
||||
Draw.z(Draw.z() + layerOffset);
|
||||
|
||||
float prevZ = Draw.z();
|
||||
float prog = progress.getClamp(params), sclProg = growProgress.getClamp(params);
|
||||
float prog = progress.getClamp(params, clampProgress), sclProg = growProgress.getClamp(params, clampProgress);
|
||||
float mx = moveX * prog, my = moveY * prog, mr = moveRot * prog + rotation,
|
||||
gx = growX * sclProg, gy = growY * sclProg;
|
||||
|
||||
if(moves.size > 0){
|
||||
for(int i = 0; i < moves.size; i++){
|
||||
var move = moves.get(i);
|
||||
float p = move.progress.getClamp(params);
|
||||
float p = move.progress.getClamp(params, clampProgress);
|
||||
mx += move.x * p;
|
||||
my += move.y * p;
|
||||
mr += move.rot * p;
|
||||
@ -130,7 +132,7 @@ public class RegionPart extends DrawPart{
|
||||
}
|
||||
|
||||
if(heat.found()){
|
||||
float hprog = heatProgress.getClamp(params);
|
||||
float hprog = heatProgress.getClamp(params, clampProgress);
|
||||
heatColor.write(Tmp.c1).a(hprog * heatColor.a);
|
||||
Drawf.additive(heat, Tmp.c1, rx, ry, rot, turretShading ? turretHeatLayer : Draw.z() + heatLayerOffset);
|
||||
if(heatLight) Drawf.light(rx, ry, light.found() ? light : heat, rot, Tmp.c1, heatLightOpacity * hprog);
|
||||
|
@ -15,6 +15,7 @@ public class ShapePart extends DrawPart{
|
||||
public Color color = Color.white;
|
||||
public @Nullable Color colorTo;
|
||||
public boolean mirror = false;
|
||||
public boolean clampProgress = true;
|
||||
public PartProgress progress = PartProgress.warmup;
|
||||
public float layer = -1f, layerOffset = 0f;
|
||||
|
||||
@ -26,7 +27,7 @@ public class ShapePart extends DrawPart{
|
||||
|
||||
Draw.z(Draw.z() + layerOffset);
|
||||
|
||||
float prog = progress.getClamp(params),
|
||||
float prog = progress.getClamp(params, clampProgress),
|
||||
baseRot = Time.time * rotateSpeed,
|
||||
rad = radiusTo < 0 ? radius : Mathf.lerp(radius, radiusTo, prog),
|
||||
str = strokeTo < 0 ? stroke : Mathf.lerp(stroke, strokeTo, prog);
|
||||
|
Loading…
Reference in New Issue
Block a user