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