Refactored almost every class, somehow didn't break game yet

This commit is contained in:
Anuken
2018-01-27 23:42:42 -05:00
parent 78c8dc4902
commit 35b6b41f24
110 changed files with 1648 additions and 1463 deletions

View File

@@ -5,8 +5,6 @@ import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.core.GameState;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.game.SpawnPoint;
import io.anuke.mindustry.world.Block;
@@ -15,9 +13,9 @@ import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.Blocks;
import io.anuke.mindustry.world.blocks.types.StaticBlock;
import io.anuke.ucore.core.Core;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.core.Graphics;
import io.anuke.ucore.graphics.CacheBatch;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Mathf;
@@ -89,7 +87,7 @@ public class BlockRenderer{
if(!(block instanceof StaticBlock)){
if(block == Blocks.air){
if(!GameState.is(State.paused)) tile.floor().update(tile);
if(!state.is(State.paused)) tile.floor().update(tile);
}else{
if(!expanded){
@@ -190,11 +188,11 @@ public class BlockRenderer{
Draw.reset();
if(Vars.showPaths && Vars.debug){
if(showPaths && debug){
drawPaths();
}
if(Vars.debug && Vars.debugChunks){
if(debug && debugChunks){
Draw.color(Color.YELLOW);
Lines.stroke(1f);
for(int x = -crangex; x <= crangex; x++){
@@ -213,7 +211,7 @@ public class BlockRenderer{
void drawPaths(){
Draw.color(Color.RED);
for(SpawnPoint point : control.getSpawnPoints()){
for(SpawnPoint point : world.getSpawns()){
if(point.pathTiles != null){
for(int i = 1; i < point.pathTiles.length; i ++){
Lines.line(point.pathTiles[i-1].worldx(), point.pathTiles[i-1].worldy(),
@@ -280,6 +278,6 @@ public class BlockRenderer{
private void createBatch(){
if(cbatch != null)
cbatch.dispose();
cbatch = new CacheBatch(Vars.world.width() * Vars.world.height() * 4);
cbatch = new CacheBatch(world.width() * world.height() * 4);
}
}

View File

@@ -2,15 +2,17 @@ package io.anuke.mindustry.graphics;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Colors;
import io.anuke.mindustry.Vars;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Hue;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.graphics.Shapes;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
import static io.anuke.mindustry.Vars.respawnduration;
import static io.anuke.mindustry.Vars.tilesize;
public class Fx{
public static Color lightRed = Hue.mix(Color.WHITE, Color.FIREBRICK, 0.1f);
public static Color lightOrange = Color.valueOf("f68021");
@@ -249,31 +251,31 @@ public class Fx{
place = new Effect(16, e -> {
Lines.stroke(3f - e.ifract() * 2f);
Lines.square(e.x, e.y, Vars.tilesize / 2f + e.ifract() * 3f);
Lines.square(e.x, e.y, tilesize / 2f + e.ifract() * 3f);
Draw.reset();
}),
dooropen = new Effect(10, e -> {
Lines.stroke(e.fract() * 1.6f);
Lines.square(e.x, e.y, Vars.tilesize / 2f + e.ifract() * 2f);
Lines.square(e.x, e.y, tilesize / 2f + e.ifract() * 2f);
Draw.reset();
}),
doorclose= new Effect(10, e -> {
Lines.stroke(e.fract() * 1.6f);
Lines.square(e.x, e.y, Vars.tilesize / 2f + e.fract() * 2f);
Lines.square(e.x, e.y, tilesize / 2f + e.fract() * 2f);
Draw.reset();
}),
dooropenlarge = new Effect(10, e -> {
Lines.stroke(e.fract() * 1.6f);
Lines.square(e.x, e.y, Vars.tilesize + e.ifract() * 2f);
Lines.square(e.x, e.y, tilesize + e.ifract() * 2f);
Draw.reset();
}),
doorcloselarge = new Effect(10, e -> {
Lines.stroke(e.fract() * 1.6f);
Lines.square(e.x, e.y, Vars.tilesize + e.fract() * 2f);
Lines.square(e.x, e.y, tilesize + e.fract() * 2f);
Draw.reset();
}),
@@ -502,7 +504,7 @@ public class Fx{
Draw.reset();
}),
respawn = new Effect(Vars.respawnduration, e -> {
respawn = new Effect(respawnduration, e -> {
Draw.tcolor(Color.SCARLET);
Draw.tscl(0.25f);
Draw.text("Respawning in " + (int)((e.lifetime-e.time)/60), e.x, e.y);