This commit is contained in:
Anuken
2021-07-18 16:31:13 -04:00
parent 96de7c8321
commit 1674b2dfd6

View File

@@ -16,6 +16,7 @@ import arc.util.*;
import mindustry.*; import mindustry.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.logic.LStatements.*;
import mindustry.ui.*; import mindustry.ui.*;
public class LCanvas extends Table{ public class LCanvas extends Table{
@@ -395,11 +396,20 @@ public class LCanvas extends Table{
} }
public void copy(){ public void copy(){
st.saveUI();
LStatement copy = st.copy(); LStatement copy = st.copy();
if(copy instanceof JumpStatement st && st.destIndex != -1){
int index = statements.getChildren().indexOf(this);
if(index != -1 && index < st.destIndex){
st.destIndex ++;
}
}
if(copy != null){ if(copy != null){
StatementElem s = new StatementElem(copy); StatementElem s = new StatementElem(copy);
statements.addChildAfter(StatementElem.this,s); statements.addChildAfter(StatementElem.this, s);
statements.layout(); statements.layout();
copy.elem = s; copy.elem = s;
copy.setupUI(); copy.setupUI();