mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-27 06:51:30 -08:00
Fixed unnecessary Color rgba methods
This commit is contained in:
parent
c7bc05f560
commit
6cbc42d9de
12 changed files with 27 additions and 44 deletions
|
|
@ -301,7 +301,7 @@ public class Pathfinder implements Runnable{
|
|||
|
||||
//spawn points are also enemies.
|
||||
if(state.rules.waves && team == state.rules.defaultTeam){
|
||||
for(Tile other : spawner.getGroundSpawns()){
|
||||
for(Tile other : spawner.getSpawns()){
|
||||
out.add(other.pos());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@ import static mindustry.Vars.*;
|
|||
public class WaveSpawner{
|
||||
private static final float margin = 40f, coreMargin = tilesize * 3; //how far away from the edge flying units spawn
|
||||
|
||||
private Array<FlyerSpawn> flySpawns = new Array<>();
|
||||
private Array<Tile> groundSpawns = new Array<>();
|
||||
private Array<Tile> spawns = new Array<>();
|
||||
private boolean spawning = false;
|
||||
|
||||
public WaveSpawner(){
|
||||
|
|
@ -26,16 +25,16 @@ public class WaveSpawner{
|
|||
}
|
||||
|
||||
public int countSpawns(){
|
||||
return groundSpawns.size;
|
||||
return spawns.size;
|
||||
}
|
||||
|
||||
public Array<Tile> getGroundSpawns(){
|
||||
return groundSpawns;
|
||||
public Array<Tile> getSpawns(){
|
||||
return spawns;
|
||||
}
|
||||
|
||||
/** @return true if the player is near a ground spawn point. */
|
||||
public boolean playerNear(){
|
||||
return !player.dead() && groundSpawns.contains(g -> Mathf.dst(g.x * tilesize, g.y * tilesize, player.x(), player.y()) < state.rules.dropZoneRadius && player.team() != state.rules.waveTeam);
|
||||
return !player.dead() && spawns.contains(g -> Mathf.dst(g.x * tilesize, g.y * tilesize, player.x(), player.y()) < state.rules.dropZoneRadius && player.team() != state.rules.waveTeam);
|
||||
}
|
||||
|
||||
public void spawnEnemies(){
|
||||
|
|
@ -81,7 +80,7 @@ public class WaveSpawner{
|
|||
}
|
||||
|
||||
private void eachGroundSpawn(SpawnConsumer cons){
|
||||
for(Tile spawn : groundSpawns){
|
||||
for(Tile spawn : spawns){
|
||||
cons.accept(spawn.worldx(), spawn.worldy(), true);
|
||||
}
|
||||
|
||||
|
|
@ -95,10 +94,12 @@ public class WaveSpawner{
|
|||
}
|
||||
|
||||
private void eachFlyerSpawn(Floatc2 cons){
|
||||
for(FlyerSpawn spawn : flySpawns){
|
||||
for(Tile tile : spawns){
|
||||
float angle = Angles.angle(tile.x, tile.y, world.width()/2, world.height()/2);
|
||||
|
||||
float trns = (world.width() + world.height()) * tilesize;
|
||||
float spawnX = Mathf.clamp(world.width() * tilesize / 2f + Angles.trnsx(spawn.angle, trns), -margin, world.width() * tilesize + margin);
|
||||
float spawnY = Mathf.clamp(world.height() * tilesize / 2f + Angles.trnsy(spawn.angle, trns), -margin, world.height() * tilesize + margin);
|
||||
float spawnX = Mathf.clamp(world.width() * tilesize / 2f + Angles.trnsx(angle, trns), -margin, world.width() * tilesize + margin);
|
||||
float spawnY = Mathf.clamp(world.height() * tilesize / 2f + Angles.trnsy(angle, trns), -margin, world.height() * tilesize + margin);
|
||||
cons.get(spawnX, spawnY);
|
||||
}
|
||||
|
||||
|
|
@ -114,25 +115,15 @@ public class WaveSpawner{
|
|||
}
|
||||
|
||||
private void reset(){
|
||||
|
||||
flySpawns.clear();
|
||||
groundSpawns.clear();
|
||||
spawns.clear();
|
||||
|
||||
for(Tile tile : world.tiles){
|
||||
if(tile.overlay() == Blocks.spawn){
|
||||
addSpawns(tile.x, tile.y);
|
||||
spawns.add(tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addSpawns(int x, int y){
|
||||
groundSpawns.add(world.tile(x, y));
|
||||
|
||||
FlyerSpawn fspawn = new FlyerSpawn();
|
||||
fspawn.angle = Angles.angle(world.width() / 2f, world.height() / 2f, x, y);
|
||||
flySpawns.add(fspawn);
|
||||
}
|
||||
|
||||
private void spawnEffect(Unitc unit){
|
||||
Fx.unitSpawn.at(unit.x(), unit.y(), 0f, unit);
|
||||
Time.run(30f, () -> {
|
||||
|
|
@ -144,8 +135,4 @@ public class WaveSpawner{
|
|||
private interface SpawnConsumer{
|
||||
void accept(float x, float y, boolean shockwave);
|
||||
}
|
||||
|
||||
private class FlyerSpawn{
|
||||
float angle;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ public class ContentLoader{
|
|||
if(color == 0 || color == 255) continue;
|
||||
|
||||
Block block = block(i);
|
||||
Color.rgba8888ToColor(block.mapColor, color);
|
||||
block.mapColor.rgba8888(color);
|
||||
block.hasColor = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package mindustry.core;
|
|||
import arc.*;
|
||||
import arc.assets.*;
|
||||
import arc.audio.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.input.*;
|
||||
import arc.scene.ui.*;
|
||||
|
|
@ -193,7 +192,7 @@ public class Control implements ApplicationListener, Loadable{
|
|||
|
||||
Core.settings.defaults(
|
||||
"ip", "localhost",
|
||||
"color-0", Color.rgba8888(playerColors[8]),
|
||||
"color-0", playerColors[8].rgba(),
|
||||
"name", "",
|
||||
"lastBuild", 0
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package mindustry.core;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
|
|
@ -75,7 +74,7 @@ public class NetClient implements ApplicationListener{
|
|||
c.mods = mods.getModStrings();
|
||||
c.mobile = mobile;
|
||||
c.versionType = Version.type;
|
||||
c.color = Color.rgba8888(player.color());
|
||||
c.color = player.color().rgba();
|
||||
c.usid = getUsid(packet.addressTCP);
|
||||
c.uuid = platform.getUUID();
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox
|
|||
//TODO move elsewhere
|
||||
if(team() != state.rules.waveTeam){
|
||||
float relativeSize = state.rules.dropZoneRadius + bounds()/2f + 1f;
|
||||
for(Tile spawn : spawner.getGroundSpawns()){
|
||||
for(Tile spawn : spawner.getSpawns()){
|
||||
if(withinDst(spawn.worldx(), spawn.worldy(), relativeSize)){
|
||||
vel().add(Tmp.v1.set(this).sub(spawn.worldx(), spawn.worldy()).setLength(0.1f + 1f - dst(spawn) / relativeSize).scl(0.45f * Time.delta()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public class OverlayRenderer{
|
|||
Lines.stroke(2f);
|
||||
Draw.color(Color.gray, Color.lightGray, Mathf.absin(Time.time(), 8f, 1f));
|
||||
|
||||
for(Tile tile : spawner.getGroundSpawns()){
|
||||
for(Tile tile : spawner.getSpawns()){
|
||||
if(tile.withinDst(player.x(), player.y(), state.rules.dropZoneRadius + spawnerMargin)){
|
||||
Draw.alpha(Mathf.clamp(1f - (player.dst(tile) - state.rules.dropZoneRadius) / spawnerMargin));
|
||||
Lines.dashCircle(tile.worldx(), tile.worldy(), state.rules.dropZoneRadius);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class MapIO{
|
|||
|
||||
Pixmap floors = new Pixmap(map.width, map.height, Format.RGBA8888);
|
||||
Pixmap walls = new Pixmap(map.width, map.height, Format.RGBA8888);
|
||||
int black = Color.rgba8888(Color.black);
|
||||
int black = 255;
|
||||
int shade = Color.rgba8888(0f, 0f, 0f, 0.5f);
|
||||
CachedTile tile = new CachedTile(){
|
||||
@Override
|
||||
|
|
@ -147,7 +147,7 @@ public class MapIO{
|
|||
if(wall.synthetic()){
|
||||
return team.color.rgba();
|
||||
}
|
||||
return Color.rgba8888(wall.solid ? wall.mapColor : ore == Blocks.air ? floor.mapColor : ore.mapColor);
|
||||
return (wall.solid ? wall.mapColor : ore == Blocks.air ? floor.mapColor : ore.mapColor).rgba();
|
||||
}
|
||||
|
||||
public static Pixmap writeImage(Tiles tiles){
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ public class TypeIO{
|
|||
}
|
||||
|
||||
public static void writeColor(Writes write, Color color){
|
||||
write.i(Color.rgba8888(color));
|
||||
write.i(color.rgba());
|
||||
}
|
||||
|
||||
public static Color readColor(Reads read){
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class Planet extends UnlockableContent{
|
|||
}
|
||||
}
|
||||
|
||||
sectors.random().unlocked = true;
|
||||
sectors.peek().unlocked = true;
|
||||
}else{
|
||||
sectors = new Array<>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package mindustry.ui.dialogs;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.scene.ui.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
|
|
@ -33,7 +32,7 @@ public class HostDialog extends FloatingDialog{
|
|||
ImageButton button = t.addImageButton(Tex.whiteui, Styles.clearFulli, 40, () -> {
|
||||
new PaletteDialog().show(color -> {
|
||||
player.color().set(color);
|
||||
Core.settings.put("color-0", Color.rgba8888(color));
|
||||
Core.settings.put("color-0", color.rgba());
|
||||
Core.settings.save();
|
||||
});
|
||||
}).size(54f).get();
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
package mindustry.ui.dialogs;
|
||||
|
||||
import arc.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import arc.struct.*;
|
||||
import arc.graphics.*;
|
||||
import arc.input.*;
|
||||
import arc.math.*;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import arc.util.serialization.*;
|
||||
import mindustry.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
|
|
@ -275,7 +274,7 @@ public class JoinDialog extends FloatingDialog{
|
|||
ImageButton button = t.addImageButton(Tex.whiteui, Styles.clearFulli, 40, () -> {
|
||||
new PaletteDialog().show(color -> {
|
||||
player.color().set(color);
|
||||
Core.settings.put("color-0", Color.rgba8888(color));
|
||||
Core.settings.put("color-0", color.rgba8888());
|
||||
Core.settings.save();
|
||||
});
|
||||
}).size(54f).get();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue