Misc improvements / Latum death unit spawning

This commit is contained in:
Anuken
2022-06-23 13:16:25 -04:00
parent 226d0a9f32
commit 4ba5be8d31
12 changed files with 108 additions and 21 deletions

View File

@@ -3,6 +3,7 @@ package mindustry.graphics;
import arc.*;
import arc.graphics.*;
import arc.graphics.gl.*;
import arc.math.*;
import arc.util.*;
import static mindustry.Vars.*;
@@ -31,6 +32,19 @@ public class CacheLayer{
}
}
/** Adds a cache layer at a certain position. All layers >= this index are shifted upwards.*/
public static void add(int index, CacheLayer layer){
index = Mathf.clamp(index, 0, all.length - 1);
var prev = all;
all = new CacheLayer[all.length + 1];
System.arraycopy(prev, 0, all, 0, index);
System.arraycopy(prev, index, all, index + 1, prev.length - index);
all[index] = layer;
}
/** Loads default cache layers. */
public static void init(){
add(