Smoother map preview

This commit is contained in:
Anuken 2018-09-16 22:28:42 -04:00
parent cc70ff9732
commit 4ba46bff69
3 changed files with 11 additions and 7 deletions

View File

@ -16,6 +16,7 @@ import io.anuke.ucore.entities.impl.BulletEntity;
import io.anuke.ucore.entities.trait.Entity;
import io.anuke.ucore.entities.trait.SolidTrait;
import io.anuke.ucore.entities.trait.VelocityTrait;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Pooling;
import io.anuke.ucore.util.Timer;
@ -23,13 +24,12 @@ import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import static io.anuke.mindustry.Vars.bulletGroup;
import static io.anuke.mindustry.Vars.content;
import static io.anuke.mindustry.Vars.world;
import static io.anuke.mindustry.Vars.*;
public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncTrait, AbsorbTrait{
private static Vector2 vector = new Vector2();
public Timer timer = new Timer(3);
private float lifeScl;
private Team team;
private Object data;
private boolean supressCollision, supressOnce, initialized;
@ -68,7 +68,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
bullet.team = team;
bullet.type = type;
bullet.time(type.lifetime() * (1f - lifetimeScl));
bullet.lifeScl = lifetimeScl;
//translate bullets backwards, purely for visual reasons
float backDelta = Timers.delta();
@ -227,6 +227,9 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
@Override
protected void updateLife(){
time += Timers.delta() * 1f/(lifeScl);
time = Mathf.clamp(time, 0, type.lifetime());
if(time >= type.lifetime){
if(!supressCollision) type.despawned(this);
remove();
@ -237,6 +240,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
public void reset(){
super.reset();
timer.clear();
lifeScl = 1f;
team = null;
data = null;
supressCollision = false;

View File

@ -255,7 +255,7 @@ public class WorldGenerator{
double ridge = rid.getValue(x, y, 1f / 400f);
double iceridge = rid.getValue(x+99999, y, 1f / 300f) + sim3.octaveNoise2D(2, 1f, 1f/14f, x, y)/11f;
double elevation = elevationOf(x, y, detailed);
double temp = vn.noise(x, y, 1f / 300f) * sim3.octaveNoise2D(detailed ? 2 : 1, 1, 1f / 13f, x, y)/13f
double temp =
+ sim3.octaveNoise2D(detailed ? 12 : 9, 0.6, 1f / 1100f, x, y);
int lerpDst = 20;
@ -321,7 +321,7 @@ public class WorldGenerator{
double elevationOf(int x, int y, boolean detailed){
double ridge = rid.getValue(x, y, 1f / 400f);
return sim.octaveNoise2D(detailed ? 7 : 4, 0.62, 1f / 800, x, y) * 6.1 - 1 - ridge;
return sim.octaveNoise2D(detailed ? 7 : 5, 0.62, 1f / 800, x, y) * 6.1 - 1 - ridge;
}
public static class GenResult{

View File

@ -38,7 +38,7 @@ public class ArtilleryTurret extends ItemTurret{
for(int i = 0; i < shots; i++){
Bullet.create(ammo.bullet, tile.entity, tile.getTeam(), tile.drawx() + tr.x, tile.drawy() + tr.y,
entity.rotation + Mathf.range(inaccuracy + type.inaccuracy), 1f + Mathf.range(velocityInaccuracy), Mathf.clamp(dst / maxTraveled));
entity.rotation + Mathf.range(inaccuracy + type.inaccuracy), 1f + Mathf.range(velocityInaccuracy), (dst / maxTraveled));
}
effects(tile);