mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-13 17:27:35 +07:00
Vars cleanup
This commit is contained in:
@ -8,8 +8,6 @@ import io.anuke.arc.entities.impl.EffectEntity;
|
|||||||
import io.anuke.arc.entities.trait.DrawTrait;
|
import io.anuke.arc.entities.trait.DrawTrait;
|
||||||
import io.anuke.arc.files.FileHandle;
|
import io.anuke.arc.files.FileHandle;
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.Color;
|
||||||
import io.anuke.arc.math.geom.Vector2;
|
|
||||||
import io.anuke.arc.scene.ui.layout.Unit;
|
|
||||||
import io.anuke.mindustry.core.*;
|
import io.anuke.mindustry.core.*;
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
@ -29,29 +27,39 @@ import java.util.Locale;
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class Vars{
|
public class Vars{
|
||||||
|
/**main application name, capitalized*/
|
||||||
public static final String appName = "Mindustry";
|
public static final String appName = "Mindustry";
|
||||||
|
/**URL for discord invite.*/
|
||||||
public static final String discordURL = "https://discord.gg/mindustry";
|
public static final String discordURL = "https://discord.gg/mindustry";
|
||||||
|
/**URL for Github API for releases*/
|
||||||
public static final String releasesURL = "https://api.github.com/repos/Anuken/Mindustry/releases";
|
public static final String releasesURL = "https://api.github.com/repos/Anuken/Mindustry/releases";
|
||||||
|
/**URL for Github API for contributors*/
|
||||||
public static final String contributorsURL = "https://api.github.com/repos/Anuken/Mindustry/contributors";
|
public static final String contributorsURL = "https://api.github.com/repos/Anuken/Mindustry/contributors";
|
||||||
|
/**URL for sending crash reports to*/
|
||||||
public static final String crashReportURL = "http://mindustry.us.to/report";
|
public static final String crashReportURL = "http://mindustry.us.to/report";
|
||||||
//time between waves in frames (on normal mode)
|
/**time between waves in ticks (on normal mode)*/
|
||||||
public static final float wavespace = 60 * 60 * 1.5f;
|
public static final float wavespace = 60 * 60 * 1.5f;
|
||||||
|
/**maximum distance between mine and core that supports automatic transferring*/
|
||||||
public static final float mineTransferRange = 220f;
|
public static final float mineTransferRange = 220f;
|
||||||
//set ridiculously high for now
|
/**maximum distance from core that the player can be before it is no longer used for building*/
|
||||||
public static final float coreBuildRange = 999999f;
|
public static final float coreBuildRange = 999999f;
|
||||||
//team of the player by default
|
/**team of the player by default*/
|
||||||
public static final Team defaultTeam = Team.blue;
|
public static final Team defaultTeam = Team.blue;
|
||||||
//team of the enemy in waves
|
/**team of the enemy in waves/sectors*/
|
||||||
public static final Team waveTeam = Team.red;
|
public static final Team waveTeam = Team.red;
|
||||||
public static final float unlockResourceScaling = 1f;
|
/**max chat message length*/
|
||||||
public static final int maxTextLength = 150;
|
public static final int maxTextLength = 150;
|
||||||
|
/**max player name length in bytes*/
|
||||||
public static final int maxNameLength = 40;
|
public static final int maxNameLength = 40;
|
||||||
|
/**displayed item size when ingame, TODO remove.*/
|
||||||
public static final float itemSize = 5f;
|
public static final float itemSize = 5f;
|
||||||
|
/**size of tiles in units*/
|
||||||
public static final int tilesize = 8;
|
public static final int tilesize = 8;
|
||||||
|
/**size of sectors in tiles*/
|
||||||
public static final int sectorSize = 256;
|
public static final int sectorSize = 256;
|
||||||
|
/**specific number indicating 'invalid' sector*/
|
||||||
public static final int invalidSector = Integer.MAX_VALUE;
|
public static final int invalidSector = Integer.MAX_VALUE;
|
||||||
public static Locale[] locales;
|
/**all choosable player colors in join/host dialog*/
|
||||||
public static final Color[] playerColors = {
|
public static final Color[] playerColors = {
|
||||||
Color.valueOf("82759a"),
|
Color.valueOf("82759a"),
|
||||||
Color.valueOf("c0c1c5"),
|
Color.valueOf("c0c1c5"),
|
||||||
@ -70,31 +78,35 @@ public class Vars{
|
|||||||
Color.valueOf("4b5ef1"),
|
Color.valueOf("4b5ef1"),
|
||||||
Color.valueOf("2cabfe"),
|
Color.valueOf("2cabfe"),
|
||||||
};
|
};
|
||||||
//server port
|
/**default server port*/
|
||||||
public static final int port = 6567;
|
public static final int port = 6567;
|
||||||
|
/**if true, UI is not drawn*/
|
||||||
public static boolean disableUI;
|
public static boolean disableUI;
|
||||||
|
/**if true, game is set up in mobile mode, even on desktop. used for debugging*/
|
||||||
public static boolean testMobile;
|
public static boolean testMobile;
|
||||||
//shorthand for whether or not this is running on android or ios
|
/**whether the game is running on a mobile device*/
|
||||||
public static boolean mobile;
|
public static boolean mobile;
|
||||||
|
/**whether the game is running on an iOS device*/
|
||||||
public static boolean ios;
|
public static boolean ios;
|
||||||
|
/**whether the game is running on an Android device*/
|
||||||
public static boolean android;
|
public static boolean android;
|
||||||
//main data directory
|
/**whether the game is running on a headless server*/
|
||||||
|
public static boolean headless;
|
||||||
|
/**application data directory, equivalent to {@link io.anuke.arc.Settings#getDataDirectory()}*/
|
||||||
public static FileHandle dataDirectory;
|
public static FileHandle dataDirectory;
|
||||||
//subdirectory for screenshots
|
/**data subdirectory used for screenshots*/
|
||||||
public static FileHandle screenshotDirectory;
|
public static FileHandle screenshotDirectory;
|
||||||
//directory for user-created map data
|
/**data subdirectory used for custom mmaps*/
|
||||||
public static FileHandle customMapDirectory;
|
public static FileHandle customMapDirectory;
|
||||||
//save file directory
|
/**data subdirectory used for saves*/
|
||||||
public static FileHandle saveDirectory;
|
public static FileHandle saveDirectory;
|
||||||
public static String mapExtension = "mmap";
|
/**map file extension*/
|
||||||
public static String saveExtension = "msav";
|
public static final String mapExtension = "mmap";
|
||||||
//camera zoom displayed on startup
|
/**save file extension*/
|
||||||
public static int baseCameraScale;
|
public static final String saveExtension = "msav";
|
||||||
public static boolean showBlockDebug = false;
|
|
||||||
public static boolean showFog = true;
|
/**list of all locales that can be switched to*/
|
||||||
public static boolean headless = false;
|
public static Locale[] locales;
|
||||||
public static float controllerMin = 0.25f;
|
|
||||||
public static float baseControllerSpeed = 11f;
|
|
||||||
|
|
||||||
public static ContentLoader content;
|
public static ContentLoader content;
|
||||||
public static GameState state;
|
public static GameState state;
|
||||||
@ -107,8 +119,6 @@ public class Vars{
|
|||||||
public static NetServer netServer;
|
public static NetServer netServer;
|
||||||
public static NetClient netClient;
|
public static NetClient netClient;
|
||||||
|
|
||||||
public static Player[] players = {};
|
|
||||||
|
|
||||||
public static EntityGroup<Player> playerGroup;
|
public static EntityGroup<Player> playerGroup;
|
||||||
public static EntityGroup<TileEntity> tileGroup;
|
public static EntityGroup<TileEntity> tileGroup;
|
||||||
public static EntityGroup<Bullet> bulletGroup;
|
public static EntityGroup<Bullet> bulletGroup;
|
||||||
@ -119,7 +129,8 @@ public class Vars{
|
|||||||
public static EntityGroup<Fire> fireGroup;
|
public static EntityGroup<Fire> fireGroup;
|
||||||
public static EntityGroup<BaseUnit>[] unitGroups;
|
public static EntityGroup<BaseUnit>[] unitGroups;
|
||||||
|
|
||||||
public static final Vector2[] tmptr = new Vector2[]{new Vector2(), new Vector2(), new Vector2(), new Vector2()};
|
/**all local players, currently only has one player. may be used for local co-op in the future*/
|
||||||
|
public static Player[] players = {};
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
Serialization.init();
|
Serialization.init();
|
||||||
@ -175,6 +186,5 @@ public class Vars{
|
|||||||
screenshotDirectory = dataDirectory.child("screenshots/");
|
screenshotDirectory = dataDirectory.child("screenshots/");
|
||||||
customMapDirectory = dataDirectory.child("maps/");
|
customMapDirectory = dataDirectory.child("maps/");
|
||||||
saveDirectory = dataDirectory.child("saves/");
|
saveDirectory = dataDirectory.child("saves/");
|
||||||
baseCameraScale = Math.round(Unit.dp.scl(4));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ public class Control implements ApplicationListener{
|
|||||||
Recipe recipe = content.recipes().get(i);
|
Recipe recipe = content.recipes().get(i);
|
||||||
if(!recipe.isHidden() && recipe.requirements != null){
|
if(!recipe.isHidden() && recipe.requirements != null){
|
||||||
for(ItemStack stack : recipe.requirements){
|
for(ItemStack stack : recipe.requirements){
|
||||||
if(!entity.items.has(stack.item, Math.min((int) (stack.amount * unlockResourceScaling), 2000))) continue outer;
|
if(!entity.items.has(stack.item, Math.min((int) (stack.amount), 2000))) continue outer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(unlocks.unlockContent(recipe)){
|
if(unlocks.unlockContent(recipe)){
|
||||||
|
@ -42,8 +42,8 @@ public class Renderer implements ApplicationListener{
|
|||||||
public final OverlayRenderer overlays = new OverlayRenderer();
|
public final OverlayRenderer overlays = new OverlayRenderer();
|
||||||
|
|
||||||
private Color clearColor;
|
private Color clearColor;
|
||||||
private float targetscale = baseCameraScale;
|
private float targetscale = io.anuke.arc.scene.ui.layout.Unit.dp.scl(4);
|
||||||
private float camerascale = baseCameraScale;
|
private float camerascale = targetscale;
|
||||||
private Rectangle rect = new Rectangle(), rect2 = new Rectangle();
|
private Rectangle rect = new Rectangle(), rect2 = new Rectangle();
|
||||||
private Vector2 avgPosition = new Vector2();
|
private Vector2 avgPosition = new Vector2();
|
||||||
private float shakeIntensity, shaketime;
|
private float shakeIntensity, shaketime;
|
||||||
|
@ -12,6 +12,7 @@ import io.anuke.arc.graphics.g2d.Fill;
|
|||||||
import io.anuke.arc.graphics.g2d.Lines;
|
import io.anuke.arc.graphics.g2d.Lines;
|
||||||
import io.anuke.arc.math.Angles;
|
import io.anuke.arc.math.Angles;
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.Mathf;
|
||||||
|
import io.anuke.arc.math.geom.Vector2;
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.arc.util.Time;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.content.blocks.Blocks;
|
import io.anuke.mindustry.content.blocks.Blocks;
|
||||||
@ -44,6 +45,7 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
*/
|
*/
|
||||||
public interface BuilderTrait extends Entity{
|
public interface BuilderTrait extends Entity{
|
||||||
//these are not instance variables!
|
//these are not instance variables!
|
||||||
|
Vector2[] tmptr = new Vector2[]{new Vector2(), new Vector2(), new Vector2(), new Vector2()};
|
||||||
float placeDistance = 150f;
|
float placeDistance = 150f;
|
||||||
float mineDistance = 70f;
|
float mineDistance = 70f;
|
||||||
Array<BuildRequest> removal = new Array<>();
|
Array<BuildRequest> removal = new Array<>();
|
||||||
|
Reference in New Issue
Block a user