Smoother map preview
This commit is contained in:
@@ -16,6 +16,7 @@ import io.anuke.ucore.entities.impl.BulletEntity;
|
|||||||
import io.anuke.ucore.entities.trait.Entity;
|
import io.anuke.ucore.entities.trait.Entity;
|
||||||
import io.anuke.ucore.entities.trait.SolidTrait;
|
import io.anuke.ucore.entities.trait.SolidTrait;
|
||||||
import io.anuke.ucore.entities.trait.VelocityTrait;
|
import io.anuke.ucore.entities.trait.VelocityTrait;
|
||||||
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.ucore.util.Pooling;
|
import io.anuke.ucore.util.Pooling;
|
||||||
import io.anuke.ucore.util.Timer;
|
import io.anuke.ucore.util.Timer;
|
||||||
|
|
||||||
@@ -23,13 +24,12 @@ import java.io.DataInput;
|
|||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.bulletGroup;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
import static io.anuke.mindustry.Vars.content;
|
|
||||||
import static io.anuke.mindustry.Vars.world;
|
|
||||||
|
|
||||||
public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncTrait, AbsorbTrait{
|
public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncTrait, AbsorbTrait{
|
||||||
private static Vector2 vector = new Vector2();
|
private static Vector2 vector = new Vector2();
|
||||||
public Timer timer = new Timer(3);
|
public Timer timer = new Timer(3);
|
||||||
|
private float lifeScl;
|
||||||
private Team team;
|
private Team team;
|
||||||
private Object data;
|
private Object data;
|
||||||
private boolean supressCollision, supressOnce, initialized;
|
private boolean supressCollision, supressOnce, initialized;
|
||||||
@@ -68,7 +68,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
|||||||
|
|
||||||
bullet.team = team;
|
bullet.team = team;
|
||||||
bullet.type = type;
|
bullet.type = type;
|
||||||
bullet.time(type.lifetime() * (1f - lifetimeScl));
|
bullet.lifeScl = lifetimeScl;
|
||||||
|
|
||||||
//translate bullets backwards, purely for visual reasons
|
//translate bullets backwards, purely for visual reasons
|
||||||
float backDelta = Timers.delta();
|
float backDelta = Timers.delta();
|
||||||
@@ -227,6 +227,9 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateLife(){
|
protected void updateLife(){
|
||||||
|
time += Timers.delta() * 1f/(lifeScl);
|
||||||
|
time = Mathf.clamp(time, 0, type.lifetime());
|
||||||
|
|
||||||
if(time >= type.lifetime){
|
if(time >= type.lifetime){
|
||||||
if(!supressCollision) type.despawned(this);
|
if(!supressCollision) type.despawned(this);
|
||||||
remove();
|
remove();
|
||||||
@@ -237,6 +240,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
|||||||
public void reset(){
|
public void reset(){
|
||||||
super.reset();
|
super.reset();
|
||||||
timer.clear();
|
timer.clear();
|
||||||
|
lifeScl = 1f;
|
||||||
team = null;
|
team = null;
|
||||||
data = null;
|
data = null;
|
||||||
supressCollision = false;
|
supressCollision = false;
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ public class WorldGenerator{
|
|||||||
double ridge = rid.getValue(x, y, 1f / 400f);
|
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 iceridge = rid.getValue(x+99999, y, 1f / 300f) + sim3.octaveNoise2D(2, 1f, 1f/14f, x, y)/11f;
|
||||||
double elevation = elevationOf(x, y, detailed);
|
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);
|
+ sim3.octaveNoise2D(detailed ? 12 : 9, 0.6, 1f / 1100f, x, y);
|
||||||
|
|
||||||
int lerpDst = 20;
|
int lerpDst = 20;
|
||||||
@@ -321,7 +321,7 @@ public class WorldGenerator{
|
|||||||
|
|
||||||
double elevationOf(int x, int y, boolean detailed){
|
double elevationOf(int x, int y, boolean detailed){
|
||||||
double ridge = rid.getValue(x, y, 1f / 400f);
|
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{
|
public static class GenResult{
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class ArtilleryTurret extends ItemTurret{
|
|||||||
|
|
||||||
for(int i = 0; i < shots; i++){
|
for(int i = 0; i < shots; i++){
|
||||||
Bullet.create(ammo.bullet, tile.entity, tile.getTeam(), tile.drawx() + tr.x, tile.drawy() + tr.y,
|
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);
|
effects(tile);
|
||||||
|
|||||||
Reference in New Issue
Block a user