AI tweaks / Control tweaks / Plastanium conveyor tweaks / Unit factories
This commit is contained in:
@@ -71,6 +71,8 @@ public class Block extends UnlockableContent{
|
||||
public boolean breakable;
|
||||
/** whether to add this block to brokenblocks */
|
||||
public boolean rebuildable = true;
|
||||
/** whether this water can only be placed on water */
|
||||
public boolean requiresWater = false;
|
||||
/** whether this floor can be placed on. */
|
||||
public boolean placeableOn = true;
|
||||
/** whether this block has insulating properties. */
|
||||
|
||||
@@ -106,9 +106,13 @@ public class Build{
|
||||
for(int dx = 0; dx < type.size; dx++){
|
||||
for(int dy = 0; dy < type.size; dy++){
|
||||
Tile other = world.tile(x + dx + offsetx, y + dy + offsety);
|
||||
if(other == null || (other.block() != Blocks.air && !other.block().alwaysReplace) ||
|
||||
!other.floor().placeableOn ||
|
||||
(other.floor().isDeep() && !type.floating)){
|
||||
if(
|
||||
other == null ||
|
||||
(other.block() != Blocks.air && !other.block().alwaysReplace) ||
|
||||
!other.floor().placeableOn ||
|
||||
(other.floor().isDeep() && !type.floating && !type.requiresWater) ||
|
||||
(type.requiresWater && tile.floor().liquidDrop != Liquids.water)
|
||||
){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -116,12 +120,13 @@ public class Build{
|
||||
return true;
|
||||
}else{
|
||||
return tile.interactable(team)
|
||||
&& contactsGround(tile.x, tile.y, type)
|
||||
&& (!tile.floor().isDeep() || type.floating)
|
||||
&& tile.floor().placeableOn
|
||||
&& (((type.canReplace(tile.block()) || (tile.block instanceof BuildBlock && tile.<BuildEntity>ent().cblock == type))
|
||||
&& !(type == tile.block() && rotation == tile.rotation() && type.rotate)) || tile.block().alwaysReplace || tile.block() == Blocks.air)
|
||||
&& tile.block().isMultiblock() == type.isMultiblock() && type.canPlaceOn(tile);
|
||||
&& contactsGround(tile.x, tile.y, type)
|
||||
&& (!tile.floor().isDeep() || type.floating || type.requiresWater)
|
||||
&& tile.floor().placeableOn
|
||||
&& (!type.requiresWater || tile.floor().liquidDrop == Liquids.water)
|
||||
&& (((type.canReplace(tile.block()) || (tile.block instanceof BuildBlock && tile.<BuildEntity>ent().cblock == type))
|
||||
&& !(type == tile.block() && rotation == tile.rotation() && type.rotate)) || tile.block().alwaysReplace || tile.block() == Blocks.air)
|
||||
&& tile.block().isMultiblock() == type.isMultiblock() && type.canPlaceOn(tile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ public class OverdriveProjector extends Block{
|
||||
float realBoost = (speedBoost + phaseHeat * speedBoostPhase) * efficiency();
|
||||
|
||||
charge = 0f;
|
||||
indexer.eachBlock(this, realRange, other -> other.timeScale() < realBoost, other -> other.applyBoost(realBoost, reload + 1f));
|
||||
indexer.eachBlock(this, realRange, other -> true, other -> other.applyBoost(realBoost, reload + 1f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public class StackConveyor extends Block implements Autotiler{
|
||||
update = true;
|
||||
group = BlockGroup.transportation;
|
||||
hasItems = true;
|
||||
itemCapacity = 8;
|
||||
itemCapacity = 10;
|
||||
conveyorPlacement = true;
|
||||
|
||||
idleSound = Sounds.conveyor;
|
||||
@@ -166,7 +166,7 @@ public class StackConveyor extends Block implements Autotiler{
|
||||
@Override
|
||||
public void updateTile(){
|
||||
// reel in crater
|
||||
if(cooldown > 0f) cooldown = Mathf.clamp(cooldown - speed, 0f, recharge);
|
||||
if(cooldown > 0f) cooldown = Mathf.clamp(cooldown - speed * edelta(), 0f, recharge);
|
||||
|
||||
if(link == -1){
|
||||
return;
|
||||
@@ -207,11 +207,6 @@ public class StackConveyor extends Block implements Autotiler{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumAccepted(Item item){
|
||||
return Mathf.round(super.getMaximumAccepted(item) * timeScale); // increased item capacity while boosted
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldIdleSound(){
|
||||
return false; // has no moving parts;
|
||||
|
||||
@@ -23,7 +23,7 @@ import mindustry.world.meta.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class UnitFactory extends Block{
|
||||
public float launchVelocity = 0f;
|
||||
public float launchVelocity = 5f;
|
||||
public TextureRegion topRegion;
|
||||
public int[] capacities;
|
||||
|
||||
@@ -123,9 +123,11 @@ public class UnitFactory extends Block{
|
||||
if(!net.client() && currentPlan != -1){
|
||||
UnitPlan plan = plans[currentPlan];
|
||||
Unitc unit = plan.unit.create(team);
|
||||
unit.set(x + Mathf.range(4), y + Mathf.range(4));
|
||||
unit.set(x, y );
|
||||
unit.add();
|
||||
unit.vel().y = launchVelocity;
|
||||
unit.rotation(90);
|
||||
unit.vel().y = launchVelocity + Mathf.range(1f);
|
||||
unit.vel().x = Mathf.range(1f);
|
||||
Events.fire(new UnitCreateEvent(unit));
|
||||
}
|
||||
}
|
||||
|
||||
65
core/src/mindustry/world/consumers/ConsumeItemDynamic.java
Normal file
65
core/src/mindustry/world/consumers/ConsumeItemDynamic.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package mindustry.world.consumers;
|
||||
|
||||
import arc.func.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
//TODO
|
||||
public class ConsumeItemDynamic extends Consume{
|
||||
public final @NonNull Func<Tilec, ItemStack[]> items;
|
||||
|
||||
public ConsumeItemDynamic(Func<Tilec, ItemStack[]> items){
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyItemFilter(Bits filter){
|
||||
//this must be done dynamically
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConsumeType type(){
|
||||
return ConsumeType.item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(Tilec tile, Table table){
|
||||
for(ItemStack stack : items.get(tile)){
|
||||
table.add(new ReqImage(new ItemImage(stack.item.icon(Cicon.medium), stack.amount),
|
||||
() -> tile.items() != null && tile.items().has(stack.item, stack.amount))).size(8 * 4).padRight(5);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIcon(){
|
||||
return "icon-item";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tilec entity){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trigger(Tilec entity){
|
||||
for(ItemStack stack : items.get(entity)){
|
||||
entity.items().remove(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean valid(Tilec entity){
|
||||
return entity.items() != null && entity.items().has(items.get(entity));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display(BlockStats stats){
|
||||
//TODO
|
||||
//stats.add(booster ? BlockStat.booster : BlockStat.input, new ItemListValue(items));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user