Fixed fusion reactor power transfer / Start of turret overhaul

This commit is contained in:
Anuken 2018-04-01 11:13:27 -04:00
parent 198dff7864
commit 5ee369f26a
7 changed files with 17 additions and 16 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 416 B

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 678 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

View File

@ -1,7 +1,7 @@
#Autogenerated file. Do not modify.
#Sat Mar 31 22:48:10 EDT 2018
#Sun Apr 01 10:41:23 EDT 2018
version=release
androidBuildCode=805
androidBuildCode=807
name=Mindustry
code=3.4
build=custom build

View File

@ -26,6 +26,7 @@ public class WeaponBlocks{
bullet = BulletType.stone;
ammo = Items.stone;
health = 45;
shots = 2;
}
@Override

View File

@ -34,6 +34,7 @@ public class Turret extends Block{
protected float reload = 10f;
protected float inaccuracy = 0f;
protected int shots = 1;
protected float shotTransation = 2;
protected float shotDelayScale = 0;
protected String shootsound = "shoot";
protected BulletType bullet = BulletType.iron;
@ -42,7 +43,7 @@ public class Turret extends Block{
protected int maxammo = 400;
protected float rotatespeed = 0.2f;
protected float shootCone = 5f;
protected Effect shootEffect = null;
protected Effect shootEffect = Fx.none;
protected float shootShake = 0f;
protected int soundReload = 0;
protected Translator tr = new Translator();
@ -168,11 +169,6 @@ public class Turret extends Block{
entity.ammo --;
}
@Override
public TileEntity getEntity(){
return new TurretEntity();
}
void drawTargeting(Tile tile){
TurretEntity entity = tile.entity();
@ -201,9 +197,7 @@ public class Turret extends Block{
Draw.reset();
if(Timers.getTime(tile, "reload") <= 0){
Timers.run(hittime, ()->{
Effects.effect(Fx.spawn, predictX, predictY);
});
Timers.run(hittime, () -> Effects.effect(Fx.spawn, predictX, predictY));
}
}
@ -214,6 +208,7 @@ public class Turret extends Block{
for(int i = 0; i < shots; i ++){
if(Mathf.zero(shotDelayScale)){
bullet(tile, entity.rotation + Mathf.range(inaccuracy));
}else{
Timers.run(i * shotDelayScale, () -> {
@ -223,11 +218,9 @@ public class Turret extends Block{
}
}
if(shootEffect != null){
Effects.effect(shootEffect, tile.drawx() + tr.x,
tile.drawy() + tr.y, entity.rotation);
}
Effects.effect(shootEffect, tile.drawx() + tr.x,
tile.drawy() + tr.y, entity.rotation);
if(shootShake > 0){
Effects.shake(shootShake, shootShake, tile.entity);
@ -237,6 +230,11 @@ public class Turret extends Block{
protected void bullet(Tile tile, float angle){
new Bullet(bullet, tile.entity, tile.getTeam(), tile.drawx() + tr.x, tile.drawy() + tr.y, angle).add();
}
@Override
public TileEntity getEntity(){
return new TurretEntity();
}
public static class TurretEntity extends TileEntity{
public TileEntity blockTarget;

View File

@ -47,6 +47,8 @@ public class FusionReactor extends PowerGenerator {
float powerAdded = Math.min(powerCapacity - entity.power.amount, maxPowerProduced * Mathf.pow(entity.warmup, 3f) * Timers.delta());
entity.power.amount += powerAdded;
entity.totalProgress += entity.warmup * Timers.delta();
distributePower(tile);
}
@Override