Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken 2021-01-12 10:19:36 -05:00
commit e44c3899e8
3 changed files with 13 additions and 10 deletions

View File

@ -55,7 +55,7 @@ public class LaserTurret extends PowerTurret{
if(bulletLife > 0 && bullet != null){
wasShooting = true;
tr.trns(rotation, size * tilesize / 2f, 0f);
tr.trns(rotation, shootLength, 0f);
bullet.rotation(rotation);
bullet.set(x + tr.x, y + tr.y);
bullet.time(0f);

View File

@ -24,8 +24,9 @@ public class TractorBeamTurret extends BaseTurret{
public @Load("block-@size") TextureRegion baseRegion;
public @Load("@-laser") TextureRegion laser;
public @Load("@-laser-end") TextureRegion laserEnd;
public float shootCone = 6f;
public float shootLength = 5f;
public float laserWidth = 0.6f;
public float force = 0.3f;
public float scaledForce = 0f;
@ -141,12 +142,11 @@ public class TractorBeamTurret extends BaseTurret{
if(any){
Draw.z(Layer.bullet);
float ang = angleTo(lastX, lastY);
float len = 5f;
Draw.mixcol(laserColor, Mathf.absin(4f, 0.6f));
Drawf.laser(team, laser, laserEnd,
x + Angles.trnsx(ang, len), y + Angles.trnsy(ang, len),
x + Angles.trnsx(ang, shootLength), y + Angles.trnsy(ang, shootLength),
lastX, lastY, strength * efficiency() * laserWidth);
Draw.mixcol();

View File

@ -54,6 +54,7 @@ public class Turret extends ReloadTurret{
public float coolantUsage = 0.2f;
public float shootCone = 8f;
public float shootShake = 0f;
public float shootLength = -1;
public float xRand = 0f;
/** Currently used for artillery only. */
public float minRange = 0f;
@ -122,6 +123,8 @@ public class Turret extends ReloadTurret{
hasLiquids = true;
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, coolantUsage)).update(false).boost();
}
if(shootLength < 0) shootLength = size * tilesize / 2f;
super.init();
}
@ -371,14 +374,14 @@ public class Turret extends ReloadTurret{
if(chargeTime > 0){
useAmmo();
tr.trns(rotation, size * tilesize / 2f);
tr.trns(rotation, shootLength);
chargeBeginEffect.at(x + tr.x, y + tr.y, rotation);
chargeSound.at(x + tr.x, y + tr.y, 1);
for(int i = 0; i < chargeEffects; i++){
Time.run(Mathf.random(chargeMaxDelay), () -> {
if(!isValid()) return;
tr.trns(rotation, size * tilesize / 2f);
tr.trns(rotation, shootLength);
chargeEffect.at(x + tr.x, y + tr.y, rotation);
});
}
@ -387,7 +390,7 @@ public class Turret extends ReloadTurret{
Time.run(chargeTime, () -> {
if(!isValid()) return;
tr.trns(rotation, size * tilesize / 2f);
tr.trns(rotation, shootLength);
recoil = recoilAmount;
heat = 1f;
bullet(type, rotation + Mathf.range(inaccuracy));
@ -403,7 +406,7 @@ public class Turret extends ReloadTurret{
recoil = recoilAmount;
tr.trns(rotation, size * tilesize / 2f, Mathf.range(xRand));
tr.trns(rotation, shootLength, Mathf.range(xRand));
bullet(type, rotation + Mathf.range(inaccuracy));
effects();
useAmmo();
@ -418,10 +421,10 @@ public class Turret extends ReloadTurret{
if(alternate){
float i = (shotCounter % shots) - (shots-1)/2f;
tr.trns(rotation - 90, spread * i + Mathf.range(xRand), size * tilesize / 2f);
tr.trns(rotation - 90, spread * i + Mathf.range(xRand), shootLength);
bullet(type, rotation + Mathf.range(inaccuracy));
}else{
tr.trns(rotation, size * tilesize / 2f, Mathf.range(xRand));
tr.trns(rotation, shootLength, Mathf.range(xRand));
for(int i = 0; i < shots; i++){
bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy) + (i - (int)(shots / 2f)) * spread);