mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-20 12:47:37 +07:00
Removed unit factory limit
This commit is contained in:
@ -1659,7 +1659,6 @@ public class Blocks implements ContentList{
|
||||
unitType = UnitTypes.draug;
|
||||
produceTime = 2500;
|
||||
size = 2;
|
||||
maxSpawn = 1;
|
||||
consumes.power(1.2f);
|
||||
consumes.items();
|
||||
}};
|
||||
@ -1669,7 +1668,6 @@ public class Blocks implements ContentList{
|
||||
unitType = UnitTypes.spirit;
|
||||
produceTime = 4000;
|
||||
size = 2;
|
||||
maxSpawn = 1;
|
||||
consumes.power(1.2f);
|
||||
consumes.items(new ItemStack(Items.silicon, 30), new ItemStack(Items.lead, 30));
|
||||
}};
|
||||
@ -1679,7 +1677,6 @@ public class Blocks implements ContentList{
|
||||
unitType = UnitTypes.phantom;
|
||||
produceTime = 4400;
|
||||
size = 2;
|
||||
maxSpawn = 1;
|
||||
consumes.power(2.5f);
|
||||
consumes.items(new ItemStack(Items.silicon, 50), new ItemStack(Items.lead, 30), new ItemStack(Items.titanium, 20));
|
||||
}};
|
||||
@ -1705,7 +1702,6 @@ public class Blocks implements ContentList{
|
||||
unitType = UnitTypes.ghoul;
|
||||
produceTime = 1150;
|
||||
size = 3;
|
||||
maxSpawn = 2;
|
||||
consumes.power(1.2f);
|
||||
consumes.items(new ItemStack(Items.silicon, 15), new ItemStack(Items.titanium, 10));
|
||||
}};
|
||||
@ -1715,7 +1711,6 @@ public class Blocks implements ContentList{
|
||||
unitType = UnitTypes.revenant;
|
||||
produceTime = 2000;
|
||||
size = 4;
|
||||
maxSpawn = 2;
|
||||
consumes.power(3f);
|
||||
consumes.items(new ItemStack(Items.silicon, 40), new ItemStack(Items.titanium, 30));
|
||||
}};
|
||||
@ -1734,7 +1729,6 @@ public class Blocks implements ContentList{
|
||||
unitType = UnitTypes.crawler;
|
||||
produceTime = 300;
|
||||
size = 2;
|
||||
maxSpawn = 6;
|
||||
consumes.power(0.5f);
|
||||
consumes.items(new ItemStack(Items.coal, 10));
|
||||
}};
|
||||
@ -1753,7 +1747,6 @@ public class Blocks implements ContentList{
|
||||
unitType = UnitTypes.fortress;
|
||||
produceTime = 2000;
|
||||
size = 3;
|
||||
maxSpawn = 3;
|
||||
consumes.power(1.4f);
|
||||
consumes.items(new ItemStack(Items.silicon, 20), new ItemStack(Items.graphite, 10));
|
||||
}};
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mindustry.type;
|
||||
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.ctype.*;
|
||||
|
||||
public abstract class Weather extends MappableContent{
|
||||
@ -19,4 +20,9 @@ public abstract class Weather extends MappableContent{
|
||||
}
|
||||
|
||||
//TODO implement
|
||||
|
||||
@Component
|
||||
class WeatherComp{
|
||||
Weather weather;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ public class UnitFactory extends Block{
|
||||
public float produceTime = 1000f;
|
||||
public float launchVelocity = 0f;
|
||||
public TextureRegion topRegion;
|
||||
public int maxSpawn = 4;
|
||||
public int[] capacities;
|
||||
|
||||
public UnitFactory(String name){
|
||||
@ -38,14 +37,13 @@ public class UnitFactory extends Block{
|
||||
}
|
||||
|
||||
@Remote(called = Loc.server)
|
||||
public static void onUnitFactorySpawn(Tile tile, int spawns){
|
||||
public static void onUnitFactorySpawn(Tile tile){
|
||||
if(!(tile.entity instanceof UnitFactoryEntity) || !(tile.block() instanceof UnitFactory)) return;
|
||||
|
||||
UnitFactory factory = (UnitFactory)tile.block();
|
||||
UnitFactoryEntity entity = tile.ent();
|
||||
|
||||
entity.buildTime = 0f;
|
||||
entity.spawned = spawns;
|
||||
|
||||
Effects.shake(2f, 3f, entity);
|
||||
Fx.producesmoke.at(entity);
|
||||
@ -83,7 +81,6 @@ public class UnitFactory extends Block{
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
bars.add("progress", entity -> new Bar("bar.progress", Pal.ammo, () -> ((UnitFactoryEntity)entity).buildTime / produceTime));
|
||||
bars.add("spawned", entity -> new Bar(() -> Core.bundle.format("bar.spawned", ((UnitFactoryEntity)entity).spawned, maxSpawn), () -> Pal.command, () -> (float)((UnitFactoryEntity)entity).spawned / maxSpawn));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -97,7 +94,6 @@ public class UnitFactory extends Block{
|
||||
|
||||
stats.remove(BlockStat.itemCapacity);
|
||||
stats.add(BlockStat.productionTime, produceTime / 60f, StatUnit.seconds);
|
||||
stats.add(BlockStat.maxUnits, maxSpawn, StatUnit.none);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -109,8 +105,7 @@ public class UnitFactory extends Block{
|
||||
float buildTime;
|
||||
float time;
|
||||
float speedScl;
|
||||
int spawned;
|
||||
|
||||
//int spawned;
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
@ -144,9 +139,6 @@ public class UnitFactory extends Block{
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
if(spawned >= maxSpawn){
|
||||
return;
|
||||
}
|
||||
|
||||
if(consValid() || tile.isEnemyCheat()){
|
||||
time += delta() * speedScl * Vars.state.rules.unitBuildSpeedMultiplier * efficiency();
|
||||
@ -159,7 +151,7 @@ public class UnitFactory extends Block{
|
||||
if(buildTime >= produceTime){
|
||||
buildTime = 0f;
|
||||
|
||||
Call.onUnitFactorySpawn(tile, spawned + 1);
|
||||
Call.onUnitFactorySpawn(tile);
|
||||
useContent(unitType);
|
||||
consume();
|
||||
}
|
||||
@ -171,22 +163,25 @@ public class UnitFactory extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldConsume(){
|
||||
return spawned < maxSpawn;
|
||||
public byte version(){
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Writes write){
|
||||
super.write(write);
|
||||
write.f(buildTime);
|
||||
write.i(spawned);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(Reads read, byte revision){
|
||||
super.read(read, revision);
|
||||
buildTime = read.f();
|
||||
spawned = read.i();
|
||||
|
||||
if(revision == 0){
|
||||
//spawn count
|
||||
read.i();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user