Merge remote-tracking branch 'origin/master'

# Conflicts:
#	core/src/mindustry/logic/LCanvas.java
This commit is contained in:
Anuken 2020-11-02 16:47:33 -05:00
commit e853ed6419
10 changed files with 31 additions and 59 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 743 B

View File

@ -284,15 +284,15 @@ selectschematic = [accent][[{0}][] pour sélectionner et copier
pausebuilding = [accent][[{0}][] pour mettre la construction en pause
resumebuilding = [scarlet][[{0}][] pour reprendre la construction
wave = [accent]Vague {0}
wave.cap = [accent]Wave {0}/{1}
wave.cap = [accent]Vague {0}/{1}
wave.waiting = [lightgray]Vague dans {0}
wave.waveInProgress = [lightgray]Vague en cours
waiting = [lightgray]En attente...
waiting.players = En attente de joueurs...
wave.enemies = [lightgray]{0} Ennemis restants
wave.enemy = [lightgray]{0} Ennemi restant
wave.guardianwarn = Guardian approaching in [accent]{0}[] waves.
wave.guardianwarn.one = Guardian approaching in [accent]{0}[] wave.
wave.guardianwarn = Gardien à l'approche dans [accent]{0}[] vagues.
wave.guardianwarn.one = Gardien à l'approche dans [accent]{0}[] vague.
loadimage = Charger l'image
saveimage = Sauvegarder l'image
unknown = Inconnu
@ -331,7 +331,7 @@ editor.generation = Génération:
editor.ingame = Éditer dans le jeu
editor.publish.workshop = Publier sur le Workshop
editor.newmap = Nouvelle carte
editor.center = Center
editor.center = Centrer
workshop = Steam Workshop
waves.title = Vagues
waves.remove = Supprimer
@ -445,7 +445,7 @@ filter.option.amount = Quantité
filter.option.block = Bloc
filter.option.floor = Sol
filter.option.flooronto = Sol en question
filter.option.target = Target
filter.option.target = Cible
filter.option.wall = Mur
filter.option.ore = Minerai
filter.option.floor2 = Sol secondaire

View File

@ -1066,7 +1066,7 @@ block.message.name = Message
block.illuminator.name = Illuminator
block.illuminator.description = A small, compact, configurable light source. Requires power to function.
block.overflow-gate.name = Barrière de Débordement
block.underflow-gate.name = Underflow Gate
block.underflow-gate.name = Barrière de Refoulement
block.silicon-smelter.name = Fonderie de silicium
block.phase-weaver.name = Tisseur à phase
block.pulverizer.name = Pulvérisateur
@ -1274,7 +1274,7 @@ block.inverted-sorter.description = Processes items like a standard sorter, but
block.router.description = Accepte les éléments d'une direction et les envoie dans 3 autres directions de manière égale. Utile pour séparer les matériaux d'une source en plusieurs cibles.
block.distributor.description = Un routeur avancé qui divise les articles en 7 autres directions de manière égale. [scarlet]Seule et unique ![]
block.overflow-gate.description = C'est la combinaison entre un routeur et un diviseur qui peut seulement distribuer à gauche et à droite si le chemin de devant est bloqué.
block.underflow-gate.description = The opposite of an overflow gate. Outputs to the front if the left and right paths are blocked.
block.underflow-gate.description = Le contraire d'une barrière de débordement.\nEnvoie les ressources vers l'avant si les chemins de gauche et de droite sont bloqués.
block.mass-driver.description = Bloc de transport d'articles ultime.\nRecueille plusieurs objets et les envoie ensuite à un autre pilote de masse sur une longue distance.
block.mechanical-pump.description = Une pompe bon marché avec un débit lent, mais aucune consommation d'énergie.
block.rotary-pump.description = Une pompe avancée qui double la vitesse en utilisant lénergie.

View File

@ -1,24 +0,0 @@
package mindustry.logic;
import arc.graphics.*;
import mindustry.graphics.*;
/** The types of data a node field can be. */
public enum DataType{
/** A double. Used for integer calculations as well. */
number(Pal.place),
/** Any type of content, e.g. item. */
content(Color.cyan),
/** A building of a tile. */
building(Pal.items),
/** A unit on the map. */
unit(Pal.health),
/** Java string */
string(Color.royal);
public final Color color;
DataType(Color color){
this.color = color;
}
}

View File

@ -39,9 +39,7 @@ public enum LAccess{
enabled("to"), //"to" is standard for single parameter access
shoot("x", "y", "shoot"),
shootp(true, "unit", "shoot"),
configure(true, 30, "to")
;
configure(true, 30, "to");
public final String[] params;
public final boolean isObj;

View File

@ -17,9 +17,9 @@ public class LAssembler{
private int lastVar;
/** Maps names to variable IDs. */
ObjectMap<String, BVar> vars = new ObjectMap<>();
public ObjectMap<String, BVar> vars = new ObjectMap<>();
/** All instructions to be executed. */
LInstruction[] instructions;
public LInstruction[] instructions;
public LAssembler(){
//instruction counter
@ -105,7 +105,7 @@ public class LAssembler{
if(index++ > max) break;
line = line.replace("\t", "").trim();
try{
String[] arr;

View File

@ -22,10 +22,10 @@ public class LCanvas extends Table{
//ew static variables
static LCanvas canvas;
DragLayout statements;
public DragLayout statements;
public ScrollPane pane;
public Group jumps;
StatementElem dragging;
ScrollPane pane;
Group jumps;
StatementElem hovered;
float targetWidth;
int jumpCount = 0;
@ -78,18 +78,18 @@ public class LCanvas extends Table{
super.draw();
}
void add(LStatement statement){
public void add(LStatement statement){
statements.addChild(new StatementElem(statement));
}
String save(){
public String save(){
Seq<LStatement> st = statements.getChildren().<StatementElem>as().map(s -> s.st);
st.each(LStatement::saveUI);
return LAssembler.write(st);
}
void load(String asm){
public void load(String asm){
jumps.clear();
Seq<LStatement> statements = LAssembler.read(asm);
@ -261,7 +261,7 @@ public class LCanvas extends Table{
}
public class StatementElem extends Table{
LStatement st;
public LStatement st;
public StatementElem(LStatement st){
this.st = st;
@ -341,7 +341,7 @@ public class LCanvas extends Table{
marginBottom(7);
}
void copy(){
public void copy(){
LStatement copy = st.copy();
if(copy != null){
StatementElem s = new StatementElem(copy);
@ -374,7 +374,7 @@ public class LCanvas extends Table{
float mx, my;
ClickListener listener;
JumpCurve curve;
public JumpCurve curve;
public JumpButton(Prov<StatementElem> getter, Cons<StatementElem> setter){
super(Tex.logicNode, Styles.colori);
@ -437,7 +437,7 @@ public class LCanvas extends Table{
}
public static class JumpCurve extends Element{
JumpButton button;
public JumpButton button;
public JumpCurve(JumpButton button){
this.button = button;
@ -492,7 +492,7 @@ public class LCanvas extends Table{
}
}
void drawCurve(float x, float y, float x2, float y2){
public void drawCurve(float x, float y, float x2, float y2){
Lines.stroke(4f, button.color);
Draw.alpha(parentAlpha);
@ -518,8 +518,7 @@ public class LCanvas extends Table{
x + dist, y,
x2 + dist, y2,
x2, y2,
Math.max(18, (int)(Mathf.dst(x, y, x2, y2) / 6))
);
Math.max(18, (int)(Mathf.dst(x, y, x2, y2) / 6)));
}
}
}

View File

@ -11,7 +11,7 @@ import mindustry.ui.dialogs.*;
import static mindustry.Vars.*;
public class LogicDialog extends BaseDialog{
LCanvas canvas;
public LCanvas canvas;
Cons<String> consumer = s -> {};
public LogicDialog(){
@ -25,7 +25,7 @@ public class LogicDialog extends BaseDialog{
addCloseListener();
buttons.defaults().size(160f, 64f);
buttons.button("@back", Icon.left, this::hide);
buttons.button("@back", Icon.left, this::hide).name("back");
buttons.button("@edit", Icon.edit, () -> {
BaseDialog dialog = new BaseDialog("@editor.export");
@ -53,7 +53,7 @@ public class LogicDialog extends BaseDialog{
dialog.addCloseButton();
dialog.show();
});
}).name("edit");
buttons.button("@add", Icon.add, () -> {
BaseDialog dialog = new BaseDialog("@add");
@ -79,11 +79,11 @@ public class LogicDialog extends BaseDialog{
dialog.show();
}).disabled(t -> canvas.statements.getChildren().size >= LExecutor.maxInstructions);
add(canvas).grow();
add(canvas).grow().name("canvas");
row();
add(buttons).growX();
add(buttons).growX().name("canvas");
hidden(() -> consumer.get(canvas.save()));

View File

@ -38,9 +38,7 @@ public enum LogicOp{
floor("floor", Math::floor),
ceil("ceil", Math::ceil),
sqrt("sqrt", Math::sqrt),
rand("rand", d -> Mathf.rand.nextDouble() * d),
;
rand("rand", d -> Mathf.rand.nextDouble() * d);
public static final LogicOp[] all = values();

View File

@ -324,7 +324,8 @@ public class LogicBlock extends Block{
executor.load(asm);
}catch(Exception e){
e.printStackTrace();
Log.err("Failed to compile logic program @", code);
Log.err(e);
//handle malformed code and replace it with nothing
executor.load("", LExecutor.maxInstructions);