Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features
Conflicts: core/src/mindustry/content/Blocks.java
This commit is contained in:
@@ -45,7 +45,7 @@ public class Vars implements Loadable{
|
||||
/** Name of current Steam player. */
|
||||
public static String steamPlayerName = "";
|
||||
/** Default accessible content types used for player-selectable icons. */
|
||||
public static final ContentType[] defaultContentIcons = {ContentType.item, ContentType.liquid, ContentType.block};
|
||||
public static final ContentType[] defaultContentIcons = {ContentType.item, ContentType.liquid, ContentType.block, ContentType.unit};
|
||||
/** Wall darkness radius. */
|
||||
public static final int darkRadius = 4;
|
||||
/** Maximum extra padding around deployment schematics. */
|
||||
|
||||
@@ -755,8 +755,8 @@ public class Blocks implements ContentList{
|
||||
rotate = false;
|
||||
solid = true;
|
||||
outputsLiquid = true;
|
||||
drawer = new DrawMixer();
|
||||
envEnabled = Env.any;
|
||||
drawer = new DrawMixer(true);
|
||||
|
||||
consumes.power(1f);
|
||||
consumes.item(Items.titanium);
|
||||
|
||||
@@ -288,7 +288,7 @@ public class SectorInfo{
|
||||
public void eachImport(Planet planet, Cons<Sector> cons){
|
||||
for(Sector sector : planet.sectors){
|
||||
Sector dest = sector.info.getRealDestination();
|
||||
if(sector.hasBase() && sector.info != this && dest != null && dest.info == this){
|
||||
if(sector.hasBase() && sector.info != this && dest != null && dest.info == this && sector.info.anyExports()){
|
||||
cons.get(sector);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +77,8 @@ public class Trail{
|
||||
if(points.size >= 3){
|
||||
points.removeRange(0, 2);
|
||||
}
|
||||
|
||||
counter = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -715,6 +715,7 @@ public class LExecutor{
|
||||
if((base instanceof Building && timer.get(30f)) || (ai != null && ai.checkTargetTimer(this))){
|
||||
//if any of the targets involve enemies
|
||||
boolean enemies = target1 == RadarTarget.enemy || target2 == RadarTarget.enemy || target3 == RadarTarget.enemy;
|
||||
boolean allies = target1 == RadarTarget.ally || target2 == RadarTarget.ally || target3 == RadarTarget.ally;
|
||||
|
||||
best = null;
|
||||
bestValue = 0;
|
||||
@@ -726,6 +727,11 @@ public class LExecutor{
|
||||
find(r, range, sortDir, data.items[i].team);
|
||||
}
|
||||
}
|
||||
}else if(!allies){
|
||||
Seq<TeamData> data = state.teams.present;
|
||||
for(int i = 0; i < data.size; i++){
|
||||
find(r, range, sortDir, data.items[i].team);
|
||||
}
|
||||
}else{
|
||||
find(r, range, sortDir, r.team());
|
||||
}
|
||||
|
||||
@@ -686,7 +686,7 @@ public class UnitType extends UnlockableContent{
|
||||
}
|
||||
|
||||
public void drawControl(Unit unit){
|
||||
Draw.z(Layer.groundUnit - 2);
|
||||
Draw.z(unit.isFlying() ? Layer.flyingUnitLow : Layer.groundUnit - 2);
|
||||
|
||||
Draw.color(Pal.accent, Color.white, Mathf.absin(4f, 0.3f));
|
||||
Lines.poly(unit.x, unit.y, 4, unit.hitSize + 1.5f);
|
||||
|
||||
@@ -24,6 +24,8 @@ import mindustry.ui.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class JoinDialog extends BaseDialog{
|
||||
//TODO unused
|
||||
Seq<Host> commmunityHosts = new Seq<>();
|
||||
Seq<Server> servers = new Seq<>();
|
||||
Dialog add;
|
||||
Server renaming;
|
||||
@@ -358,6 +360,7 @@ public class JoinDialog extends BaseDialog{
|
||||
}
|
||||
|
||||
void refreshCommunity(){
|
||||
commmunityHosts.clear();
|
||||
int cur = refreshes;
|
||||
|
||||
global.clear();
|
||||
@@ -378,6 +381,8 @@ public class JoinDialog extends BaseDialog{
|
||||
if(refreshes != cur) return;
|
||||
res.port = resport;
|
||||
|
||||
commmunityHosts.add(res);
|
||||
|
||||
//add header
|
||||
if(groupTable[0] == null){
|
||||
global.table(t -> groupTable[0] = t).row();
|
||||
|
||||
@@ -521,7 +521,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
pt.button(planet.localizedName, Styles.clearTogglet, () -> {
|
||||
selected = null;
|
||||
launchSector = null;
|
||||
renderer.planets.planet = planet;
|
||||
if(renderer.planets.planet != planet){
|
||||
renderer.planets.planet = planet;
|
||||
rebuildList();
|
||||
}
|
||||
settings.put("lastplanet", planet.name);
|
||||
}).width(200).height(40).growX().update(bb -> bb.setChecked(renderer.planets.planet == planet));
|
||||
pt.row();
|
||||
|
||||
@@ -60,7 +60,7 @@ public class ResearchDialog extends BaseDialog{
|
||||
//add global counts of each sector
|
||||
for(Planet planet : content.planets()){
|
||||
for(Sector sector : planet.sectors){
|
||||
if(sector.hasSave() && sector.hasBase()){
|
||||
if(sector.hasBase()){
|
||||
ItemSeq cached = sector.items();
|
||||
cache.put(sector, cached);
|
||||
cached.each((item, amount) -> {
|
||||
|
||||
@@ -155,7 +155,7 @@ public class SchematicsDialog extends BaseDialog{
|
||||
});
|
||||
|
||||
buttons.button(Icon.pencil, style, () -> {
|
||||
new Dialog("@schematic.rename"){{
|
||||
new BaseDialog("@schematic.rename"){{
|
||||
setFillParent(true);
|
||||
|
||||
cont.margin(30);
|
||||
|
||||
@@ -207,7 +207,7 @@ public class HudFragment extends Fragment{
|
||||
logic.skipWave();
|
||||
}
|
||||
}).growY().fillX().right().width(40f).disabled(b -> !canSkipWave()).name("skip");
|
||||
}).width(dsize * 5 + 4f);
|
||||
}).width(dsize * 5 + 4f).name("statustable");
|
||||
|
||||
wavesMain.row();
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ public class LaserTurret extends PowerTurret{
|
||||
return;
|
||||
}
|
||||
|
||||
if(reload <= 0 && (consValid() || cheating())){
|
||||
if(reload <= 0 && (consValid() || cheating()) && !charging){
|
||||
BulletType type = peekAmmo();
|
||||
|
||||
shoot(type);
|
||||
|
||||
@@ -40,6 +40,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
floating = true;
|
||||
conveyorPlacement = true;
|
||||
noUpdateDisabled = true;
|
||||
canOverdrive = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,6 +9,7 @@ public class LiquidRouter extends LiquidBlock{
|
||||
super(name);
|
||||
|
||||
noUpdateDisabled = true;
|
||||
canOverdrive = false;
|
||||
}
|
||||
|
||||
public class LiquidRouterBuild extends LiquidBuild{
|
||||
|
||||
@@ -29,6 +29,7 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
||||
public float maxLiquidGenerate = 0.4f;
|
||||
|
||||
public Effect generateEffect = Fx.generatespark;
|
||||
public float generateEffectRnd = 3f;
|
||||
public Effect explodeEffect = Fx.generatespark;
|
||||
public Color heatColor = Color.valueOf("ff9b59");
|
||||
public @Load("@-top") TextureRegion topRegion;
|
||||
@@ -128,12 +129,12 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
||||
productionEfficiency = baseLiquidEfficiency * used / maximumPossible;
|
||||
|
||||
if(used > 0.001f && Mathf.chance(0.05 * delta())){
|
||||
generateEffect.at(x + Mathf.range(3f), y + Mathf.range(3f));
|
||||
generateEffect.at(x + Mathf.range(generateEffectRnd), y + Mathf.range(generateEffectRnd));
|
||||
}
|
||||
}else if(hasItems){
|
||||
// No liquids accepted or none supplied, try using items if accepted
|
||||
if(generateTime <= 0f && items.total() > 0){
|
||||
generateEffect.at(x + Mathf.range(3f), y + Mathf.range(3f));
|
||||
generateEffect.at(x + Mathf.range(generateEffectRnd), y + Mathf.range(generateEffectRnd));
|
||||
Item item = items.take();
|
||||
productionEfficiency = getItemEfficiency(item);
|
||||
explosiveness = item.explosiveness;
|
||||
|
||||
@@ -176,7 +176,7 @@ public class PowerGraph{
|
||||
|
||||
public void distributePower(float needed, float produced, boolean charged){
|
||||
//distribute even if not needed. this is because some might be requiring power but not using it; it updates consumers
|
||||
float coverage = Mathf.zero(needed) && Mathf.zero(produced) && !charged ? 0f : Mathf.zero(needed) ? 1f : Math.min(1, produced / needed);
|
||||
float coverage = Mathf.zero(needed) && Mathf.zero(produced) && !charged && Mathf.zero(lastPowerStored) ? 0f : Mathf.zero(needed) ? 1f : Math.min(1, produced / needed);
|
||||
for(Building consumer : consumers){
|
||||
Consumers consumes = consumer.block.consumes;
|
||||
if(consumes.hasPower()){
|
||||
|
||||
@@ -3,6 +3,7 @@ package mindustry.world.blocks.power;
|
||||
import mindustry.type.*;
|
||||
|
||||
public class SingleTypeGenerator extends ItemLiquidGenerator{
|
||||
public boolean useItems = true;
|
||||
|
||||
public SingleTypeGenerator(String name){
|
||||
super(name);
|
||||
@@ -11,11 +12,11 @@ public class SingleTypeGenerator extends ItemLiquidGenerator{
|
||||
|
||||
@Override
|
||||
protected float getItemEfficiency(Item item){
|
||||
return 1f;
|
||||
return useItems ? 1f : 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getLiquidEfficiency(Liquid liquid){
|
||||
return 0f;
|
||||
return useItems ? 0f : 1f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class SolidPump extends Pump{
|
||||
drawPotentialLinks(x, y);
|
||||
|
||||
if(attribute != null){
|
||||
drawPlaceText(Core.bundle.formatFloat("bar.efficiency", Math.max(sumAttribute(attribute, x, y) / size / size + baseEfficiency, 0f) * 100 * percentSolid(x, y), 1), x, y, valid);
|
||||
drawPlaceText(Core.bundle.format("bar.efficiency", Math.round(Math.max(sumAttribute(attribute, x, y) / size / size + baseEfficiency, 0f) * 100 * percentSolid(x, y))), x, y, valid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,18 +3,36 @@ package mindustry.world.draw;
|
||||
import arc.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.production.*;
|
||||
import mindustry.world.blocks.production.GenericCrafter.*;
|
||||
import mindustry.world.consumers.*;
|
||||
|
||||
public class DrawLiquid extends DrawBlock{
|
||||
public TextureRegion liquid, top;
|
||||
public TextureRegion inLiquid, liquid, top;
|
||||
public boolean useOutputSprite = false;
|
||||
|
||||
public DrawLiquid(){
|
||||
}
|
||||
|
||||
public DrawLiquid(boolean useOutputSprite){
|
||||
this.useOutputSprite = useOutputSprite;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(GenericCrafterBuild build){
|
||||
Draw.rect(build.block.region, build.x, build.y);
|
||||
GenericCrafter type = (GenericCrafter)build.block;
|
||||
|
||||
if((inLiquid.found() || useOutputSprite) && type.consumes.has(ConsumeType.liquid)){
|
||||
Liquid input = type.consumes.<ConsumeLiquid>get(ConsumeType.liquid).liquid;
|
||||
Drawf.liquid(useOutputSprite ? liquid : inLiquid, build.x, build.y,
|
||||
build.liquids.get(input) / type.liquidCapacity,
|
||||
input.color
|
||||
);
|
||||
}
|
||||
|
||||
if(type.outputLiquid != null && build.liquids.get(type.outputLiquid.liquid) > 0){
|
||||
Drawf.liquid(liquid, build.x, build.y,
|
||||
build.liquids.get(type.outputLiquid.liquid) / type.liquidCapacity,
|
||||
@@ -29,6 +47,7 @@ public class DrawLiquid extends DrawBlock{
|
||||
public void load(Block block){
|
||||
top = Core.atlas.find(block.name + "-top");
|
||||
liquid = Core.atlas.find(block.name + "-liquid");
|
||||
inLiquid = Core.atlas.find(block.name + "-input-liquid");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,19 +2,37 @@ package mindustry.world.draw;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.production.*;
|
||||
import mindustry.world.blocks.production.GenericCrafter.*;
|
||||
import mindustry.world.consumers.*;
|
||||
|
||||
public class DrawMixer extends DrawBlock{
|
||||
public TextureRegion liquid, top, bottom;
|
||||
public TextureRegion inLiquid, liquid, top, bottom;
|
||||
public boolean useOutputSprite;
|
||||
|
||||
public DrawMixer(){
|
||||
}
|
||||
|
||||
public DrawMixer(boolean useOutputSprite){
|
||||
this.useOutputSprite = useOutputSprite;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(GenericCrafterBuild build){
|
||||
float rotation = build.block.rotate ? build.rotdeg() : 0;
|
||||
|
||||
Draw.rect(bottom, build.x, build.y, rotation);
|
||||
|
||||
if((inLiquid.found() || useOutputSprite) && build.block.consumes.has(ConsumeType.liquid)){
|
||||
Liquid input = build.block.consumes.<ConsumeLiquid>get(ConsumeType.liquid).liquid;
|
||||
Drawf.liquid(useOutputSprite ? liquid : inLiquid, build.x, build.y,
|
||||
build.liquids.get(input) / build.block.liquidCapacity,
|
||||
input.color
|
||||
);
|
||||
}
|
||||
|
||||
if(build.liquids.total() > 0.001f){
|
||||
Draw.color(((GenericCrafter)build.block).outputLiquid.liquid.color);
|
||||
Draw.alpha(build.liquids.get(((GenericCrafter)build.block).outputLiquid.liquid) / build.block.liquidCapacity);
|
||||
@@ -27,6 +45,7 @@ public class DrawMixer extends DrawBlock{
|
||||
|
||||
@Override
|
||||
public void load(Block block){
|
||||
inLiquid = Core.atlas.find(block.name + "-input-liquid");
|
||||
liquid = Core.atlas.find(block.name + "-liquid");
|
||||
top = Core.atlas.find(block.name + "-top");
|
||||
bottom = Core.atlas.find(block.name + "-bottom");
|
||||
|
||||
Reference in New Issue
Block a user