Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features

This commit is contained in:
Anuken
2021-09-15 20:51:57 -04:00
15 changed files with 77 additions and 56 deletions

View File

@@ -29,7 +29,7 @@ task deploy(type: Copy){
} }
android{ android{
buildToolsVersion '30.0.2' buildToolsVersion '30.0.3'
compileSdkVersion 30 compileSdkVersion 30
sourceSets{ sourceSets{
main{ main{
@@ -139,8 +139,8 @@ dependencies{
gpImplementation "com.google.android.gms:play-services-games:21.0.0" gpImplementation "com.google.android.gms:play-services-games:21.0.0"
gpImplementation "com.google.android.gms:play-services-auth:19.0.0" gpImplementation "com.google.android.gms:play-services-auth:19.0.0"
//android dependencies magically disappear during compilation, thanks gradle! //TODO dynamically find best android platform jar instead of hard-coding to 30
def sdkFile = new File((String)findSdkDir(), "/platforms/android-29/android.jar") def sdkFile = new File((String)findSdkDir(), "/platforms/android-30/android.jar")
if(sdkFile.exists()) compileOnly files(sdkFile.absolutePath) if(sdkFile.exists()) compileOnly files(sdkFile.absolutePath)
} }

View File

@@ -13,28 +13,10 @@ buildscript{
google() google()
maven{ url "https://oss.sonatype.org/content/repositories/snapshots/" } maven{ url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven{ url 'https://jitpack.io' } maven{ url 'https://jitpack.io' }
//fake repository to download my patched robovm jar from
ivy{
url 'https://github.com/'
patternLayout {
artifact '/[organisation]/[module]/raw/a-single-jar-file/[revision].jar'
}
// This is required in Gradle 6.0+ as metadata file (ivy.xml)
// is mandatory. Docs linked below this code section
metadataSources { artifact() }
}
} }
dependencies{ dependencies{
//use local, patched robovm gradle plugin until my PR for gradle 7.0 support is merged classpath "com.mobidevelop.robovm:robovm-gradle-plugin:2.3.14"
//https://github.com/Anuken/robovm/raw/a-single-jar-file/robovm-gradle-plugin-2.3.14-SNAPSHOT.jar
classpath "Anuken:robovm:robovm-gradle-plugin-2.3.14-SNAPSHOT"
//needed for plugin above
classpath "com.mobidevelop.robovm:robovm-dist-compiler:2.3.13"
classpath "com.github.Anuken.Arc:packer:$arcHash" classpath "com.github.Anuken.Arc:packer:$arcHash"
classpath "com.github.Anuken.Arc:arc-core:$arcHash" classpath "com.github.Anuken.Arc:arc-core:$arcHash"
} }
@@ -285,7 +267,7 @@ project(":ios"){
props.load(new FileInputStream(vfile)) props.load(new FileInputStream(vfile))
}else{ }else{
props['app.id'] = 'io.anuke.mindustry' props['app.id'] = 'io.anuke.mindustry'
props['app.version'] = '6.0' props['app.version'] = '7.0'
props['app.mainclass'] = 'mindustry.IOSLauncher' props['app.mainclass'] = 'mindustry.IOSLauncher'
props['app.executable'] = 'IOSLauncher' props['app.executable'] = 'IOSLauncher'
props['app.name'] = 'Mindustry' props['app.name'] = 'Mindustry'

View File

@@ -217,7 +217,7 @@ hosts.none = [lightgray]No se han encontrado partidas en LAN
host.invalid = [scarlet]No se pudo conectar con el anfitrión host.invalid = [scarlet]No se pudo conectar con el anfitrión
servers.local = Servidores Locales servers.local = Servidores Locales
servers.local.steam = Partidas Públicas y Lervidores Locales servers.local.steam = Partidas Públicas y Servidores Locales
servers.remote = Servidores Remotos servers.remote = Servidores Remotos
servers.global = Servidores de la Comunidad servers.global = Servidores de la Comunidad

View File

@@ -78,13 +78,12 @@ schematic.tagexists = Такой тег уже существует.
stats = Статистика stats = Статистика
stat.wave = Волн отражено:[accent] {0} stat.wave = Волн отражено:[accent] {0}
stat.unitsCreated = Единиц создано:[accent] {0}
stat.enemiesDestroyed = Врагов уничтожено:[accent] {0} stat.enemiesDestroyed = Врагов уничтожено:[accent] {0}
stat.built = Строений построено:[accent] {0} stat.built = Строений построено:[accent] {0}
stat.destroyed = Строений уничтожено:[accent] {0} stat.destroyed = Строений уничтожено:[accent] {0}
stat.deconstructed = Строений разобрано:[accent] {0} stat.deconstructed = Строений разобрано:[accent] {0}
stat.delivered = Ресурсов запущено:
stat.playtime = Время игры:[accent] {0} stat.playtime = Время игры:[accent] {0}
stat.rank = Финальный ранг: [accent]{0}
globalitems = [accent]Общие предметы globalitems = [accent]Общие предметы
map.delete = Вы действительно хотите удалить карту «[accent]{0}[]»? map.delete = Вы действительно хотите удалить карту «[accent]{0}[]»?
@@ -392,6 +391,8 @@ waves.load = Загрузить из буфера обмена
waves.invalid = Неверные волны в буфере обмена. waves.invalid = Неверные волны в буфере обмена.
waves.copied = Волны скопированы. waves.copied = Волны скопированы.
waves.none = Враги не были определены.\nОбратите внимание, что пустые волны будут автоматически заменены обычной волной. waves.none = Враги не были определены.\nОбратите внимание, что пустые волны будут автоматически заменены обычной волной.
waves.units.hide = Скрыть все
waves.units.show = Показать все
#these are intentionally in lower case #these are intentionally in lower case
wavemode.counts = количество единиц wavemode.counts = количество единиц
@@ -444,6 +445,7 @@ editor.overwrite = [accent]Внимание!\nЭто перезапишет уж
editor.overwrite.confirm = [scarlet]Осторожно![] Карта с таким названием уже существует. Вы действительно хотите её перезаписать?\n«[accent]{0}[]» editor.overwrite.confirm = [scarlet]Осторожно![] Карта с таким названием уже существует. Вы действительно хотите её перезаписать?\n«[accent]{0}[]»
editor.exists = Карта с таким именем уже существует. editor.exists = Карта с таким именем уже существует.
editor.selectmap = Выберите карту для загрузки: editor.selectmap = Выберите карту для загрузки:
editor.cliffs = Стены на скалы
toolmode.replace = Заменить toolmode.replace = Заменить
toolmode.replace.description = Рисует только\nна сплошных блоках. toolmode.replace.description = Рисует только\nна сплошных блоках.
@@ -649,6 +651,7 @@ status.overclock.name = Разгон
status.shocked.name = Шок status.shocked.name = Шок
status.blasted.name = Разрыв status.blasted.name = Разрыв
status.unmoving.name = Обездвиживание status.unmoving.name = Обездвиживание
status.boss.name = Страж
settings.language = Язык settings.language = Язык
settings.data = Игровые данные settings.data = Игровые данные
@@ -1137,6 +1140,7 @@ block.core-shard.name = Ядро: «Осколок»
block.core-foundation.name = Ядро: «Штаб» block.core-foundation.name = Ядро: «Штаб»
block.core-nucleus.name = Ядро: «Атом» block.core-nucleus.name = Ядро: «Атом»
block.deep-water.name = Глубоководье block.deep-water.name = Глубоководье
block.deep-tainted-water.name = Загрязнённое глубоководье
block.shallow-water.name = Вода block.shallow-water.name = Вода
block.tainted-water.name = Загрязнённая вода block.tainted-water.name = Загрязнённая вода
block.darksand-tainted-water.name = Тёмный песок с загрязнённой водой block.darksand-tainted-water.name = Тёмный песок с загрязнённой водой
@@ -1374,6 +1378,7 @@ hint.coreUpgrade = Ядра могут быть улучшены путем [acc
hint.presetLaunch = В серые [accent]секторы с посадочными зонами[], такие как [accent]Ледяной лес[], можно запускаться из любого места. Они не требуют захвата близлежащей территории.\n\n[accent]Нумерованные секторы[], такие как этот, [accent]не обязательны[] для прохождения. hint.presetLaunch = В серые [accent]секторы с посадочными зонами[], такие как [accent]Ледяной лес[], можно запускаться из любого места. Они не требуют захвата близлежащей территории.\n\n[accent]Нумерованные секторы[], такие как этот, [accent]не обязательны[] для прохождения.
hint.coreIncinerate = После того, как ядро будет заполнено предметом до отказа, любые лишние входящие предметы этого типа будут [accent]сожжены[]. hint.coreIncinerate = После того, как ядро будет заполнено предметом до отказа, любые лишние входящие предметы этого типа будут [accent]сожжены[].
hint.coopCampaign = Во время игры в [accent]кампанию по сети[], произведённые на текущей карте предметы будут также отправлены [accent]на ваши локальные секторы[].\n\nЛюбое исследование со стороны хоста также будет перенесено. hint.coopCampaign = Во время игры в [accent]кампанию по сети[], произведённые на текущей карте предметы будут также отправлены [accent]на ваши локальные секторы[].\n\nЛюбое исследование со стороны хоста также будет перенесено.
hint.presetDifficulty = У этого сектора [scarlet]высокий уровень угрозы[].\nЗапуск на такие сектора [accent]не рекомендуется[] без достаточных технологий и подготовки.
item.copper.description = Используется во всех типах построек и боеприпасов. item.copper.description = Используется во всех типах построек и боеприпасов.
item.copper.details = Медь. Аномально широко распространённый металл на Серпуло. Структурно слабый, если не укреплён. item.copper.details = Медь. Аномально широко распространённый металл на Серпуло. Структурно слабый, если не укреплён.

View File

@@ -40,7 +40,7 @@ public class Vars implements Loadable{
public static boolean loadLocales = true; public static boolean loadLocales = true;
/** Whether the logger is loaded. */ /** Whether the logger is loaded. */
public static boolean loadedLogger = false, loadedFileLogger = false; public static boolean loadedLogger = false, loadedFileLogger = false;
/** Whether to enable various experimental features (e.g. cliffs) */ /** Whether to enable various experimental features (e.g. spawn positions for spawn groups) */
public static boolean experimental = false; public static boolean experimental = false;
/** Name of current Steam player. */ /** Name of current Steam player. */
public static String steamPlayerName = ""; public static String steamPlayerName = "";

View File

@@ -369,13 +369,13 @@ public class Fx{
Fill.circle(e.x, e.y, e.fin() * 10); Fill.circle(e.x, e.y, e.fin() * 10);
Drawf.light(e.x, e.y, e.fin() * 20f, Pal.heal, 0.7f); Drawf.light(e.x, e.y, e.fin() * 20f, Pal.heal, 0.7f);
}), }).followParent(true),
greenLaserChargeSmall = new Effect(40f, 100f, e -> { greenLaserChargeSmall = new Effect(40f, 100f, e -> {
color(Pal.heal); color(Pal.heal);
stroke(e.fin() * 2f); stroke(e.fin() * 2f);
Lines.circle(e.x, e.y, e.fout() * 50f); Lines.circle(e.x, e.y, e.fout() * 50f);
}), }).followParent(true),
greenCloud = new Effect(80f, e -> { greenCloud = new Effect(80f, e -> {
color(Pal.heal); color(Pal.heal);

View File

@@ -452,6 +452,7 @@ public class UnitTypes implements ContentList{
x = y = 0f; x = y = 0f;
firstShotDelay = Fx.greenLaserChargeSmall.lifetime - 1f; firstShotDelay = Fx.greenLaserChargeSmall.lifetime - 1f;
parentizeEffects = true;
reload = 155f; reload = 155f;
recoil = 0f; recoil = 0f;
@@ -541,6 +542,7 @@ public class UnitTypes implements ContentList{
shootStatusDuration = 60f * 2f; shootStatusDuration = 60f * 2f;
shootStatus = StatusEffects.unmoving; shootStatus = StatusEffects.unmoving;
firstShotDelay = Fx.greenLaserCharge.lifetime; firstShotDelay = Fx.greenLaserCharge.lifetime;
parentizeEffects = true;
bullet = new LaserBulletType(){{ bullet = new LaserBulletType(){{
length = 460f; length = 460f;

View File

@@ -1,9 +1,14 @@
package mindustry.core; package mindustry.core;
import arc.*; import arc.*;
import arc.assets.*;
import arc.assets.loaders.*; import arc.assets.loaders.*;
import arc.assets.loaders.MusicLoader.*;
import arc.assets.loaders.SoundLoader.*;
import arc.audio.*;
import arc.files.*; import arc.files.*;
import arc.struct.*; import arc.struct.*;
import mindustry.*;
/** Handles files in a modded context. */ /** Handles files in a modded context. */
public class FileTree implements FileHandleResolver{ public class FileTree implements FileHandleResolver{
@@ -40,4 +45,30 @@ public class FileTree implements FileHandleResolver{
public Fi resolve(String fileName){ public Fi resolve(String fileName){
return get(fileName); return get(fileName);
} }
public Sound loadSound(String soundName){
if(Vars.headless) return new Sound();
String name = "sounds/" + soundName;
String path = Vars.tree.get(name + ".ogg").exists() ? name + ".ogg" : name + ".mp3";
var sound = new Sound();
AssetDescriptor<?> desc = Core.assets.load(path, Sound.class, new SoundParameter(sound));
desc.errored = Throwable::printStackTrace;
return sound;
}
public Music loadMusic(String soundName){
if(Vars.headless) return new Music();
String name = "music/" + soundName;
String path = Vars.tree.get(name + ".ogg").exists() ? name + ".ogg" : name + ".mp3";
var music = new Music();
AssetDescriptor<?> desc = Core.assets.load(path, Music.class, new MusicParameter(music));
desc.errored = Throwable::printStackTrace;
return music;
}
} }

View File

@@ -68,7 +68,7 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
public TextureRegion icon(){ public TextureRegion icon(){
//display default icon for dead players //display default icon for dead players
if(dead()) return core() == null ? UnitTypes.alpha.fullIcon : ((CoreBlock)core().block).unitType.fullIcon; if(dead()) return core() == null ? UnitTypes.alpha.fullIcon : ((CoreBlock)bestCore().block).unitType.fullIcon;
return unit.icon(); return unit.icon();
} }

View File

@@ -48,6 +48,7 @@ public class ContentParser{
ObjectMap<Class<?>, ContentType> contentTypes = new ObjectMap<>(); ObjectMap<Class<?>, ContentType> contentTypes = new ObjectMap<>();
ObjectSet<Class<?>> implicitNullable = ObjectSet.with(TextureRegion.class, TextureRegion[].class, TextureRegion[][].class); ObjectSet<Class<?>> implicitNullable = ObjectSet.with(TextureRegion.class, TextureRegion[].class, TextureRegion[][].class);
ObjectMap<String, AssetDescriptor<?>> sounds = new ObjectMap<>(); ObjectMap<String, AssetDescriptor<?>> sounds = new ObjectMap<>();
Seq<ParseListener> listeners = new Seq<>();
ObjectMap<Class<?>, FieldParser> classParsers = new ObjectMap<>(){{ ObjectMap<Class<?>, FieldParser> classParsers = new ObjectMap<>(){{
put(Effect.class, (type, data) -> { put(Effect.class, (type, data) -> {
@@ -178,7 +179,10 @@ public class ContentParser{
@Override @Override
public <T> T readValue(Class<T> type, Class elementType, JsonValue jsonData, Class keyType){ public <T> T readValue(Class<T> type, Class elementType, JsonValue jsonData, Class keyType){
T t = internalRead(type, elementType, jsonData, keyType); T t = internalRead(type, elementType, jsonData, keyType);
if(t != null) checkNullFields(t); if(t != null && !Reflect.isWrapper(t.getClass()) && (type == null || !type.isPrimitive())){
checkNullFields(t);
listeners.each(hook -> hook.parsed(type, jsonData, t));
}
return t; return t;
} }
@@ -805,4 +809,8 @@ public class ContentParser{
public float time = 60f * 10f; public float time = 60f * 10f;
} }
public interface ParseListener{
void parsed(Class<?> type, JsonValue jsonData, Object result);
}
} }

View File

@@ -21,6 +21,7 @@ import mindustry.game.EventType.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.graphics.MultiPacker.*; import mindustry.graphics.MultiPacker.*;
import mindustry.mod.ContentParser.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.ui.*; import mindustry.ui.*;
@@ -651,6 +652,11 @@ public class Mods implements Loadable{
parser.markError(content, error); parser.markError(content, error);
} }
/** Adds a listener for parsed JSON objects. */
public void addParseListener(ParseListener hook){
parser.listeners.add(hook);
}
/** @return a list of mods and versions, in the format name:version. */ /** @return a list of mods and versions, in the format name:version. */
public Seq<String> getModStrings(){ public Seq<String> getModStrings(){
return mods.select(l -> !l.meta.hidden && l.enabled()).map(l -> l.name + ":" + l.meta.version); return mods.select(l -> !l.meta.hidden && l.enabled()).map(l -> l.name + ":" + l.meta.version);

View File

@@ -1,9 +1,6 @@
package mindustry.mod; package mindustry.mod;
import arc.*; import arc.*;
import arc.assets.*;
import arc.assets.loaders.MusicLoader.*;
import arc.assets.loaders.SoundLoader.*;
import arc.audio.*; import arc.audio.*;
import arc.files.*; import arc.files.*;
import arc.func.*; import arc.func.*;
@@ -85,30 +82,14 @@ public class Scripts implements Disposable{
return Vars.tree.get(path, true).readBytes(); return Vars.tree.get(path, true).readBytes();
} }
//kept for backwards compatibility
public Sound loadSound(String soundName){ public Sound loadSound(String soundName){
if(Vars.headless) return new Sound(); return Vars.tree.loadSound(soundName);
String name = "sounds/" + soundName;
String path = Vars.tree.get(name + ".ogg").exists() ? name + ".ogg" : name + ".mp3";
var sound = new Sound();
AssetDescriptor<?> desc = Core.assets.load(path, Sound.class, new SoundParameter(sound));
desc.errored = Throwable::printStackTrace;
return sound;
} }
//kept for backwards compatibility
public Music loadMusic(String soundName){ public Music loadMusic(String soundName){
if(Vars.headless) return new Music(); return Vars.tree.loadMusic(soundName);
String name = "music/" + soundName;
String path = Vars.tree.get(name + ".ogg").exists() ? name + ".ogg" : name + ".mp3";
var music = new Music();
AssetDescriptor<?> desc = Core.assets.load(path, Music.class, new MusicParameter(music));
desc.errored = Throwable::printStackTrace;
return music;
} }
/** Ask the user to select a file to read for a certain purpose like "Please upload a sprite" */ /** Ask the user to select a file to read for a certain purpose like "Please upload a sprite" */

View File

@@ -91,6 +91,8 @@ public class Weapon implements Cloneable{
public boolean ignoreRotation = false; public boolean ignoreRotation = false;
/** min velocity required for this weapon to shoot */ /** min velocity required for this weapon to shoot */
public float minShootVelocity = -1f; public float minShootVelocity = -1f;
/** should the shoot effects follow the unit (effects need followParent set to true for this to work) */
public boolean parentizeEffects;
/** internal value used for alternation - do not change! */ /** internal value used for alternation - do not change! */
public int otherSide = -1; public int otherSide = -1;
/** sound used for shooting */ /** sound used for shooting */
@@ -333,7 +335,7 @@ public class Weapon implements Cloneable{
Angles.shotgun(shots, spacing, rotation, f -> mount.bullet = bullet(unit, shootX, shootY, f + Mathf.range(inaccuracy), lifeScl)); Angles.shotgun(shots, spacing, rotation, f -> mount.bullet = bullet(unit, shootX, shootY, f + Mathf.range(inaccuracy), lifeScl));
} }
boolean parentize = ammo.keepVelocity; boolean parentize = ammo.keepVelocity || parentizeEffects;
if(delay){ if(delay){
Time.run(firstShotDelay, () -> { Time.run(firstShotDelay, () -> {

View File

@@ -11,4 +11,4 @@ android.useAndroidX=true
#used for slow jitpack builds; TODO see if this actually works #used for slow jitpack builds; TODO see if this actually works
http.socketTimeout=80000 http.socketTimeout=80000
http.connectionTimeout=80000 http.connectionTimeout=80000
archash=72627de9b81e7143af4ebe1d1f9d54099ade8fd3 archash=43f8f93e80779f91fad622acfae70cdc300edecf

View File

@@ -42,5 +42,9 @@
{ {
"name": "Korea", "name": "Korea",
"address": ["mindustry.kr"] "address": ["mindustry.kr"]
},
{
"name": "SubZero",
"address": ["minty-server.ddns.net"]
} }
] ]