Gradual component conversion

This commit is contained in:
Anuken
2020-02-02 20:17:22 -05:00
70 changed files with 1061 additions and 1217 deletions

View File

@@ -78,24 +78,10 @@ public class MendProjector extends Block{
float realRange = range + entity.phaseHeat * phaseRangeBoost;
entity.charge = 0f;
int tileRange = (int)(realRange / tilesize + 1);
healed.clear();
for(int x = -tileRange + tile.x; x <= tileRange + tile.x; x++){
for(int y = -tileRange + tile.y; y <= tileRange + tile.y; y++){
if(!Mathf.within(x * tilesize, y * tilesize, tile.drawx(), tile.drawy(), realRange)) continue;
Tile other = world.ltile(x, y);
if(other == null) continue;
if(other.getTeamID() == tile.getTeamID() && !healed.contains(other.pos()) && other.entity != null && other.entity.health < other.entity.maxHealth()){
other.entity.healBy(other.entity.maxHealth() * (healPercent + entity.phaseHeat * phaseBoost) / 100f * entity.efficiency());
Effects.effect(Fx.healBlockFull, Tmp.c1.set(baseColor).lerp(phaseColor, entity.phaseHeat), other.drawx(), other.drawy(), other.block().size);
healed.add(other.pos());
}
}
}
indexer.eachBlock(entity, realRange, other -> other.entity.damaged(), other -> {
other.entity.healBy(other.entity.maxHealth() * (healPercent + entity.phaseHeat * phaseBoost) / 100f * entity.efficiency());
Effects.effect(Fx.healBlockFull, Tmp.c1.set(baseColor).lerp(phaseColor, entity.phaseHeat), other.drawx(), other.drawy(), other.block().size);
});
}
}
@@ -121,9 +107,7 @@ public class MendProjector extends Block{
Draw.color(baseColor, phaseColor, entity.phaseHeat);
Draw.alpha(entity.heat * Mathf.absin(Time.time(), 10f, 1f) * 0.5f);
//Draw.blend(Blending.additive);
Draw.rect(topRegion, tile.drawx(), tile.drawy());
//Draw.blend();
Draw.alpha(1f);
Lines.stroke((2f * f + 0.2f) * entity.heat);

View File

@@ -89,27 +89,7 @@ public class OverdriveProjector extends Block{
float realBoost = (speedBoost + entity.phaseHeat * speedBoostPhase) * entity.efficiency();
entity.charge = 0f;
int tileRange = (int)(realRange / tilesize + 1);
healed.clear();
for(int x = -tileRange + tile.x; x <= tileRange + tile.x; x++){
for(int y = -tileRange + tile.y; y <= tileRange + tile.y; y++){
if(!Mathf.within(x * tilesize, y * tilesize, tile.drawx(), tile.drawy(), realRange)) continue;
Tile other = world.ltile(x, y);
if(other == null) continue;
if(other.getTeamID() == tile.getTeamID() && !healed.contains(other.pos()) && other.entity != null){
if(other.entity.timeScale <= realBoost){
other.entity.timeScaleDuration = Math.max(other.entity.timeScaleDuration, reload + 1f);
other.entity.timeScale = Math.max(other.entity.timeScale, realBoost);
}
healed.add(other.pos());
}
}
}
indexer.eachBlock(entity, realRange, other -> other.entity.timeScale <= realBoost, other -> other.entity.applyBoost(realBoost, reload + 1f));
}
}

View File

@@ -17,7 +17,6 @@ import mindustry.entities.*;
import mindustry.entities.Effects.Effect;
import mindustry.entities.type.Bullet;
import mindustry.entities.bullet.BulletType;
import mindustry.entities.traits.TargetTrait;
import mindustry.entities.type.TileEntity;
import mindustry.gen.*;
import mindustry.graphics.*;
@@ -25,6 +24,8 @@ import mindustry.world.Block;
import mindustry.world.Tile;
import mindustry.world.meta.*;
import java.io.*;
import static mindustry.Vars.tilesize;
public abstract class Turret extends Block{
@@ -320,5 +321,26 @@ public abstract class Turret extends Block{
public float heat;
public int shots;
public TargetTrait target;
@Override
public void write(DataOutput stream) throws IOException{
super.write(stream);
stream.writeFloat(reload);
stream.writeFloat(rotation);
}
@Override
public void read(DataInput stream, byte revision) throws IOException{
super.read(stream, revision);
if(revision == 1){
reload = stream.readFloat();
rotation = stream.readFloat();
}
}
@Override
public byte version(){
return 1;
}
}
}