mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-24 14:47:58 +07:00
Balancing / Made pads spawn infinite units
This commit is contained in:
@ -90,7 +90,7 @@ public class Vars{
|
|||||||
//whether turrets have infinite ammo (only with debug)
|
//whether turrets have infinite ammo (only with debug)
|
||||||
public static boolean infiniteAmmo = true;
|
public static boolean infiniteAmmo = true;
|
||||||
//whether to show paths of enemies
|
//whether to show paths of enemies
|
||||||
public static boolean showPaths = false;
|
public static boolean showPaths = true;
|
||||||
//if false, player is always hidden
|
//if false, player is always hidden
|
||||||
public static boolean showPlayer = true;
|
public static boolean showPlayer = true;
|
||||||
//whether to hide ui, only on debug
|
//whether to hide ui, only on debug
|
||||||
|
@ -81,7 +81,7 @@ public class Pathfinder{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public float getDebugValue(int x, int y){
|
public float getDebugValue(int x, int y){
|
||||||
return paths[Team.red.ordinal()].weights[x][y];
|
return paths[Team.blue.ordinal()].weights[x][y];
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getValueforTeam(Team team, int x, int y){
|
public float getValueforTeam(Team team, int x, int y){
|
||||||
|
@ -22,6 +22,7 @@ public class Mechs implements ContentList{
|
|||||||
alpha = new Mech("alpha-mech", false){{
|
alpha = new Mech("alpha-mech", false){{
|
||||||
drillPower = 1;
|
drillPower = 1;
|
||||||
speed = 0.5f;
|
speed = 0.5f;
|
||||||
|
boostSpeed = 0.85f;
|
||||||
weapon = Weapons.blaster;
|
weapon = Weapons.blaster;
|
||||||
trailColor = Palette.lightTrail;
|
trailColor = Palette.lightTrail;
|
||||||
maxSpeed = 4f;
|
maxSpeed = 4f;
|
||||||
@ -30,7 +31,7 @@ public class Mechs implements ContentList{
|
|||||||
delta = new Mech("delta-mech", false){{
|
delta = new Mech("delta-mech", false){{
|
||||||
drillPower = -1;
|
drillPower = -1;
|
||||||
speed = 0.75f;
|
speed = 0.75f;
|
||||||
boostSpeed = 0.86f;
|
boostSpeed = 0.95f;
|
||||||
itemCapacity = 15;
|
itemCapacity = 15;
|
||||||
armor = 30f;
|
armor = 30f;
|
||||||
weaponOffsetX = -1;
|
weaponOffsetX = -1;
|
||||||
|
@ -135,15 +135,15 @@ public class Recipes implements ContentList{
|
|||||||
new Recipe(units, UnitBlocks.dronePad, new ItemStack(Items.tungsten, 50), new ItemStack(Items.lead, 90), new ItemStack(Items.silicon, 90));
|
new Recipe(units, UnitBlocks.dronePad, new ItemStack(Items.tungsten, 50), new ItemStack(Items.lead, 90), new ItemStack(Items.silicon, 90));
|
||||||
new Recipe(units, UnitBlocks.fabricatorPad, new ItemStack(Items.carbide, 70), new ItemStack(Items.thorium, 60), new ItemStack(Items.lead, 90), new ItemStack(Items.silicon, 200));
|
new Recipe(units, UnitBlocks.fabricatorPad, new ItemStack(Items.carbide, 70), new ItemStack(Items.thorium, 60), new ItemStack(Items.lead, 90), new ItemStack(Items.silicon, 200));
|
||||||
|
|
||||||
new Recipe(units, UnitBlocks.daggerPad, new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 70));
|
new Recipe(units, UnitBlocks.daggerPad, new ItemStack(Items.lead, 60), new ItemStack(Items.silicon, 40));
|
||||||
new Recipe(units, UnitBlocks.titanPad, new ItemStack(Items.thorium, 90), new ItemStack(Items.lead, 140), new ItemStack(Items.silicon, 100));
|
new Recipe(units, UnitBlocks.titanPad, new ItemStack(Items.thorium, 90), new ItemStack(Items.lead, 140), new ItemStack(Items.silicon, 90));
|
||||||
|
|
||||||
new Recipe(units, UnitBlocks.interceptorPad, new ItemStack(Items.titanium, 40), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 90));
|
new Recipe(units, UnitBlocks.interceptorPad, new ItemStack(Items.titanium, 40), new ItemStack(Items.lead, 70), new ItemStack(Items.silicon, 80));
|
||||||
new Recipe(units, UnitBlocks.monsoonPad, new ItemStack(Items.plastanium, 70), new ItemStack(Items.titanium, 100), new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 220));
|
new Recipe(units, UnitBlocks.monsoonPad, new ItemStack(Items.plastanium, 70), new ItemStack(Items.titanium, 100), new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 220));
|
||||||
|
|
||||||
new Recipe(units, UnitBlocks.repairPoint, new ItemStack(Items.lead, 30), new ItemStack(Items.tungsten, 30), new ItemStack(Items.silicon, 30));
|
new Recipe(units, UnitBlocks.repairPoint, new ItemStack(Items.lead, 30), new ItemStack(Items.tungsten, 30), new ItemStack(Items.silicon, 30));
|
||||||
new Recipe(units, UnitBlocks.resupplyPoint, new ItemStack(Items.lead, 30), new ItemStack(Items.tungsten, 30), new ItemStack(Items.silicon, 30));
|
new Recipe(units, UnitBlocks.resupplyPoint, new ItemStack(Items.lead, 30), new ItemStack(Items.tungsten, 30), new ItemStack(Items.silicon, 30));
|
||||||
new Recipe(units, UnitBlocks.commandCenter, new ItemStack(Items.lead, 100), new ItemStack(Items.carbide, 140), new ItemStack(Items.silicon, 250));
|
new Recipe(units, UnitBlocks.commandCenter, new ItemStack(Items.lead, 100), new ItemStack(Items.carbide, 100), new ItemStack(Items.silicon, 200));
|
||||||
|
|
||||||
//LIQUIDS
|
//LIQUIDS
|
||||||
new Recipe(liquid, LiquidBlocks.conduit, new ItemStack(Items.lead, 1))
|
new Recipe(liquid, LiquidBlocks.conduit, new ItemStack(Items.lead, 1))
|
||||||
|
@ -67,8 +67,8 @@ public class CraftingBlocks extends BlockList implements ContentList{
|
|||||||
craftEffect = BlockFx.formsmoke;
|
craftEffect = BlockFx.formsmoke;
|
||||||
updateEffect = BlockFx.plasticburn;
|
updateEffect = BlockFx.plasticburn;
|
||||||
|
|
||||||
consumes.liquid(Liquids.oil, 0.3f);
|
consumes.liquid(Liquids.oil, 0.25f);
|
||||||
consumes.power(0.4f);
|
consumes.power(0.25f);
|
||||||
consumes.item(Items.titanium, 2);
|
consumes.item(Items.titanium, 2);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
@ -18,27 +18,27 @@ public class ProductionBlocks extends BlockList implements ContentList{
|
|||||||
public void load(){
|
public void load(){
|
||||||
tungstenDrill = new Drill("tungsten-drill"){{
|
tungstenDrill = new Drill("tungsten-drill"){{
|
||||||
tier = 2;
|
tier = 2;
|
||||||
drillTime = 340;
|
drillTime = 300;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
carbideDrill = new Drill("carbide-drill"){{
|
carbideDrill = new Drill("carbide-drill"){{
|
||||||
tier = 3;
|
tier = 3;
|
||||||
drillTime = 280;
|
drillTime = 240;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
laserdrill = new Drill("laser-drill"){{
|
laserdrill = new Drill("laser-drill"){{
|
||||||
drillTime = 180;
|
drillTime = 140;
|
||||||
size = 2;
|
size = 2;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
tier = 4;
|
tier = 4;
|
||||||
updateEffect = BlockFx.pulverizeMedium;
|
updateEffect = BlockFx.pulverizeMedium;
|
||||||
drillEffect = BlockFx.mineBig;
|
drillEffect = BlockFx.mineBig;
|
||||||
|
|
||||||
consumes.power(0.2f);
|
consumes.power(0.16f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
blastdrill = new Drill("blast-drill"){{
|
blastdrill = new Drill("blast-drill"){{
|
||||||
drillTime = 120;
|
drillTime = 60;
|
||||||
size = 3;
|
size = 3;
|
||||||
drawRim = true;
|
drawRim = true;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
@ -49,12 +49,12 @@ public class ProductionBlocks extends BlockList implements ContentList{
|
|||||||
rotateSpeed = 6f;
|
rotateSpeed = 6f;
|
||||||
warmupSpeed = 0.01f;
|
warmupSpeed = 0.01f;
|
||||||
|
|
||||||
consumes.power(0.5f);
|
consumes.power(0.3f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
plasmadrill = new Drill("plasma-drill"){{
|
plasmadrill = new Drill("plasma-drill"){{
|
||||||
heatColor = Color.valueOf("ff461b");
|
heatColor = Color.valueOf("ff461b");
|
||||||
drillTime = 90;
|
drillTime = 50;
|
||||||
size = 4;
|
size = 4;
|
||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
@ -89,8 +89,8 @@ public class ProductionBlocks extends BlockList implements ContentList{
|
|||||||
liquidCapacity = 30f;
|
liquidCapacity = 30f;
|
||||||
|
|
||||||
consumes.item(Items.sand);
|
consumes.item(Items.sand);
|
||||||
consumes.power(0.5f);
|
consumes.power(0.3f);
|
||||||
consumes.liquid(Liquids.water, 0.3f);
|
consumes.liquid(Liquids.water, 0.15f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
cultivator = new Cultivator("cultivator"){{
|
cultivator = new Cultivator("cultivator"){{
|
||||||
|
@ -16,7 +16,7 @@ public class UnitBlocks extends BlockList implements ContentList{
|
|||||||
public void load(){
|
public void load(){
|
||||||
dronePad = new UnitPad("drone-pad"){{
|
dronePad = new UnitPad("drone-pad"){{
|
||||||
type = UnitTypes.drone;
|
type = UnitTypes.drone;
|
||||||
produceTime = 800;
|
produceTime = 3000;
|
||||||
size = 2;
|
size = 2;
|
||||||
consumes.power(0.08f);
|
consumes.power(0.08f);
|
||||||
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 30), new ItemStack(Items.lead, 30)});
|
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 30), new ItemStack(Items.lead, 30)});
|
||||||
@ -24,7 +24,7 @@ public class UnitBlocks extends BlockList implements ContentList{
|
|||||||
|
|
||||||
fabricatorPad = new UnitPad("fabricator-pad"){{
|
fabricatorPad = new UnitPad("fabricator-pad"){{
|
||||||
type = UnitTypes.fabricator;
|
type = UnitTypes.fabricator;
|
||||||
produceTime = 1400;
|
produceTime = 5000;
|
||||||
size = 2;
|
size = 2;
|
||||||
consumes.power(0.2f);
|
consumes.power(0.2f);
|
||||||
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 70), new ItemStack(Items.lead, 80), new ItemStack(Items.titanium, 80)});
|
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 70), new ItemStack(Items.lead, 80), new ItemStack(Items.titanium, 80)});
|
||||||
@ -34,8 +34,8 @@ public class UnitBlocks extends BlockList implements ContentList{
|
|||||||
type = UnitTypes.interceptor;
|
type = UnitTypes.interceptor;
|
||||||
produceTime = 900;
|
produceTime = 900;
|
||||||
size = 2;
|
size = 2;
|
||||||
consumes.power(0.08f);
|
consumes.power(0.07f);
|
||||||
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 20), new ItemStack(Items.titanium, 10)});
|
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 10), new ItemStack(Items.titanium, 10)});
|
||||||
}};
|
}};
|
||||||
|
|
||||||
monsoonPad = new UnitPad("monsoon-pad"){{
|
monsoonPad = new UnitPad("monsoon-pad"){{
|
||||||
@ -44,15 +44,15 @@ public class UnitBlocks extends BlockList implements ContentList{
|
|||||||
size = 3;
|
size = 3;
|
||||||
consumes.power(0.14f);
|
consumes.power(0.14f);
|
||||||
shadow = "shadow-round-3";
|
shadow = "shadow-round-3";
|
||||||
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 30), new ItemStack(Items.titanium, 30), new ItemStack(Items.plastanium, 20)});
|
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 30), new ItemStack(Items.titanium, 30), new ItemStack(Items.plastanium, 10)});
|
||||||
}};
|
}};
|
||||||
|
|
||||||
daggerPad = new UnitPad("dagger-pad"){{
|
daggerPad = new UnitPad("dagger-pad"){{
|
||||||
type = UnitTypes.dagger;
|
type = UnitTypes.dagger;
|
||||||
produceTime = 500;
|
produceTime = 400;
|
||||||
size = 2;
|
size = 2;
|
||||||
consumes.power(0.06f);
|
consumes.power(0.05f);
|
||||||
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 10), new ItemStack(Items.tungsten, 20)});
|
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 5), new ItemStack(Items.tungsten, 10)});
|
||||||
}};
|
}};
|
||||||
|
|
||||||
titanPad = new UnitPad("titan-pad"){{
|
titanPad = new UnitPad("titan-pad"){{
|
||||||
@ -61,7 +61,7 @@ public class UnitBlocks extends BlockList implements ContentList{
|
|||||||
size = 3;
|
size = 3;
|
||||||
consumes.power(0.15f);
|
consumes.power(0.15f);
|
||||||
shadow = "shadow-round-3";
|
shadow = "shadow-round-3";
|
||||||
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 20), new ItemStack(Items.tungsten, 30), new ItemStack(Items.thorium, 30)});
|
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 20), new ItemStack(Items.thorium, 30)});
|
||||||
}};
|
}};
|
||||||
|
|
||||||
resupplyPoint = new ResupplyPoint("resupply-point"){{
|
resupplyPoint = new ResupplyPoint("resupply-point"){{
|
||||||
|
@ -43,7 +43,7 @@ public class UnitType implements UnlockableContent{
|
|||||||
public float retreatPercent = 0.2f;
|
public float retreatPercent = 0.2f;
|
||||||
public float armor = 0f;
|
public float armor = 0f;
|
||||||
public float carryWeight = 1f;
|
public float carryWeight = 1f;
|
||||||
public int ammoCapacity = 220;
|
public int ammoCapacity = 200;
|
||||||
public int itemCapacity = 30;
|
public int itemCapacity = 30;
|
||||||
public ObjectSet<Item> toMine = ObjectSet.with(Items.lead, Items.tungsten);
|
public ObjectSet<Item> toMine = ObjectSet.with(Items.lead, Items.tungsten);
|
||||||
public float buildPower = 0.3f, minePower = 0.7f, healSpeed = 0.1f;
|
public float buildPower = 0.3f, minePower = 0.7f, healSpeed = 0.1f;
|
||||||
|
@ -10,6 +10,7 @@ import io.anuke.mindustry.entities.traits.BuilderTrait;
|
|||||||
import io.anuke.mindustry.entities.traits.TargetTrait;
|
import io.anuke.mindustry.entities.traits.TargetTrait;
|
||||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||||
import io.anuke.mindustry.entities.units.FlyingUnit;
|
import io.anuke.mindustry.entities.units.FlyingUnit;
|
||||||
|
import io.anuke.mindustry.entities.units.UnitCommand;
|
||||||
import io.anuke.mindustry.entities.units.UnitState;
|
import io.anuke.mindustry.entities.units.UnitState;
|
||||||
import io.anuke.mindustry.game.EventType.BlockBuildEvent;
|
import io.anuke.mindustry.game.EventType.BlockBuildEvent;
|
||||||
import io.anuke.mindustry.gen.Call;
|
import io.anuke.mindustry.gen.Call;
|
||||||
@ -294,6 +295,11 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCommand(UnitCommand command){
|
||||||
|
//no
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getBuildPower(Tile tile){
|
public float getBuildPower(Tile tile){
|
||||||
return type.buildPower;
|
return type.buildPower;
|
||||||
|
@ -15,6 +15,7 @@ import io.anuke.mindustry.graphics.Palette;
|
|||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
import io.anuke.mindustry.world.meta.BlockGroup;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.graphics.CapStyle;
|
import io.anuke.ucore.graphics.CapStyle;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
@ -49,6 +50,7 @@ public class ItemBridge extends Block{
|
|||||||
itemCapacity = 10;
|
itemCapacity = 10;
|
||||||
configurable = true;
|
configurable = true;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
|
group = BlockGroup.transportation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Remote(targets = Loc.both, called = Loc.both, forward = true)
|
@Remote(targets = Loc.both, called = Loc.both, forward = true)
|
||||||
|
@ -4,6 +4,7 @@ import com.badlogic.gdx.utils.IntSet.IntSetIterator;
|
|||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.type.Liquid;
|
import io.anuke.mindustry.type.Liquid;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
import io.anuke.mindustry.world.meta.BlockGroup;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
@ -16,6 +17,7 @@ public class LiquidBridge extends ItemBridge{
|
|||||||
hasItems = false;
|
hasItems = false;
|
||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
outputsLiquid = true;
|
outputsLiquid = true;
|
||||||
|
group = BlockGroup.liquids;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -4,6 +4,7 @@ import com.badlogic.gdx.utils.IntSet.IntSetIterator;
|
|||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.type.Liquid;
|
import io.anuke.mindustry.type.Liquid;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
import io.anuke.mindustry.world.meta.BlockGroup;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
@ -16,6 +17,7 @@ public class LiquidExtendingBridge extends ExtendingItemBridge{
|
|||||||
hasItems = false;
|
hasItems = false;
|
||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
outputsLiquid = true;
|
outputsLiquid = true;
|
||||||
|
group = BlockGroup.liquids;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -23,6 +23,10 @@ import io.anuke.ucore.scene.ui.ImageButton;
|
|||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.util.EnumSet;
|
import io.anuke.ucore.util.EnumSet;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class CommandCenter extends Block{
|
public class CommandCenter extends Block{
|
||||||
@ -106,5 +110,15 @@ public class CommandCenter extends Block{
|
|||||||
|
|
||||||
public class CommandCenterEntity extends TileEntity{
|
public class CommandCenterEntity extends TileEntity{
|
||||||
public UnitCommand command = UnitCommand.idle;
|
public UnitCommand command = UnitCommand.idle;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream stream) throws IOException{
|
||||||
|
stream.writeByte(command.ordinal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(DataInputStream stream) throws IOException{
|
||||||
|
command = UnitCommand.values()[stream.readByte()];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,9 @@ import java.io.DataOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class UnitPad extends Block{
|
public class UnitPad extends Block{
|
||||||
protected float gracePeriodMultiplier = 10f;
|
protected float gracePeriodMultiplier = 15f;
|
||||||
|
protected float speedupTime = 60f * 60f * 16;
|
||||||
|
|
||||||
protected UnitType type;
|
protected UnitType type;
|
||||||
protected float produceTime = 1000f;
|
protected float produceTime = 1000f;
|
||||||
protected float openDuration = 50f;
|
protected float openDuration = 50f;
|
||||||
@ -48,7 +50,7 @@ public class UnitPad extends Block{
|
|||||||
update = true;
|
update = true;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
solidifes = true;
|
solid = false;
|
||||||
itemCapacity = 10;
|
itemCapacity = 10;
|
||||||
|
|
||||||
consumes.require(ConsumeItems.class);
|
consumes.require(ConsumeItems.class);
|
||||||
@ -60,7 +62,6 @@ public class UnitPad extends Block{
|
|||||||
UnitPad factory = (UnitPad) tile.block();
|
UnitPad factory = (UnitPad) tile.block();
|
||||||
|
|
||||||
entity.buildTime = 0f;
|
entity.buildTime = 0f;
|
||||||
entity.hasSpawned = true;
|
|
||||||
|
|
||||||
Effects.shake(2f, 3f, entity);
|
Effects.shake(2f, 3f, entity);
|
||||||
Effects.effect(BlockFx.producesmoke, tile.drawx(), tile.drawy());
|
Effects.effect(BlockFx.producesmoke, tile.drawx(), tile.drawy());
|
||||||
@ -73,12 +74,10 @@ public class UnitPad extends Block{
|
|||||||
unit.getVelocity().y = factory.launchVelocity;
|
unit.getVelocity().y = factory.launchVelocity;
|
||||||
|
|
||||||
//fill inventory with 1st ammo
|
//fill inventory with 1st ammo
|
||||||
if(tile.getTeam() == Team.red){
|
|
||||||
AmmoType type = unit.getWeapon().getAmmoType(unit.getWeapon().getAcceptedItems().iterator().next());
|
AmmoType type = unit.getWeapon().getAmmoType(unit.getWeapon().getAcceptedItems().iterator().next());
|
||||||
unit.inventory.fillAmmo(type);
|
unit.inventory.fillAmmo(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean outputsItems(){
|
public boolean outputsItems(){
|
||||||
@ -92,12 +91,6 @@ public class UnitPad extends Block{
|
|||||||
stats.add(BlockStat.craftSpeed, produceTime / 60f, StatUnit.seconds);
|
stats.add(BlockStat.craftSpeed, produceTime / 60f, StatUnit.seconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSolidFor(Tile tile){
|
|
||||||
UnitFactoryEntity entity = tile.entity();
|
|
||||||
return type.isFlying || !entity.open;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBars(){
|
public void setBars(){
|
||||||
super.setBars();
|
super.setBars();
|
||||||
@ -143,7 +136,7 @@ public class UnitPad extends Block{
|
|||||||
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|
||||||
Draw.rect(name + (entity.open || entity.hasSpawned ? "-top-open" : "-top"), tile.drawx(), tile.drawy());
|
Draw.rect(name, tile.drawx(), tile.drawy());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -157,7 +150,6 @@ public class UnitPad extends Block{
|
|||||||
entity.openCountdown -= Timers.delta();
|
entity.openCountdown -= Timers.delta();
|
||||||
}else{
|
}else{
|
||||||
if(type.isFlying || !Units.anyEntities(tile)){
|
if(type.isFlying || !Units.anyEntities(tile)){
|
||||||
entity.open = false;
|
|
||||||
entity.openCountdown = -1;
|
entity.openCountdown = -1;
|
||||||
}else{
|
}else{
|
||||||
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 0f, 0.1f);
|
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 0f, 0.1f);
|
||||||
@ -174,25 +166,24 @@ public class UnitPad extends Block{
|
|||||||
if(!isEnemy){
|
if(!isEnemy){
|
||||||
//player-made spawners have default behavior
|
//player-made spawners have default behavior
|
||||||
|
|
||||||
if(!entity.hasSpawned && hasRequirements(entity.items, entity.buildTime / produceTime) &&
|
if(hasRequirements(entity.items, entity.buildTime / produceTime) && entity.cons.valid()){
|
||||||
entity.cons.valid() && !entity.open){
|
|
||||||
|
|
||||||
entity.buildTime += Timers.delta();
|
entity.buildTime += Timers.delta();
|
||||||
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 1f, 0.05f);
|
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 1f, 0.05f);
|
||||||
}else{
|
}else{
|
||||||
if(!entity.open) entity.speedScl = Mathf.lerpDelta(entity.speedScl, 0f, 0.05f);
|
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 0f, 0.05f);
|
||||||
}
|
}
|
||||||
//check if grace period had passed
|
//check if grace period had passed
|
||||||
}else if(!entity.hasSpawned && entity.warmup > produceTime*gracePeriodMultiplier){
|
}else if(entity.warmup > produceTime*gracePeriodMultiplier){
|
||||||
|
float speedMultiplier = Math.min(0.1f + (entity.warmup - produceTime * gracePeriodMultiplier) / speedupTime, 4f);
|
||||||
//otherwise, it's an enemy, cheat by not requiring resources
|
//otherwise, it's an enemy, cheat by not requiring resources
|
||||||
entity.buildTime += Timers.delta() / 4f;
|
entity.buildTime += Timers.delta() * speedMultiplier;
|
||||||
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 1f, 0.05f);
|
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 1f, 0.05f);
|
||||||
}else{
|
}else{
|
||||||
if(!entity.open) entity.speedScl = Mathf.lerpDelta(entity.speedScl, 0f, 0.05f);
|
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 0f, 0.05f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(entity.buildTime >= produceTime && !entity.open){
|
if(entity.buildTime >= produceTime){
|
||||||
entity.open = true;
|
|
||||||
|
|
||||||
Timers.run(openDuration / 1.5f, () -> Call.onUnitFactorySpawn(tile));
|
Timers.run(openDuration / 1.5f, () -> Call.onUnitFactorySpawn(tile));
|
||||||
useContent(type);
|
useContent(type);
|
||||||
@ -241,25 +232,21 @@ public class UnitPad extends Block{
|
|||||||
|
|
||||||
public static class UnitFactoryEntity extends TileEntity{
|
public static class UnitFactoryEntity extends TileEntity{
|
||||||
public float buildTime;
|
public float buildTime;
|
||||||
public boolean open;
|
|
||||||
public float openCountdown;
|
public float openCountdown;
|
||||||
public float time;
|
public float time;
|
||||||
public float speedScl;
|
public float speedScl;
|
||||||
public boolean hasSpawned;
|
|
||||||
public float warmup; //only for enemy spawners
|
public float warmup; //only for enemy spawners
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(DataOutputStream stream) throws IOException{
|
public void write(DataOutputStream stream) throws IOException{
|
||||||
stream.writeFloat(buildTime);
|
stream.writeFloat(buildTime);
|
||||||
stream.writeFloat(warmup);
|
stream.writeFloat(warmup);
|
||||||
stream.writeBoolean(hasSpawned);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(DataInputStream stream) throws IOException{
|
public void read(DataInputStream stream) throws IOException{
|
||||||
buildTime = stream.readFloat();
|
buildTime = stream.readFloat();
|
||||||
warmup = stream.readFloat();
|
warmup = stream.readFloat();
|
||||||
hasSpawned = stream.readBoolean();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user