mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-10 15:19:24 +07:00
Improved turret accuracy
This commit is contained in:
parent
6d47b449b9
commit
0776951018
@ -27,7 +27,7 @@ allprojects {
|
||||
appName = 'Mindustry'
|
||||
gdxVersion = '1.9.8'
|
||||
roboVMVersion = '2.3.0'
|
||||
uCoreVersion = '74dc653bbd66d1e8b10e22efb4f1206195674dd5'
|
||||
uCoreVersion = 'cf9553e76e6226650b86921a73208e360049ba44'
|
||||
|
||||
getVersionString = {
|
||||
String buildVersion = getBuildVersion()
|
||||
|
@ -217,9 +217,10 @@ public class TurretBlocks extends BlockList implements ContentList{
|
||||
spectre = new DoubleTurret("spectre"){{
|
||||
ammoTypes = new AmmoType[]{AmmoTypes.bulletDenseBig, AmmoTypes.bulletPyratiteBig, AmmoTypes.bulletThoriumBig};
|
||||
reload = 4f;
|
||||
restitution = 0.03f;
|
||||
restitution = 0.1f;
|
||||
ammoUseEffect = ShootFx.shellEjectMedium;
|
||||
range = 200f;
|
||||
inaccuracy = 4f;
|
||||
recoil = 3f;
|
||||
xRand = 3f;
|
||||
shotWidth = 4f;
|
||||
|
@ -102,6 +102,11 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
player.onDeath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDrag(){
|
||||
return mech.drag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Timer getTimer(){
|
||||
return timer;
|
||||
@ -431,6 +436,8 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
|
||||
//region update methods
|
||||
|
||||
float lastx, lasty;
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
hitTime -= Timers.delta();
|
||||
|
@ -53,7 +53,9 @@ public class Predict{
|
||||
* See {@link #intercept(float, float, float, float, float, float, float)}.
|
||||
*/
|
||||
public static Vector2 intercept(TargetTrait src, TargetTrait dst, float v){
|
||||
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(), dst.getVelocity().x - src.getVelocity().x, dst.getVelocity().x - src.getVelocity().y, v);
|
||||
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(),
|
||||
dst.getTargetVelocityX() - src.getTargetVelocityX(),
|
||||
dst.getTargetVelocityY() - src.getTargetVelocityY(), v);
|
||||
}
|
||||
|
||||
private static Vector2 quad(float a, float b, float c){
|
||||
|
@ -207,13 +207,15 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
||||
|
||||
/**Updates velocity and status effects.*/
|
||||
public void updateVelocityStatus(float drag, float maxVelocity){
|
||||
Floor floor = getFloorOn();
|
||||
|
||||
|
||||
if(isCarried()){ //carried units do not take into account velocity normally
|
||||
set(carrier.getX(), carrier.getY());
|
||||
velocity.set(carrier.getVelocity());
|
||||
return;
|
||||
}
|
||||
|
||||
Floor floor = getFloorOn();
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
|
||||
status.update(this);
|
||||
|
@ -2,6 +2,7 @@ package io.anuke.mindustry.entities.traits;
|
||||
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.ucore.entities.trait.PosTrait;
|
||||
import io.anuke.ucore.entities.trait.SolidTrait;
|
||||
import io.anuke.ucore.entities.trait.VelocityTrait;
|
||||
|
||||
/**
|
||||
@ -13,6 +14,22 @@ public interface TargetTrait extends PosTrait, VelocityTrait{
|
||||
|
||||
Team getTeam();
|
||||
|
||||
default float getTargetVelocityX(){
|
||||
if(this instanceof SolidTrait){
|
||||
return getX() - ((SolidTrait) this).lastPosition().x;
|
||||
}else{
|
||||
return getVelocity().x;
|
||||
}
|
||||
}
|
||||
|
||||
default float getTargetVelocityY(){
|
||||
if(this instanceof SolidTrait){
|
||||
return getY() - ((SolidTrait) this).lastPosition().y;
|
||||
}else{
|
||||
return getVelocity().y;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this entity is a valid target.
|
||||
*/
|
||||
|
@ -82,6 +82,11 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
||||
threads.runDelay(unit::remove);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDrag(){
|
||||
return type.drag;
|
||||
}
|
||||
|
||||
/**Called when a command is recieved from the command center.*/
|
||||
public abstract void onCommand(UnitCommand command);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user