1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-22 05:47:44 +03:00

Code cleanup

This commit is contained in:
Anuken 2020-12-16 10:39:28 -05:00
parent 4ad234ad75
commit d0cba1aff2
29 changed files with 38 additions and 60 deletions

View File

@ -1,7 +1,5 @@
package mindustry.ai;
import arc.*;
import arc.input.*;
import arc.math.*;
import arc.math.geom.*;
import arc.struct.*;

View File

@ -1772,7 +1772,7 @@ public class Blocks implements ContentList{
maxAmmo = 40;
ammoPerShot = 4;
rotateSpeed = 2.5f;
rotateSpeed = 2f;
reloadTime = 200f;
ammoUseEffect = Fx.casing3Double;
recoilAmount = 5f;

View File

@ -58,7 +58,7 @@ public class Fx{
alpha(e.fout());
rect(block ? ((BlockUnitc)select).tile().block.icon(Cicon.full) : select.type.icon(Cicon.full), select.x, select.y, block ? 0f : select.rotation - 90f);
alpha(1f);
Lines.stroke(e.fslope() * 1f);
Lines.stroke(e.fslope());
Lines.square(select.x, select.y, e.fout() * select.hitSize * 2f, 45);
Lines.stroke(e.fslope() * 2f);
Lines.square(select.x, select.y, e.fout() * select.hitSize * 3f, 45f);
@ -96,7 +96,7 @@ public class Fx{
x = Tmp.v1.x;
y = Tmp.v1.y;
Fill.square(x, y, 1f * size, 45f);
Fill.square(x, y, size, 45f);
}),
itemTransfer = new Effect(12f, e -> {
@ -127,7 +127,7 @@ public class Fx{
pointHit = new Effect(8f, e -> {
color(Color.white, e.color, e.fin());
stroke(e.fout() * 1f + 0.2f);
stroke(e.fout() + 0.2f);
Lines.circle(e.x, e.y, e.fin() * 6f);
}),
@ -560,7 +560,7 @@ public class Fx{
});
color(Pal.lighterOrange);
stroke(1f * e.fout());
stroke(e.fout());
randLenVectors(e.id + 1, 4, 1f + 23f * e.finpow(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
@ -582,7 +582,7 @@ public class Fx{
});
color(Pal.plastaniumBack);
stroke(1f * e.fout());
stroke(e.fout());
randLenVectors(e.id + 1, 4, 1f + 25f * e.finpow(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
@ -604,7 +604,7 @@ public class Fx{
});
color(Pal.plastaniumBack);
stroke(1f * e.fout());
stroke(e.fout());
randLenVectors(e.id + 1, 4, 1f + 30f * e.finpow(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
@ -626,7 +626,7 @@ public class Fx{
});
color(Pal.missileYellowBack);
stroke(1f * e.fout());
stroke(e.fout());
randLenVectors(e.id + 1, 4, 1f + 23f * e.finpow(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
@ -648,7 +648,7 @@ public class Fx{
});
color(Pal.sapBulletBack);
stroke(1f * e.fout());
stroke(e.fout());
randLenVectors(e.id + 1, 8, 1f + 60f * e.finpow(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
@ -670,7 +670,7 @@ public class Fx{
});
color(Pal.missileYellowBack);
stroke(1f * e.fout());
stroke(e.fout());
randLenVectors(e.id + 1, 6, 1f + 29f * e.finpow(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 4f);
@ -713,7 +713,7 @@ public class Fx{
});
color(Pal.bulletYellow);
stroke(1f * e.fout());
stroke(e.fout());
randLenVectors(e.id + 1, 4, 1f + 23f * e.finpow(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
@ -792,14 +792,14 @@ public class Fx{
color(Liquids.water.color);
alpha(Mathf.clamp(e.fin() * 2f));
Fill.circle(e.x, e.y, e.fout() * 1f);
Fill.circle(e.x, e.y, e.fout());
}),
muddy = new Effect(80f, e -> {
color(Color.valueOf("432722"));
alpha(Mathf.clamp(e.fin() * 2f));
Fill.circle(e.x, e.y, e.fout() * 1f);
Fill.circle(e.x, e.y, e.fout());
}),
sapped = new Effect(40f, e -> {
@ -820,7 +820,7 @@ public class Fx{
color(Liquids.oil.color);
randLenVectors(e.id, 2, 1f + e.fin() * 2f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 1f);
Fill.circle(e.x + x, e.y + y, e.fout());
});
}),
@ -885,7 +885,7 @@ public class Fx{
randLenVectors(e.id, 6, 2f + 19f * e.finpow(), (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 3f + 0.5f);
Fill.circle(e.x + x / 2f, e.y + y / 2f, e.fout() * 1f);
Fill.circle(e.x + x / 2f, e.y + y / 2f, e.fout());
});
color(Pal.lighterOrange, Pal.lightOrange, Color.gray, e.fin());
@ -929,7 +929,7 @@ public class Fx{
randLenVectors(e.id, 6, 2f + 19f * e.finpow(), (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 3f + 0.5f);
Fill.circle(e.x + x / 2f, e.y + y / 2f, e.fout() * 1f);
Fill.circle(e.x + x / 2f, e.y + y / 2f, e.fout());
});
color(Pal.lighterOrange, Pal.lightOrange, Color.gray, e.fin());
@ -945,7 +945,7 @@ public class Fx{
randLenVectors(e.id, 6, 4f + 30f * e.finpow(), (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 3f);
Fill.circle(e.x + x / 2f, e.y + y / 2f, e.fout() * 1f);
Fill.circle(e.x + x / 2f, e.y + y / 2f, e.fout());
});
}),
@ -1311,7 +1311,7 @@ public class Fx{
plasticburn = new Effect(40, e -> {
randLenVectors(e.id, 5, 3f + e.fin() * 5f, (x, y) -> {
color(Color.valueOf("e9ead3"), Color.gray, e.fin());
Fill.circle(e.x + x, e.y + y, e.fout() * 1f);
Fill.circle(e.x + x, e.y + y, e.fout());
});
}),
@ -1339,14 +1339,14 @@ public class Fx{
pulverizeSmall = new Effect(30, e -> {
randLenVectors(e.id, 3, e.fin() * 5f, (x, y) -> {
color(Pal.stoneGray);
Fill.square(e.x + x, e.y + y, e.fout() * 1f + 0.5f, 45);
Fill.square(e.x + x, e.y + y, e.fout() + 0.5f, 45);
});
}),
pulverizeMedium = new Effect(30, e -> {
randLenVectors(e.id, 5, 3f + e.fin() * 8f, (x, y) -> {
color(Pal.stoneGray);
Fill.square(e.x + x, e.y + y, e.fout() * 1f + 0.5f, 45);
Fill.square(e.x + x, e.y + y, e.fout() + 0.5f, 45);
});
}),
@ -1548,7 +1548,7 @@ public class Fx{
overdriveWave = new Effect(50, e -> {
color(e.color);
stroke(e.fout() * 1f);
stroke(e.fout());
Lines.circle(e.x, e.y, e.finpow() * e.rotation);
}),
@ -1593,7 +1593,7 @@ public class Fx{
});
color(Pal.shield, e.fout());
stroke(1f * e.fout());
stroke(e.fout());
Lines.circle(e.x, e.y, radius);
}),

View File

@ -11,7 +11,6 @@ import mindustry.ctype.*;
import mindustry.game.EventType.*;
import mindustry.entities.bullet.*;
import mindustry.mod.Mods.*;
import mindustry.net.*;
import mindustry.type.*;
import mindustry.world.*;

View File

@ -452,12 +452,12 @@ public class NetServer implements ApplicationListener{
return;
}
if(!arg[0].toLowerCase().equals("y") && !arg[0].toLowerCase().equals("n")){
if(!arg[0].equalsIgnoreCase("y") && !arg[0].equalsIgnoreCase("n")){
player.sendMessage("[scarlet]Vote either 'y' (yes) or 'n' (no).");
return;
}
int sign = arg[0].toLowerCase().equals("y") ? 1 : -1;
int sign = arg[0].equalsIgnoreCase("y") ? 1 : -1;
currentlyKicking[0].vote(player, sign);
}
});

View File

@ -302,9 +302,7 @@ public class World{
entries.removeAll(e -> e.value < 30);
Block[] floors = new Block[entries.size];
int[] floorCounts = new int[entries.size];
for(int i = 0; i < entries.size; i++){
floorCounts[i] = entries.get(i).value;
floors[i] = entries.get(i).key;
}
@ -544,7 +542,7 @@ public class World{
int circleDst = (int)(rawDst - (length - circleBlend));
if(circleDst > 0){
dark = Math.max(circleDst / 1f, dark);
dark = Math.max(circleDst, dark);
}
}

View File

@ -1,6 +1,5 @@
package mindustry.entities.bullet;
import arc.graphics.*;
import arc.graphics.g2d.*;
import mindustry.gen.*;
import mindustry.content.*;

View File

@ -575,7 +575,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
if(next.team == team && next.block.hasLiquids && liquids.get(liquid) > 0f){
float ofract = next.liquids.get(liquid) / next.block.liquidCapacity;
float fract = liquids.get(liquid) / block.liquidCapacity * block.liquidPressure;
float flow = Math.min(Mathf.clamp((fract - ofract) * (1f)) * (block.liquidCapacity), liquids.get(liquid));
float flow = Math.min(Mathf.clamp((fract - ofract)) * (block.liquidCapacity), liquids.get(liquid));
flow = Math.min(flow, next.block.liquidCapacity - next.liquids.get(liquid));
if(flow > 0f && ofract <= fract && next.acceptLiquid(self(), liquid)){

View File

@ -87,7 +87,7 @@ abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{
}
if(canDrown() && floor.isLiquid && floor.drownTime > 0){
drownTime += Time.delta * 1f / floor.drownTime;
drownTime += Time.delta / floor.drownTime;
drownTime = Mathf.clamp(drownTime);
if(Mathf.chanceDelta(0.05f)){
floor.drownUpdateEffect.at(x, y, 1f, floor.mapColor);

View File

@ -20,7 +20,6 @@ import mindustry.entities.units.*;
import mindustry.game.EventType.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.logic.*;
import mindustry.type.*;
import mindustry.ui.*;

View File

@ -263,10 +263,10 @@ public class Schematics implements Loadable{
requests.each(req -> {
req.animScale = 1f;
req.worldContext = false;
req.block.drawRequestRegion(req, requests::each);
req.block.drawRequestRegion(req, requests);
});
requests.each(req -> req.block.drawRequestConfigTop(req, requests::each));
requests.each(req -> req.block.drawRequestConfigTop(req, requests));
Draw.flush();
Draw.trans().idt();

View File

@ -311,7 +311,7 @@ public class LoadRenderer implements Disposable{
float vsize = vcont - vpad*2;
int rx = (int)(vx + vw/2f - vsize/2f), ry = (int)(vy + vh/2f - vsize/2f), rw = (int)vsize, rh = (int)vsize;
float vrad = vsize/2f + vpad / 1f;
float vrad = vsize/2f + vpad;
//planet + bars
if(!graphics.isPortrait()){

View File

@ -28,7 +28,7 @@ public class Trail{
for(int i = 0; i < points.size - 1; i++){
Vec3 c = points.get(i);
Vec3 n = points.get(i + 1);
float size = width * 1f / length;
float size = width / length;
float cx = Mathf.sin(c.z) * i * size, cy = Mathf.cos(c.z) * i * size, nx = Mathf.sin(n.z) * (i + 1) * size, ny = Mathf.cos(n.z) * (i + 1) * size;
Fill.quad(c.x - cx, c.y - cy, c.x + cx, c.y + cy, n.x + nx, n.y + ny, n.x - nx, n.y - ny);

View File

@ -285,7 +285,7 @@ public class SectorDamage{
if(build.block instanceof ForceProjector f){
sumHealth += f.shieldHealth * e;
sumRps += 1f * e;
sumRps += e;
}
}
}

View File

@ -2,7 +2,6 @@ package mindustry.maps.filters;
import arc.util.*;
import mindustry.content.*;
import mindustry.maps.filters.FilterOption.*;
import mindustry.world.*;
import static mindustry.maps.filters.FilterOption.*;

View File

@ -2,7 +2,6 @@ package mindustry.maps.filters;
import arc.util.*;
import mindustry.content.*;
import mindustry.maps.filters.FilterOption.*;
import mindustry.world.*;
import static mindustry.maps.filters.FilterOption.*;

View File

@ -2,7 +2,6 @@ package mindustry.maps.filters;
import arc.util.*;
import mindustry.content.*;
import mindustry.maps.filters.FilterOption.*;
import mindustry.world.*;
import static mindustry.maps.filters.FilterOption.*;

View File

@ -3,7 +3,6 @@ package mindustry.maps.filters;
import arc.math.*;
import arc.util.*;
import mindustry.content.*;
import mindustry.maps.filters.FilterOption.*;
import mindustry.world.*;
import static mindustry.maps.filters.FilterOption.*;

View File

@ -27,12 +27,10 @@ public class BaseGenerator{
private static final int range = 160;
private Tiles tiles;
private Team team;
private Seq<Tile> cores;
public void generate(Tiles tiles, Seq<Tile> cores, Tile spawn, Team team, Sector sector, float difficulty){
this.tiles = tiles;
this.team = team;
this.cores = cores;
//don't generate bases when there are no loaded schematics

View File

@ -2,7 +2,6 @@ package mindustry.mod;
import arc.*;
import arc.assets.*;
import arc.assets.loaders.*;
import arc.assets.loaders.SoundLoader.*;
import arc.audio.*;
import arc.files.*;
@ -10,7 +9,6 @@ import arc.func.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.mock.*;
import arc.struct.*;
import arc.util.*;
import arc.util.serialization.*;
@ -29,7 +27,6 @@ import mindustry.gen.*;
import mindustry.mod.Mods.*;
import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.blocks.*;
import mindustry.world.blocks.units.*;
import mindustry.world.blocks.units.UnitFactory.*;
import mindustry.world.consumers.*;
@ -37,7 +34,6 @@ import mindustry.world.draw.*;
import mindustry.world.meta.*;
import java.lang.reflect.*;
import java.util.*;
import static mindustry.Vars.*;

View File

@ -23,7 +23,7 @@ import static mindustry.Vars.*;
/** Handles control of bleeding edge builds. */
public class BeControl{
private static final int updateInterval = 60 * 1;
private static final int updateInterval = 60;
private AsyncExecutor executor = new AsyncExecutor(1);
private boolean checkUpdates = true;

View File

@ -16,7 +16,6 @@ import arc.graphics.g2d.*;
import arc.graphics.g2d.Font.*;
import arc.graphics.g2d.PixmapPacker.*;
import arc.graphics.g2d.TextureAtlas.*;
import arc.math.*;
import arc.math.geom.*;
import arc.scene.style.*;
import arc.scene.ui.layout.*;

View File

@ -299,7 +299,7 @@ public class JoinDialog extends BaseDialog{
pad = 6;
}
Cell cell = ((Table)pane.parent).getCell(button);
var cell = ((Table)pane.parent).getCell(button);
if(!Mathf.equal(cell.minWidth(), pw)){
cell.width(pw);

View File

@ -8,7 +8,6 @@ import arc.input.*;
import arc.scene.*;
import arc.scene.event.*;
import arc.scene.ui.*;
import arc.scene.ui.SettingsDialog.SettingsTable.*;
import arc.scene.ui.TextButton.*;
import arc.scene.ui.layout.*;
import arc.struct.*;

View File

@ -252,11 +252,10 @@ public class HudFragment extends Fragment{
if(android){
info.label(() -> memnative.get((int)(Core.app.getJavaHeap() / 1024 / 1024), (int)(Core.app.getNativeHeap() / 1024 / 1024))).left().style(Styles.outlineLabel).name("memory2");
info.row();
}else{
info.label(() -> mem.get((int)(Core.app.getJavaHeap() / 1024 / 1024))).left().style(Styles.outlineLabel).name("memory");
info.row();
}
info.row();
info.label(() -> ping.get(netClient.getPing())).visible(net::client).left().style(Styles.outlineLabel).name("ping");

View File

@ -21,7 +21,6 @@ public class PlayerListFragment extends Fragment{
private boolean visible = false;
private Interval timer = new Interval();
private TextField sField;
private boolean found = false;
private Seq<Player> players = new Seq<>();
@Override
@ -78,7 +77,7 @@ public class PlayerListFragment extends Fragment{
content.clear();
float h = 74f;
found = false;
boolean found = false;
players.clear();
Groups.player.copy(players);

View File

@ -41,7 +41,7 @@ public class BlockForge extends PayloadAcceptor{
public void setBars(){
super.setBars();
bars.add("progress", (BlockForgeBuild entity) -> new Bar("bar.progress", Pal.ammo, () -> entity.recipe == null ? 0f : (float)(entity.progress / entity.recipe.buildCost)));
bars.add("progress", (BlockForgeBuild entity) -> new Bar("bar.progress", Pal.ammo, () -> entity.recipe == null ? 0f : (entity.progress / entity.recipe.buildCost)));
}
@Override

View File

@ -81,7 +81,7 @@ public class Cultivator extends GenericCrafter{
float life = 1f - (((Time.time + offset) / 50f) % recurrence);
if(life > 0){
Lines.stroke(warmup * (life * 1f + 0.2f));
Lines.stroke(warmup * (life + 0.2f));
Lines.poly(x + x, y + y, 8, (1f - life) * 3f);
}
}

View File

@ -6,7 +6,6 @@ import arc.graphics.g2d.*;
import arc.math.*;
import arc.math.geom.*;
import arc.struct.*;
import arc.util.*;
import mindustry.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;