deprecation annihilation

This commit is contained in:
Anuken
2022-02-14 22:29:55 -05:00
parent b07b81e8c5
commit 65161a4129
45 changed files with 28 additions and 1057 deletions
-9
View File
@@ -153,10 +153,6 @@ public class Block extends UnlockableContent implements Senseable{
public int size = 1;
/** multiblock offset */
public float offset = 0f;
/** Deprecated for removal: Use clipSize instead.
* This does nothing, and is kept to preserve compatibility with v6 mods. */
@Deprecated
public boolean expanded = false;
/** Clipping size of this block. Should be as large as the block will draw. */
public float clipSize = -1f;
/** When placeRangeCheck is enabled, this is the range checked for enemy blocks. */
@@ -966,11 +962,6 @@ public class Block extends UnlockableContent implements Senseable{
clipSize = Math.max(clipSize, size * tilesize);
//only kept to ensure compatibility with v6 mods.
if(expanded){
clipSize += tilesize * 10f;
}
if(emitLight){
clipSize = Math.max(clipSize, lightRadius * 2f);
}
@@ -1,8 +1,6 @@
package mindustry.world.blocks.defense.turrets;
import arc.graphics.g2d.*;
import arc.struct.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.core.*;
import mindustry.entities.*;
@@ -19,11 +17,6 @@ public class LiquidTurret extends Turret{
public ObjectMap<Liquid, BulletType> ammoTypes = new ObjectMap<>();
public boolean extinguish = true;
/** @deprecated loaded in {@link #draw} instead, unused */
public @Deprecated @Load("@-liquid") TextureRegion liquidRegion;
/** @deprecated loaded in {@link #draw} instead, unused */
public @Deprecated @Load("@-top") TextureRegion topRegion;
public LiquidTurret(String name){
super(name);
acceptCoolant = false;
@@ -7,9 +7,6 @@ import mindustry.world.meta.*;
public class PowerTurret extends Turret{
public BulletType shootType;
/** @deprecated just consume power directly instead. */
@Deprecated
public float powerUse = -1f;
public PowerTurret(String name){
super(name);
@@ -22,14 +19,6 @@ public class PowerTurret extends Turret{
stats.add(Stat.ammo, StatValues.ammo(ObjectMap.of(this, shootType)));
}
@Override
public void init(){
if(powerUse > 0){
consumes.power(powerUse);
}
super.init();
}
public class PowerTurretBuild extends TurretBuild{
@Override
@@ -10,7 +10,6 @@ import arc.math.geom.*;
import arc.struct.*;
import arc.util.*;
import arc.util.io.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.core.*;
import mindustry.entities.*;
@@ -110,25 +109,6 @@ public class Turret extends ReloadTurret{
public DrawBlock draw = new DrawTurret();
/** @deprecated loaded in {@link #draw} instead, unused */
@Deprecated
public @Load(value = "@-base", fallback = "block-@size") TextureRegion baseRegion;
/** @deprecated loaded in {@link #draw} instead, unused */
@Deprecated
public @Load("@-heat") TextureRegion heatRegion;
/** @deprecated use bulletOffset; this will always be zero. **/
@Deprecated
protected Vec2 tr = new Vec2();
/** @deprecated use recoilOffset; this will always be zero. **/
@Deprecated
protected Vec2 tr2 = new Vec2();
/** @deprecated set the draw field instead, this does nothing */
@Deprecated
public Cons<TurretBuild> drawer = tile -> {};
/** @deprecated set the draw field instead, this does nothing */
@Deprecated
public Cons<TurretBuild> heatDrawer = tile -> {};
public Turret(String name){
super(name);
liquidCapacity = 20f;
@@ -1,15 +0,0 @@
package mindustry.world.blocks.distribution;
/** @deprecated use ItemBridge instead. */
@Deprecated
public class ExtendingItemBridge extends ItemBridge{
public ExtendingItemBridge(String name){
super(name);
}
@Deprecated
public class ExtendingItemBridgeBuild extends ItemBridgeBuild{
}
}
@@ -1,14 +0,0 @@
package mindustry.world.blocks.distribution;
/** @deprecated use the class in the payload package instead */
@Deprecated
public class PayloadConveyor extends mindustry.world.blocks.payloads.PayloadConveyor{
public PayloadConveyor(String name){
super(name);
}
public class PayloadConveyorBuild extends mindustry.world.blocks.payloads.PayloadConveyor.PayloadConveyorBuild{
}
}
@@ -1,14 +0,0 @@
package mindustry.world.blocks.distribution;
/** @deprecated use the class in the payload package instead */
@Deprecated
public class PayloadRouter extends mindustry.world.blocks.payloads.PayloadRouter{
public PayloadRouter(String name){
super(name);
}
public class PayloadRouterBuild extends mindustry.world.blocks.payloads.PayloadRouter.PayloadRouterBuild{
}
}
@@ -1,10 +0,0 @@
package mindustry.world.blocks.environment;
/** @deprecated pointless, just use your own sprite instead */
@Deprecated
public class DoubleOverlayFloor extends OverlayFloor{
public DoubleOverlayFloor(String name){
super(name);
}
}
@@ -1,17 +0,0 @@
package mindustry.world.blocks.experimental;
import mindustry.world.blocks.payloads.*;
/** @deprecated use Constructor instead. */
@Deprecated
public class BlockForge extends Constructor{
public BlockForge(String name){
super(name);
}
@Deprecated
public class BlockForgeBuild extends Constructor.ConstructorBuild{
}
}
@@ -1,16 +0,0 @@
package mindustry.world.blocks.experimental;
import mindustry.world.blocks.payloads.*;
@Deprecated
public class BlockLoader extends PayloadLoader{
public BlockLoader(String name){
super(name);
}
@Deprecated
public class BlockLoaderBuild extends PayloadLoaderBuild{
}
}
@@ -1,16 +0,0 @@
package mindustry.world.blocks.experimental;
import mindustry.world.blocks.payloads.*;
@Deprecated
public class BlockUnloader extends PayloadUnloader{
public BlockUnloader(String name){
super(name);
}
@Deprecated
public class BlockUnloaderBuild extends PayloadUnloaderBuild{
}
}
@@ -1,14 +0,0 @@
package mindustry.world.blocks.liquid;
/** @deprecated use LiquidBridge instead. */
@Deprecated
public class LiquidExtendingBridge extends LiquidBridge{
public LiquidExtendingBridge(String name){
super(name);
}
@Deprecated
public class LiquidExtendingBridgeBuild extends LiquidBridgeBuild{
}
}
@@ -6,7 +6,6 @@ import arc.util.*;
import arc.util.io.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.ui.*;
import mindustry.type.*;
import mindustry.world.*;
@@ -61,12 +60,6 @@ public interface Payload extends Position{
/** @return icon describing the contents. */
TextureRegion icon();
/** @deprecated use icon() instead. */
@Deprecated
default TextureRegion icon(Cicon icon){
return icon();
}
@Override
default float getX(){
return x();
@@ -1,18 +1,10 @@
package mindustry.world.blocks.power;
import arc.graphics.g2d.*;
import mindustry.annotations.Annotations.*;
import mindustry.type.*;
import mindustry.world.draw.*;
//TODO deprecate this whole class?
public class BurnerGenerator extends ItemLiquidGenerator{
@Deprecated
public @Load(value = "@-turbine#", length = 2) TextureRegion[] turbineRegions;
@Deprecated
public @Load("@-cap") TextureRegion capRegion;
@Deprecated
public float turbineSpeed = 2f;
public BurnerGenerator(String name){
super(true, false, name);
@@ -3,10 +3,8 @@ package mindustry.world.blocks.power;
import arc.*;
import arc.func.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.util.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.entities.*;
import mindustry.graphics.*;
@@ -37,16 +35,6 @@ public class ItemLiquidGenerator extends PowerGenerator{
public boolean randomlyExplode = true;
public boolean defaults = false;
/** @deprecated unused, use a custom drawer instead */
@Deprecated
public Color heatColor = Color.valueOf("ff9b59");
/** @deprecated unused, use a custom drawer instead */
@Deprecated
public @Load("@-top") TextureRegion topRegion;
/** @deprecated unused, use a custom drawer instead */
@Deprecated
public @Load("@-liquid") TextureRegion liquidRegion;
public ItemLiquidGenerator(boolean hasItems, boolean hasLiquids, String name){
this(name);
this.hasItems = hasItems;
@@ -84,12 +84,6 @@ public class PowerGraph{
return Mathf.clamp(lastPowerProduced / lastPowerNeeded);
}
/** @deprecated unused mechanic that always returns 1, I really don't know why you would use this outside of copy-pasted code */
@Deprecated
public float getUsageFraction(){
return 1f;
}
public float getPowerProduced(){
float powerProduced = 0f;
for(Building producer : producers){
@@ -1,24 +0,0 @@
package mindustry.world.blocks.power;
import mindustry.type.*;
/** @deprecated use ConsumeGenerator instead, this class does not have a sane implementation. */
@Deprecated
public class SingleTypeGenerator extends ItemLiquidGenerator{
public boolean useItems = true;
public SingleTypeGenerator(String name){
super(name);
defaults = true;
}
@Override
protected float getItemEfficiency(Item item){
return useItems ? 1f : 0f;
}
@Override
protected float getLiquidEfficiency(Liquid liquid){
return useItems ? 0f : 1f;
}
}
@@ -1,25 +0,0 @@
package mindustry.world.blocks.production;
import arc.graphics.*;
import arc.graphics.g2d.*;
import mindustry.annotations.Annotations.*;
/** @deprecated use AttributeCrafter instead, this is only a transition class. No flame effects are drawn, to encourage transition! */
@Deprecated
public class AttributeSmelter extends AttributeCrafter{
//parameters are kept for compatibility but deliberately unused
public Color flameColor = Color.valueOf("ffc999");
public @Load("@-top") TextureRegion topRegion;
//compat
public float maxHeatBoost = 1f;
public AttributeSmelter(String name){
super(name);
}
//unused, kept for compatibility
@Deprecated
public class AttributeSmelterBuild extends AttributeCrafterBuild{
}
}
@@ -1,48 +0,0 @@
package mindustry.world.blocks.production;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.util.io.*;
import mindustry.annotations.Annotations.*;
import mindustry.world.meta.*;
/**
* @deprecated use GenericCrafter or AttributeCrafter with a DrawCultivator instead.
* WARNING: If you switch from a class that used Cultivator to a GenericCrafter, make sure you set legacyReadWarmup to true! Failing to do so will break saves.
* This class has been gutted of its behavior.
* */
@Deprecated
public class Cultivator extends GenericCrafter{
//fields are kept for compatibility
public Color plantColor = Color.valueOf("5541b1");
public Color plantColorLight = Color.valueOf("7457ce");
public Color bottomColor = Color.valueOf("474747");
public @Load("@-middle") TextureRegion middleRegion;
public @Load("@-top") TextureRegion topRegion;
public Rand random = new Rand(0);
public float recurrence = 6f;
public Attribute attribute = Attribute.spores;
public Cultivator(String name){
super(name);
}
public class CultivatorBuild extends GenericCrafterBuild{
//compat
public float warmup, boost;
@Override
public void write(Writes write){
super.write(write);
write.f(warmup);
}
@Override
public void read(Reads read, byte revision){
super.read(read, revision);
warmup = read.f();
}
}
}
@@ -1,54 +0,0 @@
package mindustry.world.blocks.production;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.util.*;
import mindustry.annotations.Annotations.*;
import mindustry.gen.*;
import mindustry.graphics.*;
/** @deprecated this class has no new functionality over GenericCrafter, use GenericCrafter with a DrawSmelter drawer instead. See vanilla smelter blocks. */
@Deprecated
public class GenericSmelter extends GenericCrafter{
public Color flameColor = Color.valueOf("ffc999");
public @Load("@-top") TextureRegion topRegion;
public float flameRadius = 3f, flameRadiusIn = 1.9f, flameRadiusScl = 5f, flameRadiusMag = 2f, flameRadiusInMag = 1f;
public GenericSmelter(String name){
super(name);
ambientSound = Sounds.smelter;
ambientSoundVolume = 0.07f;
}
public class SmelterBuild extends GenericCrafterBuild{
@Override
public void draw(){
super.draw();
//draw glowing center
if(warmup > 0f && flameColor.a > 0.001f){
float g = 0.3f;
float r = 0.06f;
float cr = Mathf.random(0.1f);
Draw.z(Layer.block + 0.01f);
Draw.alpha(((1f - g) + Mathf.absin(Time.time, 8f, g) + Mathf.random(r) - r) * warmup);
Draw.tint(flameColor);
Fill.circle(x, y, flameRadius + Mathf.absin(Time.time, flameRadiusScl, flameRadiusMag) + cr);
Draw.color(1f, 1f, 1f, warmup);
Draw.rect(topRegion, x, y);
Fill.circle(x, y, flameRadiusIn + Mathf.absin(Time.time, flameRadiusScl, flameRadiusInMag) + cr);
Draw.color();
}
}
@Override
public void drawLight(){
Drawf.light(team, x, y, (60f + Mathf.absin(10f, 5f)) * warmup * size, flameColor, 0.65f);
}
}
}
@@ -1,18 +0,0 @@
package mindustry.world.blocks.production;
import mindustry.world.blocks.payloads.*;
/** @deprecated used PayloadBlock instead. */
@Deprecated
public abstract class PayloadAcceptor extends PayloadBlock{
public PayloadAcceptor(String name){
super(name);
}
/** @deprecated used PayloadBlockBuild instead. */
@Deprecated
public class PayloadAcceptorBuild<T extends Payload> extends PayloadBlockBuild<T>{
}
}
@@ -14,6 +14,8 @@ import mindustry.world.*;
import mindustry.world.blocks.*;
import mindustry.world.meta.*;
import java.util.*;
import static mindustry.Vars.*;
public class Unloader extends Block{
@@ -55,23 +57,33 @@ public class Unloader extends Block{
bars.remove("items");
}
public static class ContainerStat{
Building building;
float loadFactor;
boolean canLoad;
boolean canUnload;
int index;
}
public class UnloaderBuild extends Building{
public float unloadTimer = 0f;
public Item sortItem = null;
public int offset = 0;
public int rotations = 0;
public Seq<ContainerStat> possibleBlocks = new Seq<>();
public class ContainerStat{
Building building;
float loadFactor;
boolean canLoad;
boolean canUnload;
int index;
}
public int[] lastUsed;
protected final Comparator<ContainerStat> comparator = Structs.comps(
Structs.comps(
Structs.comparingBool(e -> e.building.block.highUnloadPriority && !e.canLoad),
Structs.comparingBool(e -> e.canUnload && !e.canLoad)
),
Structs.comps(
Structs.comparingFloat(e -> e.loadFactor),
Structs.comparingInt(e -> -lastUsed[e.index])
)
);
@Override
public void updateTile(){
if(((unloadTimer += delta()) < speed) || (proximity.size < 2)) return;
@@ -146,18 +158,7 @@ public class Unloader extends Block{
}
//sort so it gives full priority to blocks that can give but not receive (stackConveyors and Storage), and then by load, and then by last use
possibleBlocks.sort(
Structs.comps(
Structs.comps(
Structs.comparingBool(e -> e.building.block.highUnloadPriority && !e.canLoad),
Structs.comparingBool(e -> e.canUnload && !e.canLoad)
),
Structs.comps(
Structs.comparingFloat(e -> e.loadFactor),
Structs.comparingInt(e -> -lastUsed[e.index])
)
)
);
possibleBlocks.sort(comparator);
ContainerStat dumpingFrom = null;
ContainerStat dumpingTo = null;
@@ -131,18 +131,6 @@ public class Consumers{
return (T)map[type.ordinal()];
}
/** @deprecated unnecessary getter */
@Deprecated
public Consume[] all(){
return all;
}
/** @deprecated unnecessary getter */
@Deprecated
public Consume[] optionals(){
return optionals;
}
public void display(Stats stats){
for(Consume c : map){
if(c != null){
@@ -9,7 +9,6 @@ import mindustry.entities.units.*;
import mindustry.gen.*;
import mindustry.world.*;
import mindustry.world.blocks.production.*;
import mindustry.world.blocks.production.GenericCrafter.*;
/** An implementation of custom rendering behavior for a crafter block.
* This is used mostly for mods. */
@@ -19,14 +18,6 @@ public class DrawBlock{
/** If set, the icon is overridden to be these strings, in order. Each string is a suffix. */
public @Nullable String[] iconOverride = null;
/** @deprecated no longer called! not specific to generic crafters! */
@Deprecated
public void draw(GenericCrafterBuild build){}
/** @deprecated no longer called! not specific to generic crafters! */
@Deprecated
public void drawLight(GenericCrafterBuild build){}
public void getRegionsToOutline(Block block, Seq<TextureRegion> out){
}
+1 -4
View File
@@ -26,10 +26,7 @@ public enum BlockFlag{
//single-block identifiers
launchPad,
unitCargoUnloadPoint,
unitAssembler,
/** @deprecated not used anywhere */
@Deprecated resupply;
unitAssembler;
public final static BlockFlag[] all = values();
@@ -1,62 +0,0 @@
package mindustry.world.modules;
import arc.util.io.*;
import mindustry.gen.*;
import mindustry.world.meta.*;
/**
* why is it a module? literally two booleans, why did I think it was a good idea? yay, more pointers???
* the braindead java "make everything a separate class" mentality
* */
public class ConsumeModule extends BlockModule{
private final Building build;
public ConsumeModule(Building build){
this.build = build;
}
/** @deprecated use build.status() */
@Deprecated
public BlockStatus status(){
return build.status();
}
/** @deprecated use build.updateConsumption() */
@Deprecated
public void update(){
build.updateConsumption();
}
/** @deprecated use build.consume() */
@Deprecated
public void trigger(){
build.consume();
}
/** @deprecated use build.consValid() */
@Deprecated
public boolean valid(){
return build.consValid();
}
/** @deprecated use build.canConsume() */
@Deprecated
public boolean canConsume(){
return build.canConsume();
}
/** @deprecated use build.consOptionalValid() */
@Deprecated
public boolean optionalValid(){
return build.consOptionalValid();
}
//hahahahahahahahahaha
@Override
public void write(Writes write){
}
@Override
public void read(Reads read){
}
}
@@ -78,16 +78,6 @@ public class LiquidModule extends BlockModule{
return flow != null && cacheBits.get(liquid.id);
}
/**
* @deprecated There is no good reason to check the total amount of liquids of a block.
* Use of this method is almost certainly a bug; currentAmount() is probably what you want instead.
* All liquid storage systems either store one liquid type, or have per-liquid inventories, and as such total liquid is irrelevant.
* */
@Deprecated
public float total(){
return total;
}
/** Last received or loaded liquid. Only valid for liquid modules with 1 type of liquid. */
public Liquid current(){
return current;