Add a copy button to spawn groups (#5957)

* copy button

* rebuild groups on removal

* two factor sorting

* copy method for spawngroup

* implement Clonable

* revert to copy to call clone
This commit is contained in:
TranquillyUnpleasant
2021-09-10 04:38:56 +05:00
committed by GitHub
parent 08d7390775
commit 9076325fa1
2 changed files with 24 additions and 8 deletions

View File

@@ -19,7 +19,7 @@ import static mindustry.Vars.*;
* weapon equipped, ammo used, and status effects.
* Each spawn group can have multiple sub-groups spawned in different areas of the map.
*/
public class SpawnGroup implements JsonSerializable{
public class SpawnGroup implements JsonSerializable, Cloneable{
public static final int never = Integer.MAX_VALUE;
/** The unit type spawned */
@@ -157,6 +157,14 @@ public class SpawnGroup implements JsonSerializable{
'}';
}
public SpawnGroup copy(){
try {
return (SpawnGroup)clone();
}catch(CloneNotSupportedException how){
throw new RuntimeException("If you see this, what did you even do?", how);
}
}
@Override
public boolean equals(Object o){
if(this == o) return true;