mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-03-03 20:41:28 -08:00
Bugfixes of various kinds
This commit is contained in:
parent
92b68bdb8f
commit
7a516930b1
9 changed files with 15 additions and 380 deletions
|
|
@ -755,7 +755,7 @@ block.ghoul-factory.description = Produces heavy carpet bombers.
|
|||
block.dagger-factory.description = Produces basic ground units.
|
||||
block.titan-factory.description = Produces advanced, armored ground units.
|
||||
block.fortress-factory.description = Produces heavy artillery ground units.
|
||||
block.revenant-factory.description = Produces heavy laser ground units.
|
||||
block.revenant-factory.description = Produces heavy laser air units.
|
||||
block.repair-point.description = Continuously heals the closest damaged unit in its vicinity.
|
||||
block.command-center.description = Allows changing friendly AI behavior. Currently, attack, retreat and patrol commands are supported.
|
||||
block.conduit.description = Basic liquid transport block. Works like a conveyor, but with liquids. Best used with extractors, pumps or other conduits.
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -4,12 +4,11 @@ import io.anuke.mindustry.content.Liquids;
|
|||
import io.anuke.mindustry.content.fx.BlockFx;
|
||||
import io.anuke.mindustry.game.ContentList;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.distribution.WarpGate;
|
||||
import io.anuke.mindustry.world.blocks.power.*;
|
||||
|
||||
public class PowerBlocks extends BlockList implements ContentList{
|
||||
public static Block combustionGenerator, thermalGenerator, turbineGenerator, rtgGenerator, solarPanel, largeSolarPanel,
|
||||
thoriumReactor, fusionReactor, battery, batteryLarge, powerNode, powerNodeLarge, warpGate;
|
||||
thoriumReactor, fusionReactor, battery, batteryLarge, powerNode, powerNodeLarge;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
|
|
@ -85,7 +84,5 @@ public class PowerBlocks extends BlockList implements ContentList{
|
|||
shadow = "shadow-round-2";
|
||||
}};
|
||||
|
||||
warpGate = new WarpGate("warp-gate");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ public class Links{
|
|||
|
||||
private static void createLinks(){
|
||||
links = new LinkEntry[]{
|
||||
new LinkEntry("discord", "https://discord.gg/BKADYds", Color.valueOf("7289da")),
|
||||
new LinkEntry("trello", "https://trello.com/b/aE2tcUwF", Color.valueOf("026aa7")),
|
||||
new LinkEntry("wiki", "http://mindustry.wikia.com/wiki/Mindustry_Wiki", Color.valueOf("0f142f")),
|
||||
new LinkEntry("itch.io", "https://anuke.itch.io/mindustry", Color.valueOf("fa5c5c")),
|
||||
new LinkEntry("google-play", "https://play.google.com/store/apps/details?id=io.anuke.mindustry", Color.valueOf("689f38")),
|
||||
new LinkEntry("github", "https://github.com/Anuken/Mindustry/", Color.valueOf("24292e")),
|
||||
new LinkEntry("dev-builds", "https://github.com/Anuken/Mindustry/wiki", Color.valueOf("fafbfc"))
|
||||
new LinkEntry("discord", "https://discord.gg/BKADYds", Color.valueOf("7289da")),
|
||||
new LinkEntry("trello", "https://trello.com/b/aE2tcUwF", Color.valueOf("026aa7")),
|
||||
new LinkEntry("wiki", "http://mindustry.wikia.com/wiki/Mindustry_Wiki", Color.valueOf("0f142f")),
|
||||
new LinkEntry("itch.io", "https://anuke.itch.io/mindustry", Color.valueOf("fa5c5c")),
|
||||
new LinkEntry("google-play", "https://play.google.com/store/apps/details?id=io.anuke.mindustry", Color.valueOf("689f38")),
|
||||
new LinkEntry("github", "https://github.com/Anuken/Mindustry/", Color.valueOf("24292e")),
|
||||
new LinkEntry("dev-builds", "https://jenkins.hellomouse.net/job/mindustry/", Color.valueOf("fafbfc"))
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import io.anuke.ucore.scene.ui.layout.Cell;
|
|||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
import io.anuke.ucore.scene.utils.UIUtils;
|
||||
import io.anuke.ucore.util.OS;
|
||||
import io.anuke.ucore.util.Strings;
|
||||
|
||||
import static io.anuke.mindustry.Vars.ios;
|
||||
import static io.anuke.mindustry.Vars.ui;
|
||||
|
|
@ -55,7 +56,7 @@ public class AboutDialog extends FloatingDialog{
|
|||
}).size(h - 5, h);
|
||||
|
||||
table.table(inset -> {
|
||||
inset.add("[accent]" + link.name.replace("-", " ")).growX().left();
|
||||
inset.add("[accent]" + Strings.capitalize(link.name.replace("-", " "))).growX().left();
|
||||
inset.row();
|
||||
inset.labelWrap(link.description).width(w - 100f).color(Color.LIGHT_GRAY).growX();
|
||||
}).padLeft(8);
|
||||
|
|
@ -93,7 +94,7 @@ public class AboutDialog extends FloatingDialog{
|
|||
public void showCredits(){
|
||||
FloatingDialog dialog = new FloatingDialog("$text.credits");
|
||||
dialog.addCloseButton();
|
||||
dialog.content().add("$text.credits.text");
|
||||
dialog.content().labelWrap("$text.credits.text").width(400f);
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class BlockConsumeFragment extends Fragment{
|
|||
tile = tile.target();
|
||||
|
||||
if(tile != lastTile){
|
||||
if(tile.block().consumes.hasAny()){
|
||||
if(tile.getTeam() == players[0].getTeam() && tile.block().consumes.hasAny()){
|
||||
show(tile);
|
||||
}else if(visible){
|
||||
hide();
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ public class PlayerListFragment extends Fragment{
|
|||
b.setDisabled(Net.client());
|
||||
}).get().setTouchable(() -> Net.client() ? Touchable.disabled : Touchable.enabled);
|
||||
|
||||
t.addImageButton("icon-zoom-small", 14 * 2, () -> Call.onAdminRequest(player, AdminAction.trace));
|
||||
t.addImageButton("icon-zoom-small", 14 * 2, () -> ui.showError("Currently unimplemented.")/*Call.onAdminRequest(player, AdminAction.trace)*/);
|
||||
|
||||
}).padRight(12).padTop(-5).padLeft(0).padBottom(-10).size(bs + 10f, bs);
|
||||
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ public class Conveyor extends Block{
|
|||
public void read(DataInput stream) throws IOException{
|
||||
convey.clear();
|
||||
int amount = stream.readInt();
|
||||
convey.ensureCapacity(amount);
|
||||
convey.ensureCapacity(Math.min(amount, 10));
|
||||
|
||||
for(int i = 0; i < amount; i++){
|
||||
convey.add(ItemPos.toLong(stream.readInt()));
|
||||
|
|
|
|||
|
|
@ -1,363 +0,0 @@
|
|||
package io.anuke.mindustry.world.blocks.distribution;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.ObjectSet;
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.content.fx.BlockFx;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.PowerBlock;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Fill;
|
||||
import io.anuke.ucore.graphics.Hue;
|
||||
import io.anuke.ucore.graphics.Lines;
|
||||
import io.anuke.ucore.scene.ui.ButtonGroup;
|
||||
import io.anuke.ucore.scene.ui.ImageButton;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
|
||||
//TODO implement
|
||||
public class WarpGate extends PowerBlock{
|
||||
public static final Color[] colorArray = {Color.ROYAL, Color.ORANGE, Color.SCARLET, Color.LIME,
|
||||
Color.PURPLE, Color.GOLD, Color.PINK, Color.LIGHT_GRAY};
|
||||
public static final int colors = colorArray.length;
|
||||
private static ObjectSet<Tile>[] teleporters = new ObjectSet[colors];
|
||||
private static Color color = new Color();
|
||||
private static byte lastColor = 0;
|
||||
|
||||
static{
|
||||
for(int i = 0; i < colors; i++){
|
||||
teleporters[i] = new ObjectSet<>();
|
||||
}
|
||||
}
|
||||
|
||||
protected int timerTeleport = timers++;
|
||||
protected float warmupTime = 60f;
|
||||
//time between teleports
|
||||
protected float teleportMax = 400f;
|
||||
protected float teleportLiquidUse = 0.3f;
|
||||
protected Liquid inputLiquid = Liquids.cryofluid;
|
||||
protected Effect activateEffect = BlockFx.teleportActivate;
|
||||
protected Effect teleportEffect = BlockFx.teleport;
|
||||
protected Effect teleportOutEffect = BlockFx.teleportOut;
|
||||
private Array<Tile> removal = new Array<>();
|
||||
private Array<Tile> returns = new Array<>();
|
||||
|
||||
public WarpGate(String name){
|
||||
super(name);
|
||||
update = true;
|
||||
solid = true;
|
||||
health = 80;
|
||||
powerCapacity = 300f;
|
||||
size = 3;
|
||||
itemCapacity = 100;
|
||||
hasLiquids = true;
|
||||
hasItems = true;
|
||||
liquidCapacity = 100f;
|
||||
configurable = true;
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.both, forward = true)
|
||||
public static void setTeleporterColor(Player player, Tile tile, byte color){
|
||||
TeleporterEntity entity = tile.entity();
|
||||
entity.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playerPlaced(Tile tile){
|
||||
Call.setTeleporterColor(null, tile, lastColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
TeleporterEntity entity = tile.entity();
|
||||
float time = entity.time;
|
||||
float rad = entity.activeScl;
|
||||
|
||||
if(entity.liquidLackScl > 0.01f){
|
||||
Graphics.setAdditiveBlending();
|
||||
Draw.color(1f, 0.3f, 0.3f, 0.4f * entity.liquidLackScl);
|
||||
Fill.square(tile.drawx(), tile.drawy(), size * tilesize);
|
||||
Graphics.setNormalBlending();
|
||||
}
|
||||
|
||||
Draw.color(getColor(tile, 0));
|
||||
Draw.rect(name + "-top", tile.drawx(), tile.drawy());
|
||||
Draw.reset();
|
||||
|
||||
if(rad <= 0.0001f) return;
|
||||
|
||||
Draw.color(getColor(tile, 0));
|
||||
|
||||
Fill.circle(tile.drawx(), tile.drawy(), rad * (7f + Mathf.absin(time + 55, 8f, 1f)));
|
||||
|
||||
Draw.color(getColor(tile, -1));
|
||||
|
||||
Fill.circle(tile.drawx(), tile.drawy(), rad * (2f + Mathf.absin(time, 7f, 3f)));
|
||||
|
||||
for(int i = 0; i < 11; i++){
|
||||
Lines.swirl(tile.drawx(), tile.drawy(),
|
||||
rad * (2f + i / 3f + Mathf.sin(time - i * 75, 20f + i, 3f)),
|
||||
0.3f + Mathf.sin(time + i * 33, 10f + i, 0.1f),
|
||||
time * (1f + Mathf.randomSeedRange(i + 1, 1f)) + Mathf.randomSeedRange(i, 360f));
|
||||
}
|
||||
|
||||
Draw.color(getColor(tile, 1));
|
||||
|
||||
Lines.stroke(2f);
|
||||
Lines.circle(tile.drawx(), tile.drawy(), rad * (7f + Mathf.absin(time + 55, 8f, 1f)));
|
||||
Lines.stroke(1f);
|
||||
|
||||
for(int i = 0; i < 11; i++){
|
||||
Lines.swirl(tile.drawx(), tile.drawy(),
|
||||
rad * (3f + i / 3f + Mathf.sin(time + i * 93, 20f + i, 3f)),
|
||||
0.2f + Mathf.sin(time + i * 33, 10f + i, 0.1f),
|
||||
time * (1f + Mathf.randomSeedRange(i + 1, 1f)) + Mathf.randomSeedRange(i, 360f));
|
||||
}
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
TeleporterEntity entity = tile.entity();
|
||||
|
||||
teleporters[entity.color].add(tile);
|
||||
|
||||
if(entity.items.total() > 0){
|
||||
tryDump(tile);
|
||||
}
|
||||
|
||||
if(!entity.active){
|
||||
entity.activeScl = Mathf.lerpDelta(entity.activeScl, 0f, 0.01f);
|
||||
|
||||
if(entity.power.amount >= powerCapacity){
|
||||
Color resultColor = new Color();
|
||||
resultColor.set(getColor(tile, 0));
|
||||
|
||||
entity.active = true;
|
||||
entity.power.amount = 0f;
|
||||
Effects.effect(activateEffect, resultColor, tile.drawx(), tile.drawy());
|
||||
}
|
||||
}else{
|
||||
entity.activeScl = Mathf.lerpDelta(entity.activeScl, 1f, 0.015f);
|
||||
/*
|
||||
|
||||
if (entity.power.amount >= powerUsed) {
|
||||
entity.power.amount -= powerUsed;
|
||||
entity.powerLackScl = Mathf.lerpDelta(entity.powerLackScl, 0f, 0.1f);
|
||||
}else{
|
||||
entity.power.amount = 0f;
|
||||
entity.powerLackScl = Mathf.lerpDelta(entity.powerLackScl, 1f, 0.1f);
|
||||
}
|
||||
|
||||
if(entity.powerLackScl >= 0.999f){
|
||||
catastrophicFailure(tile);
|
||||
}
|
||||
|
||||
if (entity.liquids.amount >= liquidUsed) {
|
||||
entity.liquids.amount -= liquidUsed;
|
||||
entity.liquidLackScl = Mathf.lerpDelta(entity.liquidLackScl, 0f, 0.1f);
|
||||
}else{
|
||||
entity.liquids.amount = 0f;
|
||||
entity.liquidLackScl = Mathf.lerpDelta(entity.liquidLackScl, 1f, 0.1f);
|
||||
}*/
|
||||
|
||||
if(entity.liquidLackScl >= 0.999f){
|
||||
catastrophicFailure(tile);
|
||||
}
|
||||
|
||||
//TODO draw warning info!
|
||||
|
||||
if(entity.teleporting){
|
||||
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 2f, 0.01f);
|
||||
//liquidUsed = Math.min(liquidCapacity, teleportLiquidUse * Timers.delta());
|
||||
|
||||
//if (entity.liquids.amount >= liquidUsed) {
|
||||
// entity.liquids.amount -= liquidUsed;
|
||||
//} else {
|
||||
catastrophicFailure(tile);
|
||||
//}
|
||||
}else{
|
||||
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 1f, 0.04f);
|
||||
}
|
||||
|
||||
entity.time += Timers.delta() * entity.speedScl;
|
||||
/*
|
||||
if (!entity.teleporting && entity.items.total() >= itemCapacity && entity.power.amount >= powerCapacity - 0.01f - powerUse &&
|
||||
entity.timer.get(timerTeleport, teleportMax)) {
|
||||
Array<Tile> testLinks = findLinks(tile);
|
||||
|
||||
if (testLinks.size == 0) return;
|
||||
|
||||
Color resultColor = new Color();
|
||||
resultColor.set(getColor(tile, 0));
|
||||
|
||||
entity.teleporting = true;
|
||||
|
||||
Effects.effect(teleportEffect, resultColor, tile.drawx(), tile.drawy());
|
||||
Timers.run(warmupTime, () -> {
|
||||
Array<Tile> links = findLinks(tile);
|
||||
|
||||
for (Tile other : links) {
|
||||
int canAccept = itemCapacity - other.entity.items.total();
|
||||
int total = entity.items.total();
|
||||
if (total == 0) break;
|
||||
Effects.effect(teleportOutEffect, resultColor, other.drawx(), other.drawy());
|
||||
for (int i = 0; i < canAccept && i < total; i++) {
|
||||
other.entity.items.add(entity.items.take(), 1);
|
||||
}
|
||||
}
|
||||
Effects.effect(teleportOutEffect, resultColor, tile.drawx(), tile.drawy());
|
||||
entity.power.amount = 0f;
|
||||
entity.teleporting = false;
|
||||
});
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTable(Tile tile, Table table){
|
||||
TeleporterEntity entity = tile.entity();
|
||||
|
||||
//TODO call event for change
|
||||
|
||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||
Table cont = new Table();
|
||||
|
||||
for(int i = 0; i < colors; i++){
|
||||
final int f = i;
|
||||
ImageButton button = cont.addImageButton("white", "toggle", 24, () -> {
|
||||
lastColor = (byte) f;
|
||||
Call.setTeleporterColor(null, tile, (byte) f);
|
||||
}).size(34, 38).padBottom(-5.1f).group(group).get();
|
||||
button.getStyle().imageUpColor = colorArray[f];
|
||||
button.setChecked(entity.color == f);
|
||||
|
||||
if(i % 4 == 3){
|
||||
cont.row();
|
||||
}
|
||||
}
|
||||
|
||||
table.add(cont);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
TeleporterEntity entity = tile.entity();
|
||||
return entity.items.total() < itemCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity newEntity(){
|
||||
return new TeleporterEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
||||
return super.acceptLiquid(tile, source, liquid, amount) && liquid == inputLiquid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyed(Tile tile){
|
||||
super.onDestroyed(tile);
|
||||
|
||||
TeleporterEntity entity = tile.entity();
|
||||
|
||||
if(entity.activeScl < 0.5f) return;
|
||||
|
||||
//TODO catastrophic failure
|
||||
}
|
||||
|
||||
private void catastrophicFailure(Tile tile){
|
||||
tile.entity.damage(tile.entity.health + 1);
|
||||
//TODO fail gloriously
|
||||
}
|
||||
|
||||
private Color getColor(Tile tile, int shift){
|
||||
TeleporterEntity entity = tile.entity();
|
||||
|
||||
Color target = colorArray[entity.color];
|
||||
float ss = 0.5f;
|
||||
float bs = 0.2f;
|
||||
|
||||
return Hue.shift(Hue.multiply(color.set(target), 1, ss), 2, shift * bs + (entity.speedScl - 1f) / 3f);
|
||||
}
|
||||
|
||||
private Array<Tile> findLinks(Tile tile){
|
||||
TeleporterEntity entity = tile.entity();
|
||||
|
||||
removal.clear();
|
||||
returns.clear();
|
||||
|
||||
for(Tile other : teleporters[entity.color]){
|
||||
if(other != tile){
|
||||
if(other.block() instanceof WarpGate){
|
||||
TeleporterEntity oe = other.entity();
|
||||
if(!oe.active) continue;
|
||||
if(oe.color != entity.color){
|
||||
removal.add(other);
|
||||
}else if(other.entity.items.total() == 0){
|
||||
returns.add(other);
|
||||
}
|
||||
}else{
|
||||
removal.add(other);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(Tile remove : removal){
|
||||
teleporters[entity.color].remove(remove);
|
||||
}
|
||||
|
||||
return returns;
|
||||
}
|
||||
|
||||
public static class TeleporterEntity extends TileEntity{
|
||||
public byte color = 0;
|
||||
public boolean teleporting;
|
||||
public boolean active;
|
||||
public float activeScl = 0f;
|
||||
public float speedScl = 1f;
|
||||
public float powerLackScl, liquidLackScl;
|
||||
public float time;
|
||||
|
||||
@Override
|
||||
public void write(DataOutput stream) throws IOException{
|
||||
stream.writeByte(color);
|
||||
stream.writeBoolean(active);
|
||||
stream.writeFloat(activeScl);
|
||||
stream.writeFloat(speedScl);
|
||||
stream.writeFloat(powerLackScl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInput stream) throws IOException{
|
||||
color = stream.readByte();
|
||||
active = stream.readBoolean();
|
||||
activeScl = stream.readFloat();
|
||||
speedScl = stream.readFloat();
|
||||
powerLackScl = stream.readFloat();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue