mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-25 05:51:47 -08:00
Fixed #11498
This commit is contained in:
parent
c3b8abf3e5
commit
db3c4fd8f7
3 changed files with 19 additions and 12 deletions
|
|
@ -145,9 +145,7 @@ public class Logic implements ApplicationListener{
|
|||
|
||||
Events.on(BlockDestroyEvent.class, e -> {
|
||||
if(e.tile.build instanceof CoreBuild core && core.team.isAI() && state.rules.coreDestroyClear){
|
||||
Core.app.post(() -> {
|
||||
core.team.data().timeDestroy(core.x, core.y, state.rules.enemyCoreBuildRadius);
|
||||
});
|
||||
Core.app.post(() -> core.team.data().timeDestroy(core.x, core.y, state.rules.enemyCoreBuildRadius));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -178,6 +178,8 @@ public class Damage{
|
|||
}
|
||||
|
||||
public static float findPierceLength(Bullet b, int pierceCap, boolean laser, float length){
|
||||
if(pierceCap <= 0) return length;
|
||||
|
||||
vec.trnsExact(b.rotation(), length);
|
||||
rect.setPosition(b.x, b.y).setSize(vec.x, vec.y).normalize().grow(3f);
|
||||
|
||||
|
|
@ -215,7 +217,7 @@ public class Damage{
|
|||
|
||||
//return either the length when not enough things were pierced,
|
||||
//or the last pierced object if there were enough blockages
|
||||
return Math.min(distances.size < pierceCap || pierceCap < 0 ? length : Math.max(6f, distances.get(pierceCap - 1)), maxDst);
|
||||
return Math.min(distances.size < pierceCap ? length : Math.max(6f, distances.get(pierceCap - 1)), maxDst);
|
||||
}
|
||||
|
||||
/** Collides a bullet with blocks in a laser, taking into account absorption blocks. Resulting length is stored in the bullet's fdata. */
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import arc.struct.*;
|
|||
import arc.util.*;
|
||||
import arc.util.serialization.Json.*;
|
||||
import arc.util.serialization.*;
|
||||
import arc.util.serialization.JsonWriter.*;
|
||||
import arc.util.serialization.Jval.*;
|
||||
import mindustry.*;
|
||||
import mindustry.core.*;
|
||||
|
|
@ -553,14 +554,14 @@ public class DataPatcher{
|
|||
|
||||
static Object copyArray(Object object){
|
||||
if(object instanceof int[] i) return i.clone();
|
||||
if(object instanceof long[] i) return i.clone();
|
||||
if(object instanceof short[] i) return i.clone();
|
||||
if(object instanceof byte[] i) return i.clone();
|
||||
if(object instanceof boolean[] i) return i.clone();
|
||||
if(object instanceof char[] i) return i.clone();
|
||||
if(object instanceof float[] i) return i.clone();
|
||||
if(object instanceof double[] i) return i.clone();
|
||||
return ((Object[])object).clone();
|
||||
else if(object instanceof long[] i) return i.clone();
|
||||
else if(object instanceof short[] i) return i.clone();
|
||||
else if(object instanceof byte[] i) return i.clone();
|
||||
else if(object instanceof boolean[] i) return i.clone();
|
||||
else if(object instanceof char[] i) return i.clone();
|
||||
else if(object instanceof float[] i) return i.clone();
|
||||
else if(object instanceof double[] i) return i.clone();
|
||||
else return ((Object[])object).clone();
|
||||
}
|
||||
|
||||
public static class PatchSet{
|
||||
|
|
@ -574,6 +575,12 @@ public class DataPatcher{
|
|||
this.patch = patch;
|
||||
this.json = json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
//the json can be a single 'error' value if it failed to parse
|
||||
return !json.isObject() ? patch : json.prettyPrint(OutputType.minimal, 2);
|
||||
}
|
||||
}
|
||||
|
||||
private static class FieldData{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue