Tungsten walls
This commit is contained in:
@@ -134,6 +134,8 @@ public class Block extends UnlockableContent{
|
||||
public Attributes attributes = new Attributes();
|
||||
/** tile entity health */
|
||||
public int health = -1;
|
||||
/** damage absorption, similar to unit armor */
|
||||
public float armor = 0f;
|
||||
/** base block explosiveness */
|
||||
public float baseExplosiveness = 0f;
|
||||
/** bullet that this block spawns when destroyed */
|
||||
@@ -429,6 +431,9 @@ public class Block extends UnlockableContent{
|
||||
|
||||
if(synthetic()){
|
||||
stats.add(Stat.health, health, StatUnit.none);
|
||||
if(armor > 0){
|
||||
stats.add(Stat.armor, armor, StatUnit.none);
|
||||
}
|
||||
}
|
||||
|
||||
if(canBeBuilt() && requirements.length > 0){
|
||||
|
||||
@@ -3,6 +3,7 @@ package mindustry.world.blocks.units;
|
||||
import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import arc.util.io.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
@@ -20,8 +21,12 @@ import static mindustry.Vars.*;
|
||||
* */
|
||||
public class UnitAssembler extends PayloadBlock{
|
||||
public int areaSize = 10;
|
||||
public UnitType unitType;
|
||||
public int unitsCreated = 4;
|
||||
public UnitType droneType;
|
||||
public int dronesCreated = 4;
|
||||
|
||||
//TODO should be different for every tier.
|
||||
public Seq<BlockStack> requirements = new Seq<>();
|
||||
public UnitType output = UnitTypes.vanquish;
|
||||
|
||||
public UnitAssembler(String name){
|
||||
super(name);
|
||||
@@ -47,17 +52,19 @@ public class UnitAssembler extends PayloadBlock{
|
||||
Drawf.dashRect(valid ? Pal.accent : Pal.remove, Tmp.r1);
|
||||
}
|
||||
|
||||
public class UnitAssemblerBuild extends PayloadBlockBuild<Payload>{
|
||||
public class UnitAssemblerBuild extends PayloadBlockBuild<BuildPayload>{
|
||||
public Seq<Unit> units = new Seq<>();
|
||||
public Seq<BuildPayload> payloads = new Seq<>();
|
||||
|
||||
//TODO how should payloads be stored? counts of blocks? intmap? references?
|
||||
//public Seq<BuildPayload> payloads = new Seq<>();
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
units.removeAll(u -> !u.isAdded() || u.dead);
|
||||
|
||||
if(consValid() && units.size < unitsCreated){
|
||||
if(consValid() && units.size < dronesCreated){
|
||||
//TODO build animation? distribute spawning?
|
||||
var unit = unitType.create(team);
|
||||
var unit = droneType.create(team);
|
||||
if(unit instanceof BuildingTetherc bt){
|
||||
bt.building(this);
|
||||
}
|
||||
@@ -69,12 +76,29 @@ public class UnitAssembler extends PayloadBlock{
|
||||
units.add(unit);
|
||||
}
|
||||
|
||||
//TODO drones need to indicate that they are in position
|
||||
//TODO drones need to indicate that they are in position and actually play an animation
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePayload(Building source, Payload payload){
|
||||
//super.handlePayload(source, payload);
|
||||
|
||||
//payloads.add((BuildPayload)payload);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptPayload(Building source, Payload payload){
|
||||
return super.acceptPayload(source, payload);
|
||||
return payload instanceof BuildPayload bp && requirements.contains(b -> b.block == bp.block());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Writes write){
|
||||
super.write(write);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(Reads read, byte revision){
|
||||
super.read(read, revision);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user