1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-21 05:17:50 +03:00
This commit is contained in:
Anuken 2020-12-04 18:55:37 -05:00
parent 6af015cc05
commit 7ec3ab5a17
5 changed files with 71 additions and 45 deletions

View File

@ -114,6 +114,9 @@ public class BaseAI{
}
calcPath.add(calcTile.pos());
for(Point2 p : Geometry.d8){
calcPath.add(Point2.pack(p.x + calcTile.x, p.y + calcTile.y));
}
//found the end.
if(calcTile.build instanceof CoreBuild b && b.team == state.rules.defaultTeam){

View File

@ -151,9 +151,18 @@ public class BaseGenerator{
//clear path for ground units
for(Tile tile : cores){
Astar.pathfind(tile, spawn, t -> t.team() == state.rules.waveTeam && !t.within(tile, 25f * 8) ? 100000 : t.floor().hasSurface() ? 1 : 10, t -> !t.block().isStatic()).each(t -> {
if(t.team() == state.rules.waveTeam && !t.within(tile, 25f * 8)){
if(!t.within(tile, 25f * 8)){
if(t.team() == state.rules.waveTeam){
t.setBlock(Blocks.air);
}
for(Point2 p : Geometry.d8){
Tile other = t.nearby(p);
if(other != null && other.team() == state.rules.waveTeam){
other.setBlock(Blocks.air);
}
}
}
});
}
}

View File

@ -541,12 +541,14 @@ public class JoinDialog extends BaseDialog{
Log.info("Fetched @ community servers.", defaultServers.size);
}catch(Throwable e){
Log.err("Failed to parse community servers.");
Log.err(e);
}
});
}catch(Throwable e){
Log.err("Failed to fetch community servers.");
Log.err(e);
}
}, t -> {});
}, Log::err);
}
private void saveServers(){

View File

@ -6,9 +6,12 @@ import arc.files.*;
import arc.func.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.scene.style.*;
import arc.scene.ui.TextButton.*;
import arc.struct.*;
import arc.util.*;
import arc.util.io.*;
import mindustry.ctype.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.mod.Mods.*;
@ -266,36 +269,38 @@ public class ModsDialog extends BaseDialog{
desc.add("@editor.description").padRight(10).color(Color.gray).top();
desc.row();
desc.add(mod.meta.description).growX().wrap().padTop(2);
desc.row();
}
//TODO add this when mods work properly
/*
Array<UnlockableContent> all = Array.with(content.getContentMap()).<Content>flatten().select(c -> c.minfo.mod == mod && c instanceof UnlockableContent).as(UnlockableContent.class);
}).width(400f);
//TODO maybe enable later
if(false){
Seq<UnlockableContent> all = Seq.with(content.getContentMap()).<Content>flatten().select(c -> c.minfo.mod == mod && c instanceof UnlockableContent).as();
if(all.any()){
desc.add("@mod.content").padRight(10).color(Color.gray).top();
desc.row();
desc.pane(cs -> {
dialog.cont.row();
dialog.cont.pane(cs -> {
int i = 0;
for(UnlockableContent c : all){
cs.addImageButton(new TextureRegionDrawable(c.icon(Cicon.medium)), () -> {
cs.button(new TextureRegionDrawable(c.icon(Cicon.medium)), Styles.cleari, Cicon.medium.size, () -> {
ui.content.show(c);
}).size(50f).with(im -> {
var click = im.getClickListener();
im.update(() -> im.getImage().color.lerp(!click.isOver() ? Color.lightGray : Color.white, 0.4f * Time.delta));
});
if(++i % 8 == 0) cs.row();
}
}).growX().minHeight(60f);
}*/
}).width(400f);
}
}
dialog.show();
}
private void githubImport(String branch, String repo, Cons<HttpStatus> err){
Core.net.httpGet("http://api.github.com/repos/" + repo + "/zipball/" + branch, loc -> {
Core.net.httpGet(loc.getHeader("Location"), result -> {
if(result.getStatus() != HttpStatus.OK){
err.get(result.getStatus());
}else{
private void handleMod(String repo, HttpResponse result){
try{
Fi file = tmpDirectory.child(repo.replace("/", "") + ".zip");
Streams.copy(result.getResultAsStream(), file.write(false));
@ -313,7 +318,24 @@ public class ModsDialog extends BaseDialog{
modError(e);
}
}
private void githubImport(String branch, String repo, Cons<HttpStatus> err){
Core.net.httpGet("https://api.github.com/repos/" + repo + "/zipball/" + branch, loc -> {
if(loc.getStatus() == HttpStatus.OK){
if(loc.getHeader("Location") != null){
Core.net.httpGet(loc.getHeader("Location"), result -> {
if(result.getStatus() != HttpStatus.OK){
err.get(result.getStatus());
}else{
handleMod(repo, result);
}
}, t2 -> Core.app.post(() -> modError(t2)));
}else{
handleMod(repo, loc);
}
}else{
err.get(loc.getStatus());
}
}, t2 -> Core.app.post(() -> modError(t2)));
}
}

View File

@ -88,23 +88,13 @@
"jre/lib/amd64/libdt_socket.so",
"jre/lib/amd64/libsplashscreen.so",
"jre/lib/amd64/libunpack.so",
"jre/lib/amd64/liblcms.so",
"jre/lib/amd64/libnpt.so",
"jre/lib/amd64/libmlib_image.so",
"jre/lib/amd64/libjsig.so",
"jre/lib/amd64/libinstrument.so",
"jre/lib/amd64/libjaas_unix.so",
"jre/lib/amd64/libj2pcsc.so",
"jre/lib/amd64/libsaproc.so",
"jre/lib/amd64/libsunec.so",
"jre/lib/amd64/libj2pkcs11.so",
"jre/lib/amd64/libjsdt.so",
"jre/lib/amd64/libjdwp.so",
"jre/lib/amd64/libjava_crw_demo.so",
"jre/lib/amd64/libfreetype.so",
"jre/lib/amd64/libmanagement.so",
"jre/lib/amd64/libsctp.so",
"jre/lib/amd64/libj2gss.so",
"jre/lib/amd64/libjpeg.so",
"jre/lib/amd64/libfreetype.so.6",
"jre/lib/amd64/libjsoundalsa.so",