Mass driver reloadTime -> reload
This commit is contained in:
@@ -1910,7 +1910,7 @@ public class Blocks{
|
||||
requirements(Category.distribution, with(Items.titanium, 125, Items.silicon, 75, Items.lead, 125, Items.thorium, 50));
|
||||
size = 3;
|
||||
itemCapacity = 120;
|
||||
reloadTime = 200f;
|
||||
reload = 200f;
|
||||
range = 440f;
|
||||
consumePower(1.75f);
|
||||
}};
|
||||
@@ -4399,7 +4399,7 @@ public class Blocks{
|
||||
requirements(Category.units, with(Items.tungsten, 120, Items.silicon, 120, Items.oxide, 25));
|
||||
regionSuffix = "-dark";
|
||||
size = 3;
|
||||
reloadTime = 130f;
|
||||
reload = 130f;
|
||||
chargeTime = 90f;
|
||||
range = 700f;
|
||||
maxPayloadSize = 2.5f;
|
||||
@@ -4411,7 +4411,7 @@ public class Blocks{
|
||||
requirements(Category.units, with(Items.thorium, 300, Items.silicon, 200, Items.plastanium, 200, Items.phaseFabric, 50));
|
||||
regionSuffix = "-dark";
|
||||
size = 5;
|
||||
reloadTime = 130f;
|
||||
reload = 130f;
|
||||
chargeTime = 100f;
|
||||
range = 1100f;
|
||||
maxPayloadSize = 3.5f;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class MassDriver extends Block{
|
||||
public float translation = 7f;
|
||||
public int minDistribute = 10;
|
||||
public float knockback = 4f;
|
||||
public float reloadTime = 100f;
|
||||
public float reload = 100f;
|
||||
public MassDriverBolt bullet = new MassDriverBolt();
|
||||
public float bulletSpeed = 5.5f;
|
||||
public float bulletLifetime = 200f;
|
||||
@@ -60,7 +60,7 @@ public class MassDriver extends Block{
|
||||
super.setStats();
|
||||
|
||||
stats.add(Stat.shootRange, range / tilesize, StatUnit.blocks);
|
||||
stats.add(Stat.reload, 60f / reloadTime, StatUnit.perSecond);
|
||||
stats.add(Stat.reload, 60f / reload, StatUnit.perSecond);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,7 +107,7 @@ public class MassDriver extends Block{
|
||||
public class MassDriverBuild extends Building{
|
||||
public int link = -1;
|
||||
public float rotation = 90;
|
||||
public float reload = 0f;
|
||||
public float reloadCounter = 0f;
|
||||
public DriverState state = DriverState.idle;
|
||||
//TODO use queue? this array usually holds about 3 shooters max anyway
|
||||
public OrderedSet<Building> waitingShooters = new OrderedSet<>();
|
||||
@@ -126,8 +126,8 @@ public class MassDriver extends Block{
|
||||
}
|
||||
|
||||
//reload regardless of state
|
||||
if(reload > 0f){
|
||||
reload = Mathf.clamp(reload - edelta() / reloadTime);
|
||||
if(reloadCounter > 0f){
|
||||
reloadCounter = Mathf.clamp(reloadCounter - edelta() / reload);
|
||||
}
|
||||
|
||||
var current = currentShooter();
|
||||
@@ -182,7 +182,7 @@ public class MassDriver extends Block{
|
||||
MassDriverBuild other = (MassDriverBuild)link;
|
||||
other.waitingShooters.add(this);
|
||||
|
||||
if(reload <= 0.0001f){
|
||||
if(reloadCounter <= 0.0001f){
|
||||
|
||||
//align to target location
|
||||
rotation = Angles.moveToward(rotation, targetRotation, rotateSpeed * efficiency);
|
||||
@@ -209,7 +209,7 @@ public class MassDriver extends Block{
|
||||
|
||||
@Override
|
||||
public double sense(LAccess sensor){
|
||||
if(sensor == LAccess.progress) return Mathf.clamp(1f - reload / reloadTime);
|
||||
if(sensor == LAccess.progress) return Mathf.clamp(1f - reloadCounter / reload);
|
||||
return super.sense(sensor);
|
||||
}
|
||||
|
||||
@@ -220,11 +220,11 @@ public class MassDriver extends Block{
|
||||
Draw.z(Layer.turret);
|
||||
|
||||
Drawf.shadow(region,
|
||||
x + Angles.trnsx(rotation + 180f, reload * knockback) - (size / 2),
|
||||
y + Angles.trnsy(rotation + 180f, reload * knockback) - (size / 2), rotation - 90);
|
||||
x + Angles.trnsx(rotation + 180f, reloadCounter * knockback) - (size / 2),
|
||||
y + Angles.trnsy(rotation + 180f, reloadCounter * knockback) - (size / 2), rotation - 90);
|
||||
Draw.rect(region,
|
||||
x + Angles.trnsx(rotation + 180f, reload * knockback),
|
||||
y + Angles.trnsy(rotation + 180f, reload * knockback), rotation - 90);
|
||||
x + Angles.trnsx(rotation + 180f, reloadCounter * knockback),
|
||||
y + Angles.trnsy(rotation + 180f, reloadCounter * knockback), rotation - 90);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -276,7 +276,7 @@ public class MassDriver extends Block{
|
||||
|
||||
protected void fire(MassDriverBuild target){
|
||||
//reset reload, use power.
|
||||
reload = 1f;
|
||||
reloadCounter = 1f;
|
||||
|
||||
DriverBulletData data = Pools.obtain(DriverBulletData.class, DriverBulletData::new);
|
||||
data.from = this;
|
||||
@@ -321,7 +321,7 @@ public class MassDriver extends Block{
|
||||
Effect.shake(shake, shake, this);
|
||||
receiveEffect.at(bullet);
|
||||
|
||||
reload = 1f;
|
||||
reloadCounter = 1f;
|
||||
bullet.remove();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
public float rotateSpeed = 2f;
|
||||
public float length = 89 / 8f;
|
||||
public float knockback = 5f;
|
||||
public float reloadTime = 30f;
|
||||
public float reload = 30f;
|
||||
public float chargeTime = 100f;
|
||||
public float maxPayloadSize = 3;
|
||||
public float grabWidth = 8f, grabHeight = 11/4f;
|
||||
@@ -79,7 +79,7 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
super.setStats();
|
||||
|
||||
stats.add(Stat.payloadCapacity, StatValues.squared(maxPayloadSize, StatUnit.blocksSquared));
|
||||
stats.add(Stat.reload, 60f / (chargeTime + reloadTime), StatUnit.seconds);
|
||||
stats.add(Stat.reload, 60f / (chargeTime + reload), StatUnit.seconds);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,7 +128,7 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
public class PayloadDriverBuild extends PayloadBlockBuild<Payload>{
|
||||
public int link = -1;
|
||||
public float turretRotation = 90;
|
||||
public float reload = 0f, charge = 0f;
|
||||
public float reloadCounter = 0f, charge = 0f;
|
||||
public float targetSize = grabWidth*2f, curSize = targetSize;
|
||||
public float payLength = 0f, effectDelayTimer = -1f;
|
||||
public PayloadDriverBuild lastOther;
|
||||
@@ -167,7 +167,7 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
var other = lastOther;
|
||||
float cx = Angles.trnsx(other.turretRotation, length), cy = Angles.trnsy(other.turretRotation, length);
|
||||
receiveEffect.at(x - cx/2f, y - cy/2f, turretRotation);
|
||||
reload = 1f;
|
||||
reloadCounter = 1f;
|
||||
Effect.shake(shake, shake, this);
|
||||
}
|
||||
|
||||
@@ -178,8 +178,8 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
}
|
||||
|
||||
//reload regardless of state
|
||||
reload -= edelta() / reloadTime;
|
||||
if(reload < 0) reload = 0f;
|
||||
reloadCounter -= edelta() / reload;
|
||||
if(reloadCounter < 0) reloadCounter = 0f;
|
||||
|
||||
var current = currentShooter();
|
||||
|
||||
@@ -248,7 +248,7 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
|
||||
payRotation = Angles.moveToward(payRotation, turretRotation, payloadRotateSpeed * delta());
|
||||
if(loaded){
|
||||
float loadLength = length - reload*knockback;
|
||||
float loadLength = length - reloadCounter *knockback;
|
||||
payLength += payloadSpeed * delta();
|
||||
if(payLength >= loadLength){
|
||||
payLength = loadLength;
|
||||
@@ -267,14 +267,14 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
other.waitingShooters.addLast(this);
|
||||
}
|
||||
|
||||
if(reload <= 0){
|
||||
if(reloadCounter <= 0){
|
||||
//align to target location
|
||||
turretRotation = Angles.moveToward(turretRotation, targetRotation, rotateSpeed * efficiency);
|
||||
|
||||
//fire when it's the first in the queue and angles are ready.
|
||||
if(other.currentShooter() == this &&
|
||||
other.state == accepting &&
|
||||
other.reload <= 0f &&
|
||||
other.reloadCounter <= 0f &&
|
||||
Angles.within(turretRotation, targetRotation, 1f) && Angles.within(other.turretRotation, targetRotation + 180f, 1f)){
|
||||
charge += edelta();
|
||||
charging = true;
|
||||
@@ -313,7 +313,7 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
payLength = 0f;
|
||||
loaded = false;
|
||||
state = idle;
|
||||
reload = 1f;
|
||||
reloadCounter = 1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,7 +323,7 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
|
||||
@Override
|
||||
public double sense(LAccess sensor){
|
||||
if(sensor == LAccess.progress) return Mathf.clamp(1f - reload / reloadTime);
|
||||
if(sensor == LAccess.progress) return Mathf.clamp(1f - reloadCounter / reload);
|
||||
return super.sense(sensor);
|
||||
}
|
||||
|
||||
@@ -341,8 +341,8 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
@Override
|
||||
public void draw(){
|
||||
float
|
||||
tx = x + Angles.trnsx(turretRotation + 180f, reload * knockback),
|
||||
ty = y + Angles.trnsy(turretRotation + 180f, reload * knockback), r = turretRotation - 90;
|
||||
tx = x + Angles.trnsx(turretRotation + 180f, reloadCounter * knockback),
|
||||
ty = y + Angles.trnsy(turretRotation + 180f, reloadCounter * knockback), r = turretRotation - 90;
|
||||
|
||||
Draw.rect(baseRegion, x, y);
|
||||
|
||||
@@ -476,7 +476,7 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
write.f(turretRotation);
|
||||
write.b((byte)state.ordinal());
|
||||
|
||||
write.f(reload);
|
||||
write.f(reloadCounter);
|
||||
write.f(charge);
|
||||
write.bool(loaded);
|
||||
write.bool(charging);
|
||||
@@ -490,7 +490,7 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
state = PayloadDriverState.all[read.b()];
|
||||
|
||||
if(revision >= 1){
|
||||
reload = read.f();
|
||||
reloadCounter = read.f();
|
||||
charge = read.f();
|
||||
loaded = read.bool();
|
||||
charging = read.bool();
|
||||
|
||||
Reference in New Issue
Block a user