mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-10 07:47:25 +07:00
"fixes"
This commit is contained in:
@ -58,7 +58,7 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
||||
|
||||
if(core == null) return;
|
||||
|
||||
if((entity.progress() < 1f || entity.progress() > 0f) && entity.tile.block() instanceof BuildBlock){ //building is valid
|
||||
if((entity.progress() < 1f || entity.progress() > 0f) && entity.block instanceof BuildBlock){ //building is valid
|
||||
if(!isBuilding() && dst(target) < placeDistance * 0.9f){ //within distance, begin placing
|
||||
if(isBreaking){
|
||||
getPlaceQueue().addLast(new BuildRequest(entity.tile.x, entity.tile.y));
|
||||
@ -127,7 +127,7 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
||||
}
|
||||
|
||||
//core full
|
||||
if(targetItem != null && entity.tile.block().acceptStack(targetItem, 1, entity.tile, Drone.this) == 0){
|
||||
if(targetItem != null && entity.block.acceptStack(targetItem, 1, entity.tile, Drone.this) == 0){
|
||||
setState(repair);
|
||||
return;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class ImpactReactor extends PowerGenerator{
|
||||
|
||||
bars.add("poweroutput", entity -> new Bar(() ->
|
||||
Core.bundle.format("bar.poweroutput",
|
||||
Strings.fixed(Math.max(entity.tile.block().getPowerProduction(entity.tile) - consumes.getPower().powerPerTick, 0)*60 * entity.delta(), 1)),
|
||||
Strings.fixed(Math.max(entity.block.getPowerProduction(entity.tile) - consumes.getPower().powerPerTick, 0)*60 * entity.delta(), 1)),
|
||||
() -> Pal.powerBar,
|
||||
() -> ((GeneratorEntity)entity).productionEfficiency));
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class PowerGenerator extends PowerDistributor{
|
||||
if(hasPower && outputsPower && !consumes.hasPower()){
|
||||
bars.add("power", entity -> new Bar(() ->
|
||||
Core.bundle.format("bar.poweroutput",
|
||||
Strings.fixed(entity.tile.block().getPowerProduction(entity.tile)*60 * entity.timeScale, 1)),
|
||||
Strings.fixed(entity.block.getPowerProduction(entity.tile)*60 * entity.timeScale, 1)),
|
||||
() -> Pal.powerBar,
|
||||
() -> ((GeneratorEntity)entity).productionEfficiency));
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ public class GenericCrafter extends Block{
|
||||
super(name);
|
||||
update = true;
|
||||
solid = true;
|
||||
hasItems = true;
|
||||
health = 60;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.world.modules;
|
||||
|
||||
import io.anuke.arc.util.Log;
|
||||
import io.anuke.mindustry.entities.type.TileEntity;
|
||||
import io.anuke.mindustry.world.consumers.Consume;
|
||||
|
||||
@ -19,9 +20,12 @@ public class ConsumeModule extends BlockModule{
|
||||
boolean prevValid = valid();
|
||||
valid = true;
|
||||
optionalValid = true;
|
||||
boolean docons = entity.tile.block().shouldConsume(entity.tile);
|
||||
boolean docons = entity.block.shouldConsume(entity.tile);
|
||||
|
||||
for(Consume cons : entity.tile.block().consumes.all()){
|
||||
Log.info("update begin: is valid");
|
||||
|
||||
for(Consume cons : entity.block.consumes.all()){
|
||||
Log.info("check cons {1}: {0}", cons, cons.valid(entity));
|
||||
if(docons && cons.isUpdate() && prevValid && cons.valid(entity)){
|
||||
cons.update(entity);
|
||||
}
|
||||
@ -31,7 +35,7 @@ public class ConsumeModule extends BlockModule{
|
||||
}
|
||||
}
|
||||
|
||||
for(Consume cons : entity.tile.block().consumes.optionals()){
|
||||
for(Consume cons : entity.block.consumes.optionals()){
|
||||
if(docons && cons.isUpdate() && prevValid && cons.valid(entity)){
|
||||
cons.update(entity);
|
||||
}
|
||||
@ -41,13 +45,13 @@ public class ConsumeModule extends BlockModule{
|
||||
}
|
||||
|
||||
public void trigger(){
|
||||
for(Consume cons : entity.tile.block().consumes.all()){
|
||||
for(Consume cons : entity.block.consumes.all()){
|
||||
cons.trigger(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean valid(){
|
||||
return valid && entity.tile.block().canProduce(entity.tile);
|
||||
return valid && entity.block.canProduce(entity.tile);
|
||||
}
|
||||
|
||||
public boolean optionalValid(){
|
||||
|
Reference in New Issue
Block a user