Implicit non-nullability for fields
This commit is contained in:
@@ -19,7 +19,7 @@ public class GameState{
|
|||||||
/** Whether the game is in game over state. */
|
/** Whether the game is in game over state. */
|
||||||
public boolean gameOver = false, serverPaused = false, wasTimeout;
|
public boolean gameOver = false, serverPaused = false, wasTimeout;
|
||||||
/** Map that is currently being played on. */
|
/** Map that is currently being played on. */
|
||||||
public @NonNull Map map = emptyMap;
|
public Map map = emptyMap;
|
||||||
/** The current game rules. */
|
/** The current game rules. */
|
||||||
public Rules rules = new Rules();
|
public Rules rules = new Rules();
|
||||||
/** Statistics for this save/game. Displayed after game over. */
|
/** Statistics for this save/game. Displayed after game over. */
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import static mindustry.Vars.*;
|
|||||||
public class World{
|
public class World{
|
||||||
public final Context context = new Context();
|
public final Context context = new Context();
|
||||||
|
|
||||||
public @NonNull Tiles tiles = new Tiles(0, 0);
|
public Tiles tiles = new Tiles(0, 0);
|
||||||
|
|
||||||
private boolean generating, invalidMap;
|
private boolean generating, invalidMap;
|
||||||
private ObjectMap<Map, Runnable> customMapLoaders = new ObjectMap<>();
|
private ObjectMap<Map, Runnable> customMapLoaders = new ObjectMap<>();
|
||||||
@@ -86,13 +86,11 @@ public class World{
|
|||||||
return height()*tilesize;
|
return height()*tilesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
public Floor floor(int x, int y){
|
public Floor floor(int x, int y){
|
||||||
Tile tile = tile(x, y);
|
Tile tile = tile(x, y);
|
||||||
return tile == null ? Blocks.air.asFloor() : tile.floor();
|
return tile == null ? Blocks.air.asFloor() : tile.floor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
public Floor floorWorld(float x, float y){
|
public Floor floorWorld(float x, float y){
|
||||||
Tile tile = tileWorld(x, y);
|
Tile tile = tileWorld(x, y);
|
||||||
return tile == null ? Blocks.air.asFloor() : tile.floor();
|
return tile == null ? Blocks.air.asFloor() : tile.floor();
|
||||||
@@ -132,7 +130,6 @@ public class World{
|
|||||||
return tile.build;
|
return tile.build;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
public Tile rawTile(int x, int y){
|
public Tile rawTile(int x, int y){
|
||||||
return tiles.getn(x, y);
|
return tiles.getn(x, y);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ import mindustry.mod.Mods.*;
|
|||||||
public abstract class Content implements Comparable<Content>, Disposable{
|
public abstract class Content implements Comparable<Content>, Disposable{
|
||||||
public final short id;
|
public final short id;
|
||||||
/** Info on which mod this content was loaded from. */
|
/** Info on which mod this content was loaded from. */
|
||||||
public @NonNull ModContentInfo minfo = new ModContentInfo();
|
public ModContentInfo minfo = new ModContentInfo();
|
||||||
|
|
||||||
|
|
||||||
public Content(){
|
public Content(){
|
||||||
this.id = (short)Vars.content.getBy(getContentType()).size;
|
this.id = (short)Vars.content.getBy(getContentType()).size;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class EditorTile extends Tile{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFloor(@NonNull Floor type){
|
public void setFloor(Floor type){
|
||||||
if(skip()){
|
if(skip()){
|
||||||
super.setFloor(type);
|
super.setFloor(type);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import mindustry.gen.*;
|
|||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
|
||||||
public class StatusFieldAbility extends Ability{
|
public class StatusFieldAbility extends Ability{
|
||||||
public @NonNull StatusEffect effect;
|
public StatusEffect effect;
|
||||||
public float duration = 60, reload = 100, range = 20;
|
public float duration = 60, reload = 100, range = 20;
|
||||||
public Effect applyEffect = Fx.heal;
|
public Effect applyEffect = Fx.heal;
|
||||||
public Effect activeEffect = Fx.overdriveWave;
|
public Effect activeEffect = Fx.overdriveWave;
|
||||||
@@ -17,7 +17,7 @@ public class StatusFieldAbility extends Ability{
|
|||||||
|
|
||||||
StatusFieldAbility(){}
|
StatusFieldAbility(){}
|
||||||
|
|
||||||
public StatusFieldAbility(@NonNull StatusEffect effect, float duration, float reload, float range){
|
public StatusFieldAbility(StatusEffect effect, float duration, float reload, float range){
|
||||||
this.duration = duration;
|
this.duration = duration;
|
||||||
this.reload = reload;
|
this.reload = reload;
|
||||||
this.range = range;
|
this.range = range;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package mindustry.entities.abilities;
|
|||||||
|
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
@@ -13,13 +12,13 @@ import mindustry.type.*;
|
|||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
|
|
||||||
public class UnitSpawnAbility extends Ability{
|
public class UnitSpawnAbility extends Ability{
|
||||||
public @NonNull UnitType type;
|
public UnitType type;
|
||||||
public float spawnTime = 60f, spawnX, spawnY;
|
public float spawnTime = 60f, spawnX, spawnY;
|
||||||
public Effect spawnEffect = Fx.spawn;
|
public Effect spawnEffect = Fx.spawn;
|
||||||
|
|
||||||
protected float timer;
|
protected float timer;
|
||||||
|
|
||||||
public UnitSpawnAbility(@NonNull UnitType type, float spawnTime, float spawnX, float spawnY){
|
public UnitSpawnAbility(UnitType type, float spawnTime, float spawnX, float spawnY){
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.spawnTime = spawnTime;
|
this.spawnTime = spawnTime;
|
||||||
this.spawnX = spawnX;
|
this.spawnX = spawnX;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import mindustry.world.*;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class LiquidBulletType extends BulletType{
|
public class LiquidBulletType extends BulletType{
|
||||||
public @NonNull Liquid liquid;
|
public Liquid liquid;
|
||||||
public float puddleSize = 6f;
|
public float puddleSize = 6f;
|
||||||
|
|
||||||
public LiquidBulletType(@Nullable Liquid liquid){
|
public LiquidBulletType(@Nullable Liquid liquid){
|
||||||
|
|||||||
@@ -421,7 +421,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
* @param todump payload to dump.
|
* @param todump payload to dump.
|
||||||
* @return whether the payload was moved successfully
|
* @return whether the payload was moved successfully
|
||||||
*/
|
*/
|
||||||
public boolean movePayload(@NonNull Payload todump){
|
public boolean movePayload(Payload todump){
|
||||||
int trns = block.size/2 + 1;
|
int trns = block.size/2 + 1;
|
||||||
Tile next = tile.getNearby(Geometry.d4(rotation).x * trns, Geometry.d4(rotation).y * trns);
|
Tile next = tile.getNearby(Geometry.d4(rotation).x * trns, Geometry.d4(rotation).y * trns);
|
||||||
|
|
||||||
@@ -438,7 +438,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
* @param todump payload to dump.
|
* @param todump payload to dump.
|
||||||
* @return whether the payload was moved successfully
|
* @return whether the payload was moved successfully
|
||||||
*/
|
*/
|
||||||
public boolean dumpPayload(@NonNull Payload todump){
|
public boolean dumpPayload(Payload todump){
|
||||||
if(proximity.size == 0) return false;
|
if(proximity.size == 0) return false;
|
||||||
|
|
||||||
int dump = this.dump;
|
int dump = this.dump;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
|
|||||||
|
|
||||||
@Import float x, y;
|
@Import float x, y;
|
||||||
|
|
||||||
@NonNull @ReadOnly Unit unit = Nulls.unit;
|
@ReadOnly Unit unit = Nulls.unit;
|
||||||
transient private Unit lastReadUnit = Nulls.unit;
|
transient private Unit lastReadUnit = Nulls.unit;
|
||||||
transient @Nullable NetConnection con;
|
transient @Nullable NetConnection con;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package mindustry.game;
|
|||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
|
||||||
@@ -10,7 +9,7 @@ import mindustry.type.*;
|
|||||||
public class Objectives{
|
public class Objectives{
|
||||||
|
|
||||||
public static class Research implements Objective{
|
public static class Research implements Objective{
|
||||||
public @NonNull UnlockableContent content;
|
public UnlockableContent content;
|
||||||
|
|
||||||
public Research(UnlockableContent content){
|
public Research(UnlockableContent content){
|
||||||
this.content = content;
|
this.content = content;
|
||||||
@@ -50,7 +49,7 @@ public class Objectives{
|
|||||||
|
|
||||||
//TODO merge
|
//TODO merge
|
||||||
public abstract static class SectorObjective implements Objective{
|
public abstract static class SectorObjective implements Objective{
|
||||||
public @NonNull SectorPreset preset;
|
public SectorPreset preset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Defines a specific objective for a game. */
|
/** Defines a specific objective for a game. */
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class Schematic implements Publishable, Comparable<Schematic>{
|
|||||||
/** Associated mod. If null, no mod is associated with this schematic. */
|
/** Associated mod. If null, no mod is associated with this schematic. */
|
||||||
public @Nullable LoadedMod mod;
|
public @Nullable LoadedMod mod;
|
||||||
|
|
||||||
public Schematic(Seq<Stile> tiles, @NonNull StringMap tags, int width, int height){
|
public Schematic(Seq<Stile> tiles, StringMap tags, int width, int height){
|
||||||
this.tiles = tiles;
|
this.tiles = tiles;
|
||||||
this.tags = tags;
|
this.tags = tags;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
@@ -52,7 +52,7 @@ public class Schematic implements Publishable, Comparable<Schematic>{
|
|||||||
return tiles.contains(s -> s.block instanceof CoreBlock);
|
return tiles.contains(s -> s.block instanceof CoreBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NonNull CoreBlock findCore(){
|
public CoreBlock findCore(){
|
||||||
Stile tile = tiles.find(s -> s.block instanceof CoreBlock);
|
Stile tile = tiles.find(s -> s.block instanceof CoreBlock);
|
||||||
if(tile == null) throw new IllegalArgumentException("Schematic is missing a core!");
|
if(tile == null) throw new IllegalArgumentException("Schematic is missing a core!");
|
||||||
return (CoreBlock)tile.block;
|
return (CoreBlock)tile.block;
|
||||||
@@ -118,7 +118,7 @@ public class Schematic implements Publishable, Comparable<Schematic>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Stile{
|
public static class Stile{
|
||||||
public @NonNull Block block;
|
public Block block;
|
||||||
public short x, y;
|
public short x, y;
|
||||||
public Object config;
|
public Object config;
|
||||||
public byte rotation;
|
public byte rotation;
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class Team implements Comparable<Team>{
|
|||||||
|
|
||||||
/** @return the core items for this team, or an empty item module.
|
/** @return the core items for this team, or an empty item module.
|
||||||
* Never add to the resulting item module, as it is mutable. */
|
* Never add to the resulting item module, as it is mutable. */
|
||||||
public @NonNull ItemModule items(){
|
public ItemModule items(){
|
||||||
return core() == null ? ItemModule.empty : core().items;
|
return core() == null ? ItemModule.empty : core().items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ public class LCanvas extends Table{
|
|||||||
public static class JumpButton extends ImageButton{
|
public static class JumpButton extends ImageButton{
|
||||||
Color hoverColor = Pal.place;
|
Color hoverColor = Pal.place;
|
||||||
Color defaultColor = Color.white;
|
Color defaultColor = Color.white;
|
||||||
@NonNull Prov<StatementElem> to;
|
Prov<StatementElem> to;
|
||||||
boolean selecting;
|
boolean selecting;
|
||||||
float mx, my;
|
float mx, my;
|
||||||
ClickListener listener;
|
ClickListener listener;
|
||||||
@@ -356,7 +356,7 @@ public class LCanvas extends Table{
|
|||||||
|
|
||||||
JumpCurve curve;
|
JumpCurve curve;
|
||||||
|
|
||||||
public JumpButton(@NonNull Prov<StatementElem> getter, Cons<StatementElem> setter){
|
public JumpButton(Prov<StatementElem> getter, Cons<StatementElem> setter){
|
||||||
super(Tex.logicNode, Styles.colori);
|
super(Tex.logicNode, Styles.colori);
|
||||||
|
|
||||||
to = getter;
|
to = getter;
|
||||||
|
|||||||
@@ -440,6 +440,8 @@ public class ContentParser{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void markError(Content content, LoadedMod mod, Fi file, Throwable error){
|
public void markError(Content content, LoadedMod mod, Fi file, Throwable error){
|
||||||
|
Log.err("Error for @ / @:\n@\n", content, file, Strings.getStackTrace(error));
|
||||||
|
|
||||||
content.minfo.mod = mod;
|
content.minfo.mod = mod;
|
||||||
content.minfo.sourceFile = file;
|
content.minfo.sourceFile = file;
|
||||||
content.minfo.error = makeError(error, file);
|
content.minfo.error = makeError(error, file);
|
||||||
@@ -545,7 +547,7 @@ public class ContentParser{
|
|||||||
try{
|
try{
|
||||||
if(field.field.getType().isPrimitive()) return;
|
if(field.field.getType().isPrimitive()) return;
|
||||||
|
|
||||||
if(field.field.isAnnotationPresent(NonNull.class) && field.field.get(object) == null){
|
if(!field.field.isAnnotationPresent(Nullable.class) && field.field.get(object) == null){
|
||||||
throw new RuntimeException("'" + field.field.getName() + "' in " + object.getClass().getSimpleName() + " is missing!");
|
throw new RuntimeException("'" + field.field.getName() + "' in " + object.getClass().getSimpleName() + " is missing!");
|
||||||
}
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import arc.mock.*;
|
|||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
|
|
||||||
public class ModLoadingMusic implements Music{
|
public class ModLoadingMusic implements Music{
|
||||||
public @NonNull Music music = new MockMusic();
|
public Music music = new MockMusic();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void play(){
|
public void play(){
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import arc.mock.*;
|
|||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
|
|
||||||
public class ModLoadingSound implements Sound{
|
public class ModLoadingSound implements Sound{
|
||||||
public @NonNull Sound sound = new MockSound();
|
public Sound sound = new MockSound();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float calcPan(float x, float y){
|
public float calcPan(float x, float y){
|
||||||
|
|||||||
@@ -399,7 +399,7 @@ public class Mods implements Loadable{
|
|||||||
d.button("@details", Icon.downOpen, Styles.transt, () -> {
|
d.button("@details", Icon.downOpen, Styles.transt, () -> {
|
||||||
new Dialog(""){{
|
new Dialog(""){{
|
||||||
setFillParent(true);
|
setFillParent(true);
|
||||||
cont.pane(e -> e.add(c.minfo.error).wrap().grow()).grow();
|
cont.pane(e -> e.add(c.minfo.error).wrap().grow().labelAlign(Align.center, Align.left)).grow();
|
||||||
cont.row();
|
cont.row();
|
||||||
cont.button("@ok", Icon.left, this::hide).size(240f, 60f);
|
cont.button("@ok", Icon.left, this::hide).size(240f, 60f);
|
||||||
}}.show();
|
}}.show();
|
||||||
|
|||||||
@@ -695,9 +695,9 @@ public class Administration{
|
|||||||
/** Defines a (potentially dangerous) action that a player has done in the world.
|
/** Defines a (potentially dangerous) action that a player has done in the world.
|
||||||
* These objects are pooled; do not cache them! */
|
* These objects are pooled; do not cache them! */
|
||||||
public static class PlayerAction implements Poolable{
|
public static class PlayerAction implements Poolable{
|
||||||
public @NonNull Player player;
|
public Player player;
|
||||||
public @NonNull ActionType type;
|
public ActionType type;
|
||||||
public @NonNull Tile tile;
|
public Tile tile;
|
||||||
|
|
||||||
/** valid for block placement events only */
|
/** valid for block placement events only */
|
||||||
public @Nullable Block block;
|
public @Nullable Block block;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class AmmoTypes implements ContentList{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class ItemAmmoType extends AmmoType{
|
public static class ItemAmmoType extends AmmoType{
|
||||||
public @NonNull Item item;
|
public Item item;
|
||||||
|
|
||||||
public ItemAmmoType(Item item){
|
public ItemAmmoType(Item item){
|
||||||
this.item = item;
|
this.item = item;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import mindustry.ui.*;
|
|||||||
|
|
||||||
public class Liquid extends UnlockableContent{
|
public class Liquid extends UnlockableContent{
|
||||||
/** Color used in pipes and on the ground. */
|
/** Color used in pipes and on the ground. */
|
||||||
public final @NonNull Color color;
|
public final Color color;
|
||||||
/** Color used in bars. */
|
/** Color used in bars. */
|
||||||
public @Nullable Color barColor;
|
public @Nullable Color barColor;
|
||||||
/** Color used to draw lights. Note that the alpha channel is used to dictate brightness. */
|
/** Color used to draw lights. Note that the alpha channel is used to dictate brightness. */
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class Planet extends UnlockableContent{
|
|||||||
/** intersect() temp var. */
|
/** intersect() temp var. */
|
||||||
private static final Vec3 intersectResult = new Vec3();
|
private static final Vec3 intersectResult = new Vec3();
|
||||||
/** Mesh used for rendering. Created on load() - will be null on the server! */
|
/** Mesh used for rendering. Created on load() - will be null on the server! */
|
||||||
public PlanetMesh mesh;
|
public @Nullable PlanetMesh mesh;
|
||||||
/** Position in global coordinates. Will be 0,0,0 until the Universe updates it. */
|
/** Position in global coordinates. Will be 0,0,0 until the Universe updates it. */
|
||||||
public Vec3 position = new Vec3();
|
public Vec3 position = new Vec3();
|
||||||
/** Grid used for the sectors on the planet. Null if this planet can't be landed on. */
|
/** Grid used for the sectors on the planet. Null if this planet can't be landed on. */
|
||||||
@@ -32,7 +32,7 @@ public class Planet extends UnlockableContent{
|
|||||||
/** Generator that will make the planet. Can be null for planets that don't need to be landed on. */
|
/** Generator that will make the planet. Can be null for planets that don't need to be landed on. */
|
||||||
public @Nullable PlanetGenerator generator;
|
public @Nullable PlanetGenerator generator;
|
||||||
/** Array of sectors; directly maps to tiles in the grid. */
|
/** Array of sectors; directly maps to tiles in the grid. */
|
||||||
public @NonNull Seq<Sector> sectors;
|
public Seq<Sector> sectors;
|
||||||
/** Radius of this planet's sphere. Does not take into account sattelites. */
|
/** Radius of this planet's sphere. Does not take into account sattelites. */
|
||||||
public float radius;
|
public float radius;
|
||||||
/** Orbital radius around the sun. Do not change unless you know exactly what you are doing.*/
|
/** Orbital radius around the sun. Do not change unless you know exactly what you are doing.*/
|
||||||
@@ -60,7 +60,7 @@ public class Planet extends UnlockableContent{
|
|||||||
/** Parent body that this planet orbits around. If null, this planet is considered to be in the middle of the solar system.*/
|
/** Parent body that this planet orbits around. If null, this planet is considered to be in the middle of the solar system.*/
|
||||||
public @Nullable Planet parent;
|
public @Nullable Planet parent;
|
||||||
/** The root parent of the whole solar system this planet is in. */
|
/** The root parent of the whole solar system this planet is in. */
|
||||||
public @NonNull Planet solarSystem;
|
public Planet solarSystem;
|
||||||
/** All planets orbiting this one, in ascending order of radius. */
|
/** All planets orbiting this one, in ascending order of radius. */
|
||||||
public Seq<Planet> children = new Seq<>();
|
public Seq<Planet> children = new Seq<>();
|
||||||
/** Sattelites orbiting this planet. */
|
/** Sattelites orbiting this planet. */
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
package mindustry.type;
|
package mindustry.type;
|
||||||
|
|
||||||
import arc.util.ArcAnnotate.*;
|
|
||||||
|
|
||||||
/** Any object that is orbiting a planet. */
|
/** Any object that is orbiting a planet. */
|
||||||
public class Satellite{
|
public class Satellite{
|
||||||
public @NonNull Planet planet;
|
public Planet planet;
|
||||||
|
|
||||||
public Satellite(@NonNull Planet orbiting){
|
public Satellite(Planet orbiting){
|
||||||
this.planet = orbiting;
|
this.planet = orbiting;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package mindustry.type;
|
|||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
@@ -11,9 +10,9 @@ import mindustry.maps.generators.*;
|
|||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
|
|
||||||
public class SectorPreset extends UnlockableContent{
|
public class SectorPreset extends UnlockableContent{
|
||||||
public @NonNull FileMapGenerator generator;
|
public FileMapGenerator generator;
|
||||||
public @NonNull Planet planet;
|
public Planet planet;
|
||||||
public @NonNull Sector sector;
|
public Sector sector;
|
||||||
|
|
||||||
public int captureWave = 0;
|
public int captureWave = 0;
|
||||||
public Cons<Rules> rules = rules -> rules.winWave = captureWave;
|
public Cons<Rules> rules = rules -> rules.winWave = captureWave;
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import arc.scene.ui.*;
|
|||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
|
||||||
import mindustry.ai.types.*;
|
import mindustry.ai.types.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
@@ -39,8 +38,8 @@ public class UnitType extends UnlockableContent{
|
|||||||
|
|
||||||
/** If true, the unit is always at elevation 1. */
|
/** If true, the unit is always at elevation 1. */
|
||||||
public boolean flying;
|
public boolean flying;
|
||||||
public @NonNull Prov<? extends Unit> constructor;
|
public Prov<? extends Unit> constructor;
|
||||||
public @NonNull Prov<? extends UnitController> defaultController = () -> !flying ? new GroundAI() : new FlyingAI();
|
public Prov<? extends UnitController> defaultController = () -> !flying ? new GroundAI() : new FlyingAI();
|
||||||
public float speed = 1.1f, boostMultiplier = 1f, rotateSpeed = 5f, baseRotateSpeed = 5f;
|
public float speed = 1.1f, boostMultiplier = 1f, rotateSpeed = 5f, baseRotateSpeed = 5f;
|
||||||
public float drag = 0.3f, accel = 0.5f, landShake = 0f, rippleScale = 1f, fallSpeed = 0.018f;
|
public float drag = 0.3f, accel = 0.5f, landShake = 0f, rippleScale = 1f, fallSpeed = 0.018f;
|
||||||
public float health = 200f, range = -1, armor = 0f;
|
public float health = 200f, range = -1, armor = 0f;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import arc.*;
|
|||||||
import arc.audio.*;
|
import arc.audio.*;
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.entities.bullet.*;
|
import mindustry.entities.bullet.*;
|
||||||
@@ -16,7 +15,7 @@ public class Weapon{
|
|||||||
/** displayed weapon region */
|
/** displayed weapon region */
|
||||||
public String name;
|
public String name;
|
||||||
/** bullet shot */
|
/** bullet shot */
|
||||||
public @NonNull BulletType bullet;
|
public BulletType bullet;
|
||||||
/** shell ejection effect */
|
/** shell ejection effect */
|
||||||
public Effect ejectEffect = Fx.none;
|
public Effect ejectEffect = Fx.none;
|
||||||
/** whether to create a flipped copy of this weapon upon initialization. default: true */
|
/** whether to create a flipped copy of this weapon upon initialization. default: true */
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import static mindustry.Vars.*;
|
|||||||
public class MapPlayDialog extends BaseDialog{
|
public class MapPlayDialog extends BaseDialog{
|
||||||
CustomRulesDialog dialog = new CustomRulesDialog();
|
CustomRulesDialog dialog = new CustomRulesDialog();
|
||||||
Rules rules;
|
Rules rules;
|
||||||
@NonNull Gamemode selectedGamemode = Gamemode.survival;
|
Gamemode selectedGamemode = Gamemode.survival;
|
||||||
Map lastMap;
|
Map lastMap;
|
||||||
|
|
||||||
public MapPlayDialog(){
|
public MapPlayDialog(){
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
/** Tile entity, usually null. */
|
/** Tile entity, usually null. */
|
||||||
public @Nullable Building build;
|
public @Nullable Building build;
|
||||||
public short x, y;
|
public short x, y;
|
||||||
protected @NonNull Block block;
|
protected Block block;
|
||||||
protected @NonNull Floor floor;
|
protected Floor floor;
|
||||||
protected @NonNull Floor overlay;
|
protected Floor overlay;
|
||||||
protected boolean changing = false;
|
protected boolean changing = false;
|
||||||
|
|
||||||
public Tile(int x, int y){
|
public Tile(int x, int y){
|
||||||
@@ -130,15 +130,15 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
return block.solid && !block.synthetic() && block.fillsTile;
|
return block.solid && !block.synthetic() && block.fillsTile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NonNull Floor floor(){
|
public Floor floor(){
|
||||||
return floor;
|
return floor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NonNull Block block(){
|
public Block block(){
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NonNull Floor overlay(){
|
public Floor overlay(){
|
||||||
return overlay;
|
return overlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +173,11 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
return team().id;
|
return team().id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlock(@NonNull Block type, Team team, int rotation){
|
public void setBlock(Block type, Team team, int rotation){
|
||||||
setBlock(type, team, rotation, type::newBuilding);
|
setBlock(type, team, rotation, type::newBuilding);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlock(@NonNull Block type, Team team, int rotation, Prov<Building> entityprov){
|
public void setBlock(Block type, Team team, int rotation, Prov<Building> entityprov){
|
||||||
changing = true;
|
changing = true;
|
||||||
|
|
||||||
if(type.isStatic() || this.block.isStatic()){
|
if(type.isStatic() || this.block.isStatic()){
|
||||||
@@ -232,16 +232,16 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
changing = false;
|
changing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlock(@NonNull Block type, Team team){
|
public void setBlock(Block type, Team team){
|
||||||
setBlock(type, team, 0);
|
setBlock(type, team, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlock(@NonNull Block type){
|
public void setBlock(Block type){
|
||||||
setBlock(type, Team.derelict, 0);
|
setBlock(type, Team.derelict, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This resets the overlay! */
|
/** This resets the overlay! */
|
||||||
public void setFloor(@NonNull Floor type){
|
public void setFloor(Floor type){
|
||||||
this.floor = type;
|
this.floor = type;
|
||||||
this.overlay = (Floor)Blocks.air;
|
this.overlay = (Floor)Blocks.air;
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the floor, preserving overlay.*/
|
/** Sets the floor, preserving overlay.*/
|
||||||
public void setFloorUnder(@NonNull Floor floor){
|
public void setFloorUnder(Floor floor){
|
||||||
Block overlay = this.overlay;
|
Block overlay = this.overlay;
|
||||||
setFloor(floor);
|
setFloor(floor);
|
||||||
setOverlay(overlay);
|
setOverlay(overlay);
|
||||||
@@ -326,7 +326,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
setOverlay(content.block(ore));
|
setOverlay(content.block(ore));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOverlay(@NonNull Block block){
|
public void setOverlay(Block block){
|
||||||
this.overlay = (Floor)block;
|
this.overlay = (Floor)block;
|
||||||
|
|
||||||
recache();
|
recache();
|
||||||
|
|||||||
@@ -50,20 +50,20 @@ public class Tiles implements Iterable<Tile>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @return a tile at coordinates; throws an exception if out of bounds */
|
/** @return a tile at coordinates; throws an exception if out of bounds */
|
||||||
public @NonNull Tile getn(int x, int y){
|
public Tile getn(int x, int y){
|
||||||
if(x < 0 || x >= width || y < 0 || y >= height) throw new IllegalArgumentException(x + ", " + y + " out of bounds: width=" + width + ", height=" + height);
|
if(x < 0 || x >= width || y < 0 || y >= height) throw new IllegalArgumentException(x + ", " + y + " out of bounds: width=" + width + ", height=" + height);
|
||||||
return array[y*width + x];
|
return array[y*width + x];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return a tile at coordinates, clamped. */
|
/** @return a tile at coordinates, clamped. */
|
||||||
public @NonNull Tile getc(int x, int y){
|
public Tile getc(int x, int y){
|
||||||
x = Mathf.clamp(x, 0, width - 1);
|
x = Mathf.clamp(x, 0, width - 1);
|
||||||
y = Mathf.clamp(y, 0, height - 1);
|
y = Mathf.clamp(y, 0, height - 1);
|
||||||
return array[y*width + x];
|
return array[y*width + x];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return a tile at an iteration index [0, width * height] */
|
/** @return a tile at an iteration index [0, width * height] */
|
||||||
public @NonNull Tile geti(int idx){
|
public Tile geti(int idx){
|
||||||
return array[idx];
|
return array[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package mindustry.world.blocks.defense.turrets;
|
package mindustry.world.blocks.defense.turrets;
|
||||||
|
|
||||||
import arc.util.ArcAnnotate.*;
|
|
||||||
import mindustry.entities.bullet.*;
|
import mindustry.entities.bullet.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
public class PowerTurret extends Turret{
|
public class PowerTurret extends Turret{
|
||||||
public @NonNull BulletType shootType;
|
public BulletType shootType;
|
||||||
public float powerUse = 1f;
|
public float powerUse = 1f;
|
||||||
|
|
||||||
public PowerTurret(String name){
|
public PowerTurret(String name){
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public abstract class Turret extends Block{
|
|||||||
public boolean logicShooting = false;
|
public boolean logicShooting = false;
|
||||||
public @Nullable Posc target;
|
public @Nullable Posc target;
|
||||||
public Vec2 targetPos = new Vec2();
|
public Vec2 targetPos = new Vec2();
|
||||||
public @NonNull BlockUnitc unit = Nulls.blockUnit;
|
public BlockUnitc unit = Nulls.blockUnit;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float range(){
|
public float range(){
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class Floor extends Block{
|
|||||||
/** Effect displayed when drowning on this floor. */
|
/** Effect displayed when drowning on this floor. */
|
||||||
public Effect drownUpdateEffect = Fx.bubble;
|
public Effect drownUpdateEffect = Fx.bubble;
|
||||||
/** Status effect applied when walking on. */
|
/** Status effect applied when walking on. */
|
||||||
public @NonNull StatusEffect status = StatusEffects.none;
|
public StatusEffect status = StatusEffects.none;
|
||||||
/** Intensity of applied status effect. */
|
/** Intensity of applied status effect. */
|
||||||
public float statusDuration = 60f;
|
public float statusDuration = 60f;
|
||||||
/** liquids that drop from this block, used for pumps */
|
/** liquids that drop from this block, used for pumps */
|
||||||
|
|||||||
@@ -3,12 +3,11 @@ package mindustry.world.blocks.production;
|
|||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
|
||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.type.*;
|
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
|
import mindustry.type.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.consumers.*;
|
import mindustry.world.consumers.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
@@ -18,7 +17,7 @@ import mindustry.world.meta.values.*;
|
|||||||
* Extracts a random list of items from an input item and an input liquid.
|
* Extracts a random list of items from an input item and an input liquid.
|
||||||
*/
|
*/
|
||||||
public class Separator extends Block{
|
public class Separator extends Block{
|
||||||
public @NonNull ItemStack[] results;
|
public ItemStack[] results;
|
||||||
public float craftTime;
|
public float craftTime;
|
||||||
|
|
||||||
public @Load("@-liquid") TextureRegion liquidRegion;
|
public @Load("@-liquid") TextureRegion liquidRegion;
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ public class CoreBlock extends StorageBlock{
|
|||||||
public class CoreBuild extends Building implements ControlBlock{
|
public class CoreBuild extends Building implements ControlBlock{
|
||||||
public int storageCapacity;
|
public int storageCapacity;
|
||||||
//note that this unit is never actually used for control; the possession handler makes the player respawn when this unit is controlled
|
//note that this unit is never actually used for control; the possession handler makes the player respawn when this unit is controlled
|
||||||
public @NonNull BlockUnitc unit = Nulls.blockUnit;
|
public BlockUnitc unit = Nulls.blockUnit;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void created(){
|
public void created(){
|
||||||
|
|||||||
@@ -3,14 +3,13 @@ package mindustry.world.consumers;
|
|||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
public class ConsumeItemDynamic extends Consume{
|
public class ConsumeItemDynamic extends Consume{
|
||||||
public final @NonNull Func<Building, ItemStack[]> items;
|
public final Func<Building, ItemStack[]> items;
|
||||||
|
|
||||||
public <T extends Building> ConsumeItemDynamic(Func<T, ItemStack[]> items){
|
public <T extends Building> ConsumeItemDynamic(Func<T, ItemStack[]> items){
|
||||||
this.items = (Func<Building, ItemStack[]>)items;
|
this.items = (Func<Building, ItemStack[]>)items;
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
package mindustry.world.consumers;
|
package mindustry.world.consumers;
|
||||||
|
|
||||||
import arc.struct.*;
|
|
||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.struct.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
@@ -13,8 +12,7 @@ import mindustry.world.meta.values.*;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class ConsumeItemFilter extends Consume{
|
public class ConsumeItemFilter extends Consume{
|
||||||
public final @NonNull
|
public final Boolf<Item> filter;
|
||||||
Boolf<Item> filter;
|
|
||||||
|
|
||||||
public ConsumeItemFilter(Boolf<Item> item){
|
public ConsumeItemFilter(Boolf<Item> item){
|
||||||
this.filter = item;
|
this.filter = item;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package mindustry.world.consumers;
|
|||||||
|
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
@@ -10,7 +9,7 @@ import mindustry.world.meta.*;
|
|||||||
import mindustry.world.meta.values.*;
|
import mindustry.world.meta.values.*;
|
||||||
|
|
||||||
public class ConsumeItems extends Consume{
|
public class ConsumeItems extends Consume{
|
||||||
public final @NonNull ItemStack[] items;
|
public final ItemStack[] items;
|
||||||
|
|
||||||
public ConsumeItems(ItemStack[] items){
|
public ConsumeItems(ItemStack[] items){
|
||||||
this.items = items;
|
this.items = items;
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
package mindustry.world.consumers;
|
package mindustry.world.consumers;
|
||||||
|
|
||||||
import arc.struct.*;
|
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.struct.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
public class ConsumeLiquid extends ConsumeLiquidBase{
|
public class ConsumeLiquid extends ConsumeLiquidBase{
|
||||||
public final @NonNull Liquid liquid;
|
public final Liquid liquid;
|
||||||
|
|
||||||
public ConsumeLiquid(Liquid liquid, float amount){
|
public ConsumeLiquid(Liquid liquid, float amount){
|
||||||
super(amount);
|
super(amount);
|
||||||
|
|||||||
Reference in New Issue
Block a user