Inlined Time.time
This commit is contained in:
@@ -392,7 +392,7 @@ public class Block extends UnlockableContent{
|
||||
|
||||
public void drawRequest(BuildPlan req, Eachable<BuildPlan> list, boolean valid){
|
||||
Draw.reset();
|
||||
Draw.mixcol(!valid ? Pal.breakInvalid : Color.white, (!valid ? 0.4f : 0.24f) + Mathf.absin(Time.globalTime(), 6f, 0.28f));
|
||||
Draw.mixcol(!valid ? Pal.breakInvalid : Color.white, (!valid ? 0.4f : 0.24f) + Mathf.absin(Time.globalTime, 6f, 0.28f));
|
||||
Draw.alpha(1f);
|
||||
float prevScale = Draw.scl;
|
||||
Draw.scl *= req.animScale;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class DirectionalItemBuffer{
|
||||
|
||||
public void accept(int buffer, Item item){
|
||||
if(!accepts(buffer)) return;
|
||||
buffers[buffer][indexes[buffer]++] = BufferItem.get((byte)item.id, Time.time());
|
||||
buffers[buffer][indexes[buffer]++] = BufferItem.get((byte)item.id, Time.time);
|
||||
}
|
||||
|
||||
public Item poll(int buffer, float speed){
|
||||
@@ -31,7 +31,7 @@ public class DirectionalItemBuffer{
|
||||
long l = buffers[buffer][0];
|
||||
float time = BufferItem.time(l);
|
||||
|
||||
if(Time.time() >= time + speed || Time.time() < time){
|
||||
if(Time.time >= time + speed || Time.time < time){
|
||||
return content.item(BufferItem.item(l));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ItemBuffer{
|
||||
|
||||
public void accept(Item item, short data){
|
||||
//if(!accepts()) return;
|
||||
buffer[index++] = Pack.longInt(Float.floatToIntBits(Time.time()), Pack.shortInt(item.id, data));
|
||||
buffer[index++] = Pack.longInt(Float.floatToIntBits(Time.time), Pack.shortInt(item.id, data));
|
||||
}
|
||||
|
||||
public void accept(Item item){
|
||||
@@ -32,7 +32,7 @@ public class ItemBuffer{
|
||||
long l = buffer[0];
|
||||
float time = Float.intBitsToFloat(Pack.leftInt(l));
|
||||
|
||||
if(Time.time() >= time + speed || Time.time() < time){
|
||||
if(Time.time >= time + speed || Time.time < time){
|
||||
return content.item(Pack.leftShort(Pack.rightInt(l)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class Accelerator extends Block{
|
||||
|
||||
for(int l = 0; l < 4; l++){
|
||||
float length = 7f + l * 5f;
|
||||
Draw.color(team.color, Pal.darkMetal, Mathf.absin(Time.time() + l*50f, 10f, 1f));
|
||||
Draw.color(team.color, Pal.darkMetal, Mathf.absin(Time.time + l*50f, 10f, 1f));
|
||||
|
||||
for(int i = 0; i < 4; i++){
|
||||
float rot = i*90f + 45f;
|
||||
@@ -67,13 +67,13 @@ public class Accelerator extends Block{
|
||||
Lines.square(x, y, rad * 1.22f, 45f);
|
||||
|
||||
Lines.stroke(3f, Pal.accent);
|
||||
Lines.square(x, y, rad, Time.time() / scl);
|
||||
Lines.square(x, y, rad, -Time.time() / scl);
|
||||
Lines.square(x, y, rad, Time.time / scl);
|
||||
Lines.square(x, y, rad, -Time.time / scl);
|
||||
|
||||
Draw.color(team.color);
|
||||
|
||||
for(int i = 0; i < 4; i++){
|
||||
float rot = i*90f + 45f + (-Time.time()/3f)%360f;
|
||||
float rot = i*90f + 45f + (-Time.time /3f)%360f;
|
||||
float length = 26f;
|
||||
Draw.rect(arrowRegion, x + Angles.trnsx(rot, length), y + Angles.trnsy(rot, length), rot + 180f);
|
||||
}
|
||||
|
||||
@@ -104,10 +104,10 @@ public class MendProjector extends Block{
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
float f = 1f - (Time.time() / 100f) % 1f;
|
||||
float f = 1f - (Time.time / 100f) % 1f;
|
||||
|
||||
Draw.color(baseColor, phaseColor, phaseHeat);
|
||||
Draw.alpha(heat * Mathf.absin(Time.time(), 10f, 1f) * 0.5f);
|
||||
Draw.alpha(heat * Mathf.absin(Time.time, 10f, 1f) * 0.5f);
|
||||
Draw.rect(topRegion, x, y);
|
||||
Draw.alpha(1f);
|
||||
Lines.stroke((2f * f + 0.2f) * heat);
|
||||
|
||||
@@ -114,10 +114,10 @@ public class OverdriveProjector extends Block{
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
float f = 1f - (Time.time() / 100f) % 1f;
|
||||
float f = 1f - (Time.time / 100f) % 1f;
|
||||
|
||||
Draw.color(baseColor, phaseColor, phaseHeat);
|
||||
Draw.alpha(heat * Mathf.absin(Time.time(), 10f, 1f) * 0.5f);
|
||||
Draw.alpha(heat * Mathf.absin(Time.time, 10f, 1f) * 0.5f);
|
||||
Draw.rect(topRegion, x, y);
|
||||
Draw.alpha(1f);
|
||||
Lines.stroke((2f * f + 0.1f) * heat);
|
||||
|
||||
@@ -114,7 +114,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
int frame = enabled && clogHeat <= 0.5f ? (int)(((Time.time() * speed * 8f * timeScale())) % 4) : 0;
|
||||
int frame = enabled && clogHeat <= 0.5f ? (int)(((Time.time * speed * 8f * timeScale())) % 4) : 0;
|
||||
|
||||
//draw extra conveyors facing this one for non-square tiling purposes
|
||||
Draw.z(Layer.blockUnder);
|
||||
|
||||
@@ -170,7 +170,7 @@ public class ItemBridge extends Block{
|
||||
Tmp.v2.trns(tile.angleTo(other), 2f);
|
||||
float tx = tile.drawx(), ty = tile.drawy();
|
||||
float ox = other.drawx(), oy = other.drawy();
|
||||
float alpha = Math.abs((linked ? 100 : 0)-(Time.time() * 2f) % 100f) / 100f;
|
||||
float alpha = Math.abs((linked ? 100 : 0)-(Time.time * 2f) % 100f) / 100f;
|
||||
float x = Mathf.lerp(ox, tx, alpha);
|
||||
float y = Mathf.lerp(oy, ty, alpha);
|
||||
|
||||
@@ -207,7 +207,7 @@ public class ItemBridge extends Block{
|
||||
boolean linked = other.pos() == link;
|
||||
|
||||
Drawf.select(other.drawx(), other.drawy(),
|
||||
other.block().size * tilesize / 2f + 2f + (linked ? 0f : Mathf.absin(Time.time(), 4f, 1f)), linked ? Pal.place : Pal.breakInvalid);
|
||||
other.block().size * tilesize / 2f + 2f + (linked ? 0f : Mathf.absin(Time.time, 4f, 1f)), linked ? Pal.place : Pal.breakInvalid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -298,7 +298,7 @@ public class ItemBridge extends Block{
|
||||
|
||||
int i = relativeTo(other.x, other.y);
|
||||
|
||||
Draw.color(Color.white, Color.black, Mathf.absin(Time.time(), 6f, 0.07f));
|
||||
Draw.color(Color.white, Color.black, Mathf.absin(Time.time, 6f, 0.07f));
|
||||
Draw.alpha(Math.max(uptime, 0.25f) * opacity);
|
||||
|
||||
Draw.rect(endRegion, x, y, i * 90 + 90);
|
||||
|
||||
@@ -44,7 +44,7 @@ public class Junction extends Block{
|
||||
long l = buffer.buffers[i][0];
|
||||
float time = BufferItem.time(l);
|
||||
|
||||
if(Time.time() >= time + speed / timeScale || Time.time() < time){
|
||||
if(Time.time >= time + speed / timeScale || Time.time < time){
|
||||
|
||||
Item item = content.item(BufferItem.item(l));
|
||||
Building dest = nearby(i);
|
||||
|
||||
@@ -65,7 +65,7 @@ public class MassDriver extends Block{
|
||||
if(selected == null || !(selected.block instanceof MassDriver) || !(selected.within(x * tilesize, y * tilesize, range))) return;
|
||||
|
||||
//if so, draw a dotted line towards it while it is in range
|
||||
float sin = Mathf.absin(Time.time(), 6f, 1f);
|
||||
float sin = Mathf.absin(Time.time, 6f, 1f);
|
||||
Tmp.v1.set(x * tilesize + offset, y * tilesize + offset).sub(selected.x, selected.y).limit((size / 2f + 1) * tilesize + sin + 0.5f);
|
||||
float x2 = x * tilesize - Tmp.v1.x, y2 = y * tilesize - Tmp.v1.y,
|
||||
x1 = selected.x + Tmp.v1.x, y1 = selected.y + Tmp.v1.y;
|
||||
@@ -202,7 +202,7 @@ public class MassDriver extends Block{
|
||||
|
||||
@Override
|
||||
public void drawConfigure(){
|
||||
float sin = Mathf.absin(Time.time(), 6f, 1f);
|
||||
float sin = Mathf.absin(Time.time, 6f, 1f);
|
||||
|
||||
Draw.color(Pal.accent);
|
||||
Lines.stroke(1f);
|
||||
|
||||
@@ -204,7 +204,7 @@ public class PayloadConveyor extends Block{
|
||||
}
|
||||
|
||||
public float time(){
|
||||
return Time.time();
|
||||
return Time.time;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,7 +22,7 @@ public class TreeBlock extends Block{
|
||||
public void drawBase(Tile tile){
|
||||
|
||||
float x = tile.worldx(), y = tile.worldy();
|
||||
float rot = Mathf.randomSeed(tile.pos(), 0, 4) * 90 + Mathf.sin(Time.time() + x, 50f, 0.5f) + Mathf.sin(Time.time() - y, 65f, 0.9f) + Mathf.sin(Time.time() + y - x, 85f, 0.9f);
|
||||
float rot = Mathf.randomSeed(tile.pos(), 0, 4) * 90 + Mathf.sin(Time.time + x, 50f, 0.5f) + Mathf.sin(Time.time - y, 65f, 0.9f) + Mathf.sin(Time.time + y - x, 85f, 0.9f);
|
||||
float w = region.width * Draw.scl, h = region.height * Draw.scl;
|
||||
float scl = 30f, mag = 0.2f;
|
||||
|
||||
@@ -34,8 +34,8 @@ public class TreeBlock extends Block{
|
||||
Draw.z(Layer.power + 1);
|
||||
Draw.rectv(region, x, y, w, h, rot, vec -> {
|
||||
vec.add(
|
||||
Mathf.sin(vec.y*3 + Time.time(), scl, mag) + Mathf.sin(vec.x*3 - Time.time(), 70, 0.8f),
|
||||
Mathf.cos(vec.x*3 + Time.time() + 8, scl + 6f, mag * 1.1f) + Mathf.sin(vec.y*3 - Time.time(), 50, 0.2f)
|
||||
Mathf.sin(vec.y*3 + Time.time, scl, mag) + Mathf.sin(vec.x*3 - Time.time, 70, 0.8f),
|
||||
Mathf.cos(vec.x*3 + Time.time + 8, scl + 6f, mag * 1.1f) + Mathf.sin(vec.y*3 - Time.time, 50, 0.2f)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -101,12 +101,12 @@ public class ImpactReactor extends PowerGenerator{
|
||||
Draw.rect(bottomRegion, x, y);
|
||||
|
||||
for(int i = 0; i < plasmaRegions.length; i++){
|
||||
float r = size * tilesize - 3f + Mathf.absin(Time.time(), 2f + i * 1f, 5f - i * 0.5f);
|
||||
float r = size * tilesize - 3f + Mathf.absin(Time.time, 2f + i * 1f, 5f - i * 0.5f);
|
||||
|
||||
Draw.color(plasma1, plasma2, (float)i / plasmaRegions.length);
|
||||
Draw.alpha((0.3f + Mathf.absin(Time.time(), 2f + i * 2f, 0.3f + i * 0.05f)) * warmup);
|
||||
Draw.alpha((0.3f + Mathf.absin(Time.time, 2f + i * 2f, 0.3f + i * 0.05f)) * warmup);
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.rect(plasmaRegions[i], x, y, r, r, Time.time() * (12 + i * 6f) * warmup);
|
||||
Draw.rect(plasmaRegions[i], x, y, r, r, Time.time * (12 + i * 6f) * warmup);
|
||||
Draw.blend();
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
||||
|
||||
if(hasItems){
|
||||
Draw.color(heatColor);
|
||||
Draw.alpha(heat * 0.4f + Mathf.absin(Time.time(), 8f, 0.6f) * heat);
|
||||
Draw.alpha(heat * 0.4f + Mathf.absin(Time.time, 8f, 0.6f) * heat);
|
||||
Draw.rect(topRegion, x, y);
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@@ -362,7 +362,7 @@ public class PowerNode extends PowerBlock{
|
||||
@Override
|
||||
public void drawConfigure(){
|
||||
|
||||
Drawf.circles(x, y, tile.block().size * tilesize / 2f + 1f + Mathf.absin(Time.time(), 4f, 1f));
|
||||
Drawf.circles(x, y, tile.block().size * tilesize / 2f + 1f + Mathf.absin(Time.time, 4f, 1f));
|
||||
Drawf.circles(x, y, laserRange * tilesize);
|
||||
|
||||
for(int x = (int)(tile.x - laserRange - 2); x <= tile.x + laserRange + 2; x++){
|
||||
|
||||
@@ -78,7 +78,7 @@ public class Cultivator extends GenericCrafter{
|
||||
for(int i = 0; i < 12; i++){
|
||||
float offset = random.nextFloat() * 999999f;
|
||||
float x = random.range(4f), y = random.range(4f);
|
||||
float life = 1f - (((Time.time() + offset) / 50f) % recurrence);
|
||||
float life = 1f - (((Time.time + offset) / 50f) % recurrence);
|
||||
|
||||
if(life > 0){
|
||||
Lines.stroke(warmup * (life * 1f + 0.2f));
|
||||
|
||||
@@ -291,7 +291,7 @@ public class Drill extends Block{
|
||||
|
||||
if(drawRim){
|
||||
Draw.color(heatColor);
|
||||
Draw.alpha(warmup * ts * (1f - s + Mathf.absin(Time.time(), 3f, s)));
|
||||
Draw.alpha(warmup * ts * (1f - s + Mathf.absin(Time.time, 3f, s)));
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.rect(rimRegion, x, y);
|
||||
Draw.blend();
|
||||
|
||||
@@ -30,13 +30,13 @@ public class GenericSmelter extends GenericCrafter{
|
||||
float r = 0.06f;
|
||||
float cr = Mathf.random(0.1f);
|
||||
|
||||
Draw.alpha(((1f - g) + Mathf.absin(Time.time(), 8f, g) + Mathf.random(r) - r) * warmup);
|
||||
Draw.alpha(((1f - g) + Mathf.absin(Time.time, 8f, g) + Mathf.random(r) - r) * warmup);
|
||||
|
||||
Draw.tint(flameColor);
|
||||
Fill.circle(x, y, 3f + Mathf.absin(Time.time(), 5f, 2f) + cr);
|
||||
Fill.circle(x, y, 3f + Mathf.absin(Time.time, 5f, 2f) + cr);
|
||||
Draw.color(1f, 1f, 1f, warmup);
|
||||
Draw.rect(topRegion, x, y);
|
||||
Fill.circle(x, y, 1.9f + Mathf.absin(Time.time(), 5f, 1f) + cr);
|
||||
Fill.circle(x, y, 1.9f + Mathf.absin(Time.time, 5f, 1f) + cr);
|
||||
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class Incinerator extends Block{
|
||||
float g = 0.3f;
|
||||
float r = 0.06f;
|
||||
|
||||
Draw.alpha(((1f - g) + Mathf.absin(Time.time(), 8f, g) + Mathf.random(r) - r) * heat);
|
||||
Draw.alpha(((1f - g) + Mathf.absin(Time.time, 8f, g) + Mathf.random(r) - r) * heat);
|
||||
|
||||
Draw.tint(flameColor);
|
||||
Fill.circle(x, y, 2f);
|
||||
|
||||
Reference in New Issue
Block a user