mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-10-03 03:31:28 +03:00
Merge branch 'master' of https://github.com/Anuken/Mindustry into v9
# Conflicts: # gradle.properties
This commit is contained in:
@@ -173,6 +173,15 @@ public class AndroidLauncher extends AndroidApplication{
|
||||
throw new ArcRuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Writer writer(boolean append, String charset){
|
||||
try{
|
||||
return new OutputStreamWriter(write(append), charset);
|
||||
}catch(IOException ex){
|
||||
throw new ArcRuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}).toArray(Fi.class);
|
||||
|
||||
Core.app.post(() -> Core.app.post(() -> params.handleChooseResult(files)));
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Sort by stars
|
||||
export.file = Export File
|
||||
import.file = Import File
|
||||
copy.clipboard = Copy to Clipboard
|
||||
import.clipboard = Load from Clipboard
|
||||
load.clipboard = Load from Clipboard
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Share on Workshop
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Сартаваць па зоркам
|
||||
export.file = Экспартаваць файл
|
||||
import.file = Імпартаваць файл
|
||||
copy.clipboard = Скапіяваць у буфер абмена
|
||||
import.clipboard = Уставіць з буфера абмену
|
||||
load.clipboard = Уставіць з буфера абмену
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Падзяліцца ў Майстэрні
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Сортирай по рейтинг
|
||||
export.file = Изнасяне във файл
|
||||
import.file = Внасяне от файл
|
||||
copy.clipboard = Копирай в Клипборда
|
||||
import.clipboard = Внеси от Клипборда
|
||||
load.clipboard = Внеси от Клипборда
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Сподели в Работилницата
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Ordena per valoració
|
||||
export.file = Exporta un fitxer
|
||||
import.file = Importa un fitxer
|
||||
copy.clipboard = Copia al porta-retalls
|
||||
import.clipboard = Importa del porta-retalls
|
||||
load.clipboard = Importa del porta-retalls
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Comparteix al Workshop de l’Steam
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Řadit podle hvězd
|
||||
export.file = Exportovat soubor
|
||||
import.file = Importovat soubor
|
||||
copy.clipboard = Zkopírovat do schránky
|
||||
import.clipboard = Importovat ze schránky
|
||||
load.clipboard = Importovat ze schránky
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Sdílet skrze Workshop na Steamu
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Sort by stars
|
||||
export.file = Exporter fil
|
||||
import.file = Importer fil
|
||||
copy.clipboard = Kopier til udklipsholder
|
||||
import.clipboard = Importer fra udklipsholder
|
||||
load.clipboard = Importer fra udklipsholder
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Del på Workshop
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Nach Sternen sortieren
|
||||
export.file = Datei exportieren
|
||||
import.file = Datei importieren
|
||||
copy.clipboard = In Zwischenablage kopieren
|
||||
import.clipboard = Aus Zwischenablage importieren
|
||||
load.clipboard = Aus Zwischenablage importieren
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Im Workshop teilen
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Mejor valorados
|
||||
export.file = Exportar archivo
|
||||
import.file = Importar archivo
|
||||
copy.clipboard = Copiar al portapapeles
|
||||
import.clipboard = Importar desde el portapapeles
|
||||
load.clipboard = Importar desde el portapapeles
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Compartir en Steam Workshop
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Sorteeri tähtede järgi
|
||||
export.file = Ekspordi Fail
|
||||
import.file = Impordi Fail
|
||||
copy.clipboard = Kopeeri Lõikelauale
|
||||
import.clipboard = Impordi Lõikelaualt
|
||||
load.clipboard = Impordi Lõikelaualt
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Jaga Workshop'is
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Ordenatu izarren arabera
|
||||
export.file = Esportatu fitxategia
|
||||
import.file = Inportatu fitxategia
|
||||
copy.clipboard = Kopiatu arbelera
|
||||
import.clipboard = Inportatu arbeletik
|
||||
load.clipboard = Inportatu arbeletik
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Partekatu tailerrean
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Järjestä tähtien määrän perusteella
|
||||
export.file = Vie tiedosto
|
||||
import.file = Tuo tiedosto
|
||||
copy.clipboard = Kopioi leikepöydälle
|
||||
import.clipboard = Tuo leikepöydältä
|
||||
load.clipboard = Tuo leikepöydältä
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Jaa Workshoppiin
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Uriin sa kasikatan
|
||||
export.file = Mag-export ng File
|
||||
import.file = Kumuha ng File
|
||||
copy.clipboard = Kopyahin sa Clipboard
|
||||
import.clipboard = Kunin mula sa Clipboard
|
||||
load.clipboard = Kunin mula sa Clipboard
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Ibahagi sa Workshop
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Classer par étoiles
|
||||
export.file = Exporter le fichier
|
||||
import.file = Importer un fichier
|
||||
copy.clipboard = Copier dans le presse-papier
|
||||
import.clipboard = Importer depuis presse-papier
|
||||
load.clipboard = Importer depuis presse-papier
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Partager sur le Steam Workshop
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Legjobbra értékeltek
|
||||
export.file = Exportálás fájlba
|
||||
import.file = Importálás fájlból
|
||||
copy.clipboard = Másolás a vágólapra
|
||||
import.clipboard = Betöltés a vágólapról
|
||||
load.clipboard = Betöltés a vágólapról
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Megosztás a Steam Műhelyben
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Urut berdasarkan bintang
|
||||
export.file = Ekspor File
|
||||
import.file = Impor File
|
||||
copy.clipboard = Salin ke papan klip
|
||||
import.clipboard = Impor dari papan klip
|
||||
load.clipboard = Impor dari papan klip
|
||||
workshop.browse = Cari di Workshop
|
||||
workshop.share = Bagikan di Workshop
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Ordinato per stelle
|
||||
export.file = Esporta File
|
||||
import.file = Importa File
|
||||
copy.clipboard = Copia negli Appunti
|
||||
import.clipboard = Importa dagli Appunti
|
||||
load.clipboard = Importa dagli Appunti
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Condividi nel Workshop
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = お気に入り数で並べる
|
||||
export.file = ファイルに出力する
|
||||
import.file = ファイルから読み込む
|
||||
copy.clipboard = クリップボードにコピーする
|
||||
import.clipboard = クリップボードから読み込む
|
||||
load.clipboard = クリップボードから読み込む
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = ワークショップで共有する
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = 추천(스타) 수
|
||||
export.file = 파일 내보내기
|
||||
import.file = 파일 가져오기
|
||||
copy.clipboard = 클립보드에 복사
|
||||
import.clipboard = 클립보드에서 가져오기
|
||||
load.clipboard = 클립보드에서 가져오기
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = 창작마당에 공유
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Rūšiuoti pagal žvaigždes
|
||||
export.file = Eksportuoti failą
|
||||
import.file = Importuoti failą
|
||||
copy.clipboard = Kopijuoti į iškarpinę
|
||||
import.clipboard = Importuoti iš iškarpinės
|
||||
load.clipboard = Importuoti iš iškarpinės
|
||||
workshop.browse = Naršyti Dirbtuves
|
||||
workshop.share = Dalintis Dirbtuvėje
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Sorteer op sterren
|
||||
export.file = Exporteer bestand
|
||||
import.file = Importeer bestand
|
||||
copy.clipboard = Kopi�ren naar Klembord
|
||||
import.clipboard = Importeren van Klembord
|
||||
load.clipboard = Importeren van Klembord
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Delen op de Werkplaats
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Sort by stars
|
||||
export.file = Exporteer Bestand
|
||||
import.file = Exporteer Bestand
|
||||
copy.clipboard = Kopieer naar Klembord
|
||||
import.clipboard = Importeer vanaf Klembord
|
||||
load.clipboard = Importeer vanaf Klembord
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Deel op Workshop
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Sortuj wg gwiazdek
|
||||
export.file = Eksportuj plik
|
||||
import.file = Importuj plik
|
||||
copy.clipboard = Kopiuj do schowka
|
||||
import.clipboard = Importuj ze schowka
|
||||
load.clipboard = Importuj ze schowka
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Podziel się na Warsztacie
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Ordenar por estrelas
|
||||
export.file = Exportar Arquivo
|
||||
import.file = Importar Arquivo
|
||||
copy.clipboard = Copiar para a área de transferência
|
||||
import.clipboard = Importar da área de transferência
|
||||
load.clipboard = Importar da área de transferência
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Compartilhar na Oficina
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Ordenar por estrelas
|
||||
export.file = Exportar Ficheiro
|
||||
import.file = Importar Ficheiro
|
||||
copy.clipboard = Copiar para a área de transferência
|
||||
import.clipboard = Importar da área de transferência
|
||||
load.clipboard = Importar da área de transferência
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Partilhar na Workshop
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Cele mai multe stele
|
||||
export.file = Exportă Fișier
|
||||
import.file = Importă Fișier
|
||||
copy.clipboard = Copiază în Clipboard
|
||||
import.clipboard = Importă din Clipboard
|
||||
load.clipboard = Importă din Clipboard
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Partajează pe Workshop
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Сортировка по количеству звёз
|
||||
export.file = Экспортировать файл
|
||||
import.file = Импортировать файл
|
||||
copy.clipboard = Скопировать в буфер обмена
|
||||
import.clipboard = Вставить из буфера обмена
|
||||
load.clipboard = Вставить из буфера обмена
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Поделиться в Мастерской
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Sortiraj po broju "zvezdica"
|
||||
export.file = Izvezi dokument
|
||||
import.file = Uvezi dokument
|
||||
copy.clipboard = Iskopiraj u privremenu memoriju
|
||||
import.clipboard = Uvezi is privremene memoriju
|
||||
load.clipboard = Uvezi is privremene memoriju
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Podeli na radionici
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Sortera efter stjärnor
|
||||
export.file = Exportera Fil
|
||||
import.file = Importera Fil
|
||||
copy.clipboard = Kopiera till urklipp
|
||||
import.clipboard = Importera från urklipp
|
||||
load.clipboard = Importera från urklipp
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Dela på Workshoppen
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = เรียงตามคะแนนดาว
|
||||
export.file = ส่งออกไฟล์
|
||||
import.file = นำเข้าไฟล์
|
||||
copy.clipboard = คัดลอกไปที่คลิปบอร์ด
|
||||
import.clipboard = นำเข้าจากคลิปบอร์ด
|
||||
load.clipboard = นำเข้าจากคลิปบอร์ด
|
||||
workshop.browse = ค้นหาในเวิร์กช็อป
|
||||
workshop.share = แชร์บนเวิร์กช็อป
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Sort by stars
|
||||
export.file = Export File
|
||||
import.file = Import File
|
||||
copy.clipboard = Copy to Clipboard
|
||||
import.clipboard = Import from Clipboard
|
||||
load.clipboard = Import from Clipboard
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Share on Workshop
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Yıldız sayısına göre sırala
|
||||
export.file = Dışarı Aktar
|
||||
import.file = İçeri Aktar
|
||||
copy.clipboard = Panoya Kopyala
|
||||
import.clipboard = Panodan Yapıştır
|
||||
load.clipboard = Panodan Yapıştır
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Atölyede paylaş
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Сортувати за популярністю
|
||||
export.file = Експортувати файл
|
||||
import.file = Імпортувати файл
|
||||
copy.clipboard = Копіювати в буфер обміну
|
||||
import.clipboard = Імпортувати з клавіатури
|
||||
load.clipboard = Імпортувати з клавіатури
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = Поширити в Майстерню
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = Sắp xếp theo sao
|
||||
export.file = Xuất Tệp
|
||||
import.file = Nhập Tệp
|
||||
copy.clipboard = Sao chép vào Bộ nhớ tạm
|
||||
import.clipboard = Nhập từ Bộ nhớ tạm
|
||||
load.clipboard = Nhập từ Bộ nhớ tạm
|
||||
workshop.browse = Duyệt qua Workshop
|
||||
workshop.share = Chia sẻ lên Workshop
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = 按星标数排序
|
||||
export.file = 导出文件
|
||||
import.file = 导入文件
|
||||
copy.clipboard = 复制到剪贴板
|
||||
import.clipboard = 从剪贴板导入
|
||||
load.clipboard = 从剪贴板导入
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = 分享到创意工坊
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ mods.browser.sortstars = 以星數篩選
|
||||
export.file = 匯出檔案
|
||||
import.file = 匯入檔案
|
||||
copy.clipboard = 複製到剪貼簿
|
||||
import.clipboard = 從剪貼簿匯入
|
||||
load.clipboard = 從剪貼簿匯入
|
||||
workshop.browse = Browse Workshop
|
||||
workshop.share = 分享到工作坊
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ public interface Platform{
|
||||
return uuid;
|
||||
}
|
||||
|
||||
/** Only used for iOS or android: open the share menu for a map or save. */
|
||||
/** Only used for iOS: open the share menu for a map or save. */
|
||||
default void shareFile(Fi file){
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,11 @@ public class UI implements ApplicationListener, Loadable{
|
||||
private final IntMap<WorldLabel> labels = new IntMap<>();
|
||||
|
||||
public UI(){
|
||||
Events.on(ResetEvent.class, e -> {
|
||||
labels.clear();
|
||||
popups.clear();
|
||||
});
|
||||
|
||||
Fonts.loadFonts();
|
||||
}
|
||||
|
||||
@@ -454,12 +459,14 @@ public class UI implements ApplicationListener, Loadable{
|
||||
return;
|
||||
}
|
||||
|
||||
var label = labels.get(id, WorldLabel::create); // todo: pool?
|
||||
var label = id == -1 ? WorldLabel.create() : labels.get(id, WorldLabel::create); // todo: pool?
|
||||
label.id = Integer.MIN_VALUE; //arbitrary value that won't be synced to, it's fine if IDs conflict
|
||||
label.x = worldx;
|
||||
label.y = worldy;
|
||||
label.text = info;
|
||||
label.flags = (byte)flags; // flag | flag2 at call site turns it into an int so the flags param here has to be int or casting has to be done at every call site
|
||||
label.duration = duration;
|
||||
label.duration = duration == Float.MAX_VALUE ? -1 : duration; // prefer -1 to Float.MAX_VALUE so that the update() function isn't called every tick
|
||||
if(id != -1 && label.duration >= 0 && label.expired == null) label.expired = () -> labels.remove(id); // only set once to prevent extra garbage for updated labels
|
||||
label.add();
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public class MapBundlesView implements AssetView{
|
||||
TextButtonStyle style = Styles.flatt;
|
||||
t.defaults().size(280f, 60f).left();
|
||||
t.row();
|
||||
t.button("@import.clipboard", Icon.copy, style, () -> {
|
||||
t.button("@load.clipboard", Icon.copy, style, () -> {
|
||||
dialog.hide();
|
||||
handler.get(Core.app.getClipboardText());
|
||||
}).marginLeft(12f).disabled(b -> Core.app.getClipboardText() == null);
|
||||
|
||||
@@ -116,7 +116,7 @@ public class MapContentView implements AssetView{
|
||||
TextButtonStyle style = Styles.flatt;
|
||||
t.defaults().size(280f, 60f).left();
|
||||
t.row();
|
||||
t.button("@import.clipboard", Icon.copy, style, () -> {
|
||||
t.button("@load.clipboard", Icon.copy, style, () -> {
|
||||
dialog.hide();
|
||||
handler.get(Core.app.getClipboardText());
|
||||
}).marginLeft(12f).disabled(b -> Core.app.getClipboardText() == null);
|
||||
|
||||
@@ -104,7 +104,7 @@ public class MapPatchesView implements AssetView{
|
||||
TextButtonStyle style = Styles.flatt;
|
||||
t.defaults().size(280f, 60f).left();
|
||||
t.row();
|
||||
t.button("@import.clipboard", Icon.copy, style, () -> {
|
||||
t.button("@load.clipboard", Icon.copy, style, () -> {
|
||||
dialog.hide();
|
||||
handler.get(Core.app.getClipboardText());
|
||||
}).marginLeft(12f).disabled(b -> Core.app.getClipboardText() == null);
|
||||
|
||||
@@ -1682,7 +1682,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
/** Update table alignment after configuring.*/
|
||||
public void updateTableAlign(Table table){
|
||||
Vec2 pos = Core.input.mouseScreen(x, y - block.size * tilesize / 2f - 1);
|
||||
table.setPosition(pos.x, pos.y, Align.top);
|
||||
table.setPosition(pos.x - Core.scene.marginLeft, pos.y - Core.scene.marginBottom, Align.top);
|
||||
}
|
||||
|
||||
/** Returns whether a hand cursor should be shown over this block. */
|
||||
|
||||
@@ -32,20 +32,24 @@ public abstract class WorldLabelComp implements Posc, Drawc, Syncc{
|
||||
public byte flags = flagBackground | flagOutline;
|
||||
/** If not null, this label gets set to the parent position with x, y used as offsets. */
|
||||
public @Nullable Posc parent;
|
||||
/** Duration in seconds. Ignored if zero or negative. */
|
||||
public transient float duration;
|
||||
/** Duration in seconds. Ignored if negative */
|
||||
public transient float duration = -1;
|
||||
public transient @Nullable Runnable expired;
|
||||
|
||||
@Replace
|
||||
public float clipSize(){
|
||||
if(parent != null) return Float.MAX_VALUE;
|
||||
return text.length() * 10f * fontSize;
|
||||
return text == null ? 0f : text.length() * 10f * fontSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
if(duration > 0){
|
||||
if(duration >= 0){
|
||||
duration -= Time.delta / 60f;
|
||||
if(duration <= 0) hide();
|
||||
if(duration <= 0){
|
||||
hide();
|
||||
if(expired != null) expired.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +64,7 @@ public abstract class WorldLabelComp implements Posc, Drawc, Syncc{
|
||||
}
|
||||
|
||||
public static void drawAt(String text, float x, float y, float layer, int flags, float fontSize, int align, int lineAlign){
|
||||
if(text == null) return;
|
||||
Draw.z(layer);
|
||||
float z = Drawf.text();
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ public class LogicDialog extends BaseDialog{
|
||||
Core.app.setClipboardText(canvas.save());
|
||||
}).marginLeft(12f).row();
|
||||
|
||||
t.button("@import.clipboard", Icon.download, style, () -> {
|
||||
t.button("@load.clipboard", Icon.download, style, () -> {
|
||||
dialog.hide();
|
||||
try{
|
||||
canvas.load(Core.app.getClipboardText().replace("\r\n", "\n"));
|
||||
|
||||
@@ -44,7 +44,6 @@ public class DataPatcher{
|
||||
private static DataPatcher currentDataPatcher;
|
||||
private static ContentParser parser = createParser();
|
||||
|
||||
|
||||
private boolean applied;
|
||||
private ContentLoader contentLoader;
|
||||
private ObjectSet<Object> usedpatches = new ObjectSet<>();
|
||||
@@ -109,49 +108,6 @@ public class DataPatcher{
|
||||
Attribute.map = oldAttributeMap;
|
||||
});
|
||||
|
||||
//patches are read first.
|
||||
for(var set : patches){
|
||||
set.warnings.clear();
|
||||
set.error = false;
|
||||
|
||||
try{
|
||||
Object someValue = parser.getJson().fromJson(null, Jval.read(set.patch).toString(Jformat.plain));
|
||||
if(!(someValue instanceof JsonValue value)) throw new SerializationException("Patch must be a JSON object.");
|
||||
|
||||
if(Vars.state.rules.planet != null && value.has("requiredPlanets")){
|
||||
JsonValue req = value.get("requiredPlanets");
|
||||
value.remove("requiredPlanets");
|
||||
|
||||
//this should be ignored unless this instance is a dedicated server
|
||||
if(Vars.headless){
|
||||
String[] planets = req.isArray() ? req.asStringArray() : new String[]{req.asString()};
|
||||
if(!Structs.contains(planets, Vars.state.rules.planet.name)){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set.json = value;
|
||||
currentlyApplyingPatch = set;
|
||||
visitStack.clear();
|
||||
|
||||
set.name = value.getString("name", "");
|
||||
value.remove("name"); //patchsets can have a name, ignore it if present
|
||||
for(var child : value){
|
||||
assign(root, child.name, child, null, null, null);
|
||||
}
|
||||
currentlyApplyingPatch = null;
|
||||
|
||||
}catch(Exception e){
|
||||
set.error = true;
|
||||
set.name = "";
|
||||
set.warnings.add(Strings.getSimpleMessage(e));
|
||||
currentlyApplyingPatch = null;
|
||||
|
||||
Log.err("Failed to apply patch: " + set.patch, e);
|
||||
}
|
||||
}
|
||||
|
||||
if(!content.isEmpty()){
|
||||
content.sort();
|
||||
|
||||
@@ -262,6 +218,48 @@ public class DataPatcher{
|
||||
if(reloadContentWorld) fixContentArrays();
|
||||
}
|
||||
|
||||
for(var set : patches){
|
||||
set.warnings.clear();
|
||||
set.error = false;
|
||||
|
||||
try{
|
||||
Object someValue = parser.getJson().fromJson(null, Jval.read(set.patch).toString(Jformat.plain));
|
||||
if(!(someValue instanceof JsonValue value)) throw new SerializationException("Patch must be a JSON object.");
|
||||
|
||||
if(Vars.state.rules.planet != null && value.has("requiredPlanets")){
|
||||
JsonValue req = value.get("requiredPlanets");
|
||||
value.remove("requiredPlanets");
|
||||
|
||||
//this should be ignored unless this instance is a dedicated server
|
||||
if(Vars.headless){
|
||||
String[] planets = req.isArray() ? req.asStringArray() : new String[]{req.asString()};
|
||||
if(!Structs.contains(planets, Vars.state.rules.planet.name)){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set.json = value;
|
||||
currentlyApplyingPatch = set;
|
||||
visitStack.clear();
|
||||
|
||||
set.name = value.getString("name", "");
|
||||
value.remove("name"); //patchsets can have a name, ignore it if present
|
||||
for(var child : value){
|
||||
assign(root, child.name, child, null, null, null);
|
||||
}
|
||||
currentlyApplyingPatch = null;
|
||||
|
||||
}catch(Exception e){
|
||||
set.error = true;
|
||||
set.name = "";
|
||||
set.warnings.add(Strings.getSimpleMessage(e));
|
||||
currentlyApplyingPatch = null;
|
||||
|
||||
Log.err("Failed to apply patch: " + set.patch, e);
|
||||
}
|
||||
}
|
||||
|
||||
afterCallbacks.each(Runnable::run);
|
||||
}
|
||||
|
||||
@@ -603,6 +601,7 @@ public class DataPatcher{
|
||||
Seq<Consume> prevBuilder = Reflect.<Seq<Consume>>get(Block.class, bl, "consumeBuilder").copy();
|
||||
boolean hadItems = bl.hasItems, hadLiquids = bl.hasLiquids, hadPower = bl.hasPower, acceptedItems = bl.acceptsItems;
|
||||
Runnable resetCons = () -> {
|
||||
if(bl.isPatchContent()) return; //useless
|
||||
Reflect.set(Block.class, bl, "consumeBuilder", prevBuilder);
|
||||
bl.reinitializeConsumers();
|
||||
bl.hasItems = hadItems;
|
||||
|
||||
@@ -231,7 +231,7 @@ public class SchematicsDialog extends BaseDialog{
|
||||
TextButtonStyle style = Styles.flatt;
|
||||
t.defaults().size(280f, 60f).left();
|
||||
t.row();
|
||||
t.button("@import.clipboard", Icon.copy, style, () -> {
|
||||
t.button("@load.clipboard", Icon.copy, style, () -> {
|
||||
dialog.hide();
|
||||
try{
|
||||
Schematic s = Schematics.readBase64(Core.app.getClipboardText());
|
||||
|
||||
@@ -233,7 +233,7 @@ public class BlockInventoryFragment{
|
||||
private void updateTablePosition(){
|
||||
Vec2 v = Core.input.mouseScreen(build.x + build.block.size * tilesize / 2f, build.y + build.block.size * tilesize / 2f);
|
||||
table.pack();
|
||||
table.setPosition(v.x, v.y, Align.topLeft);
|
||||
table.setPosition(v.x - Core.scene.marginLeft, v.y - Core.scene.marginBottom, Align.topLeft);
|
||||
}
|
||||
|
||||
private Element itemImage(TextureRegion region, Prov<CharSequence> text){
|
||||
|
||||
@@ -45,8 +45,14 @@ public class DirectionalUnloader extends Block{
|
||||
drawCached = true;
|
||||
drawDynamic = false;
|
||||
|
||||
config(Item.class, (DirectionalUnloaderBuild tile, Item item) -> tile.unloadItem = item);
|
||||
configClear((DirectionalUnloaderBuild tile) -> tile.unloadItem = null);
|
||||
config(Item.class, (DirectionalUnloaderBuild tile, Item item) -> {
|
||||
tile.unloadItem = item;
|
||||
tile.recache();
|
||||
});
|
||||
configClear((DirectionalUnloaderBuild tile) -> {
|
||||
tile.unloadItem = null;
|
||||
tile.recache();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -620,6 +620,7 @@ public class LogicBlock extends Block{
|
||||
}
|
||||
|
||||
private @Nullable Building optionalLink(String name){
|
||||
if(name == null || name.isEmpty()) return null;
|
||||
// Quick check the name can even be a link to avoid building/using the map needlessly
|
||||
char ch = name.charAt(name.length() - 1);
|
||||
if(ch < '0' || ch > '9') return null;
|
||||
|
||||
Reference in New Issue
Block a user