mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-04 07:17:19 +07:00
Fixed artillery bullet not respecting range properly
This commit is contained in:
@ -27,7 +27,7 @@ allprojects {
|
||||
appName = 'Mindustry'
|
||||
gdxVersion = '1.9.8'
|
||||
roboVMVersion = '2.3.0'
|
||||
uCoreVersion = '39d511523f61b8464d7187a3bcd93ea17550712d'
|
||||
uCoreVersion = '99b7a3af00a1fa7e48a494515bf6b137774e114b'
|
||||
|
||||
getVersionString = {
|
||||
String buildVersion = getBuildVersion()
|
||||
|
@ -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();
|
||||
@ -95,10 +95,6 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
||||
create(type, null, Team.none, x, y, angle);
|
||||
}
|
||||
|
||||
public BulletType getBulletType(){
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean collidesTiles(){
|
||||
return type.collidesTiles;
|
||||
}
|
||||
@ -231,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();
|
||||
@ -241,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;
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user