This commit is contained in:
Anuken
2020-06-26 14:27:26 -04:00
parent eabc5c15c7
commit fdf7c88083
228 changed files with 1219 additions and 1163 deletions

View File

@@ -33,7 +33,7 @@ public class BlockRenderer implements Disposable{
private float brokenFade = 0f;
private FrameBuffer shadows = new FrameBuffer();
private FrameBuffer dark = new FrameBuffer();
private Seq<Tilec> outArray2 = new Seq<>();
private Seq<Building> outArray2 = new Seq<>();
private Seq<Tile> shadowEvents = new Seq<>();
private IntSet processedEntities = new IntSet();
private boolean displayStatus = false;
@@ -82,7 +82,7 @@ public class BlockRenderer implements Disposable{
dark.end();
});
Events.on(TileChangeEvent.class, event -> {
Events.on(BuildinghangeEvent.class, event -> {
shadowEvents.add(event.tile);
int avgx = (int)(camera.position.x / tilesize);
@@ -205,8 +205,8 @@ public class BlockRenderer implements Disposable{
lightview.add(tile);
}
if(tile.entity != null && tile.entity.power() != null && tile.entity.power().links.size > 0){
for(Tilec other : tile.entity.getPowerConnections(outArray2)){
if(tile.entity != null && tile.entity.power != null && tile.entity.power.links.size > 0){
for(Building other : tile.entity.getPowerConnections(outArray2)){
if(other.block() instanceof PowerNode){ //TODO need a generic way to render connections!
tileview.add(other.tile());
}
@@ -229,7 +229,7 @@ public class BlockRenderer implements Disposable{
for(int i = 0; i < tileview.size; i++){
Tile tile = tileview.items[i];
Block block = tile.block();
Tilec entity = tile.entity;
Building entity = tile.entity;
Draw.z(Layer.block);
@@ -260,7 +260,7 @@ public class BlockRenderer implements Disposable{
//draw lights
for(int i = 0; i < lightview.size; i++){
Tile tile = lightview.items[i];
Tilec entity = tile.entity;
Building entity = tile.entity;
if(entity != null){
entity.drawLight();

View File

@@ -73,7 +73,7 @@ public class Drawf{
return team == Team.derelict || team == Vars.player.team() || state.rules.enemyLights;
}
public static void selected(Tilec tile, Color color){
public static void selected(Building tile, Color color){
selected(tile.tile(), color);
}
@@ -188,11 +188,11 @@ public class Drawf{
Draw.rect(Core.atlas.find("shape-3"), x, y - oy + length / 2f, width, length, width / 2f, oy, rotation - 90);
}
public static void construct(Tilec t, UnlockableContent content, float rotation, float progress, float speed, float time){
public static void construct(Building t, UnlockableContent content, float rotation, float progress, float speed, float time){
construct(t, content.icon(Cicon.full), rotation, progress, speed, time);
}
public static void construct(Tilec t, TextureRegion region, float rotation, float progress, float speed, float time){
public static void construct(Building t, TextureRegion region, float rotation, float progress, float speed, float time){
Shaders.build.region = region;
Shaders.build.progress = progress;
Shaders.build.color.set(Pal.accent);

View File

@@ -22,7 +22,7 @@ import static mindustry.Vars.*;
public class MinimapRenderer implements Disposable{
private static final float baseSize = 16f;
private final Seq<Unitc> units = new Seq<>();
private final Seq<Unit> units = new Seq<>();
private Pixmap pixmap;
private Texture texture;
private TextureRegion region;
@@ -36,7 +36,7 @@ public class MinimapRenderer implements Disposable{
});
//make sure to call on the graphics thread
Events.on(TileChangeEvent.class, event -> Core.app.post(() -> update(event.tile)));
Events.on(BuildinghangeEvent.class, event -> Core.app.post(() -> update(event.tile)));
}
public Pixmap getPixmap(){
@@ -87,7 +87,7 @@ public class MinimapRenderer implements Disposable{
rect.set((dx - sz) * tilesize, (dy - sz) * tilesize, sz * 2 * tilesize, sz * 2 * tilesize);
for(Unitc unit : units){
for(Unit unit : units){
float rx = !withLabels ? (unit.x() - rect.x) / rect.width * w : unit.x() / (world.width() * tilesize) * w;
float ry = !withLabels ? (unit.y() - rect.y) / rect.width * h : unit.y() / (world.height() * tilesize) * h;
@@ -97,9 +97,9 @@ public class MinimapRenderer implements Disposable{
Draw.reset();
//only disable player names in multiplayer
if(withLabels && unit instanceof Playerc && net.active()){
Playerc pl = (Playerc)unit;
drawLabel(x + rx, y + ry, pl.name(), unit.team().color);
if(withLabels && unit.isPlayer() && net.active()){
Player pl = unit.getPlayer();
drawLabel(x + rx, y + ry, pl.name, unit.team().color);
}
}

View File

@@ -19,7 +19,7 @@ public class OverlayRenderer{
private static final float spawnerMargin = tilesize*11f;
private static final Rect rect = new Rect();
private float buildFade, unitFade;
private Unitc lastSelect;
private Unit lastSelect;
public void drawBottom(){
InputHandler input = control.input;
@@ -36,7 +36,7 @@ public class OverlayRenderer{
public void drawTop(){
if(Core.settings.getBool("playerindicators")){
for(Playerc player : Groups.player){
for(Player player : Groups.player){
if(Vars.player != player && Vars.player.team() == player.team()){
if(!rect.setSize(Core.camera.width * 0.9f, Core.camera.height * 0.9f)
.setCenter(Core.camera.position.x, Core.camera.position.y).contains(player.x(), player.y())){
@@ -67,7 +67,7 @@ public class OverlayRenderer{
InputHandler input = control.input;
Unitc select = input.selectedUnit();
Unit select = input.selectedUnit();
if(!Core.input.keyDown(Binding.control)) select = null;
unitFade = Mathf.lerpDelta(unitFade, Mathf.num(select != null), 0.1f);
@@ -79,19 +79,19 @@ public class OverlayRenderer{
if(select instanceof BlockUnitc){
//special selection for block "units"
Fill.square(select.x(), select.y(), ((BlockUnitc)select).tile().block().size * tilesize/2f);
Fill.square(select.x, select.y, ((BlockUnitc)select).tile().block().size * tilesize/2f);
}else{
Draw.rect(select.type().icon(Cicon.full), select.x(), select.y(), select.rotation() - 90);
}
Lines.stroke(unitFade);
Lines.square(select.x(), select.y(), select.hitSize() * 1.5f, Time.time() * 2f);
Lines.square(select.x, select.y, select.hitSize() * 1.5f, Time.time() * 2f);
Draw.reset();
}
//draw config selected block
if(input.frag.config.isShown()){
Tilec tile = input.frag.config.getSelectedTile();
Building tile = input.frag.config.getSelectedTile();
tile.drawConfigure();
}
@@ -129,7 +129,7 @@ public class OverlayRenderer{
//draw selected block
if(input.block == null && !Core.scene.hasMouse()){
Vec2 vec = Core.input.mouseWorld(input.getMouseX(), input.getMouseY());
Tilec tile = world.entWorld(vec.x, vec.y);
Building tile = world.entWorld(vec.x, vec.y);
if(tile != null && tile.team() == player.team()){
tile.drawSelect();
@@ -152,7 +152,7 @@ public class OverlayRenderer{
Lines.circle(v.x, v.y, 6 + Mathf.absin(Time.time(), 5f, 1f));
Draw.reset();
Tilec tile = world.entWorld(v.x, v.y);
Building tile = world.entWorld(v.x, v.y);
if(tile != null && tile.interactable(player.team()) && tile.acceptStack(player.unit().item(), player.unit().stack().amount, player.unit()) > 0){
Lines.stroke(3f, Pal.gray);
Lines.square(tile.x(), tile.y(), tile.block().size * tilesize / 2f + 3 + Mathf.absin(Time.time(), 5f, 1f));

View File

@@ -30,7 +30,7 @@ public class PlanetGrid{
PlanetGrid(int size){
this.size = size;
tiles = new Ptile[tileCount(size)];
tiles = new Ptile[Buildingount(size)];
for(int i = 0; i < tiles.length; i++){
tiles[i] = new Ptile(i, i < 12 ? 5 : 6);
}
@@ -207,7 +207,7 @@ public class PlanetGrid{
return -1;
}
static int tileCount(int size){
static int Buildingount(int size){
return 10 * Mathf.pow(3, size) + 2;
}