Fixed database opening when selecting commanded units
This commit is contained in:
@@ -8,6 +8,7 @@ import arc.scene.*;
|
|||||||
import arc.scene.event.*;
|
import arc.scene.event.*;
|
||||||
import arc.scene.style.*;
|
import arc.scene.style.*;
|
||||||
import arc.scene.ui.*;
|
import arc.scene.ui.*;
|
||||||
|
import arc.scene.ui.Tooltip.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
@@ -466,7 +467,10 @@ public class PlacementFragment{
|
|||||||
for(int i = 0; i < counts.length; i++){
|
for(int i = 0; i < counts.length; i++){
|
||||||
if(counts[i] > 0){
|
if(counts[i] > 0){
|
||||||
var type = content.unit(i);
|
var type = content.unit(i);
|
||||||
unitlist.add(StatValues.stack(type, counts[i])).tooltip(type.localizedName).pad(4).with(b -> {
|
unitlist.add(StatValues.stack(type, counts[i])).pad(4).with(b -> {
|
||||||
|
b.clearListeners();
|
||||||
|
b.addListener(Tooltips.getInstance().create(type.localizedName, false));
|
||||||
|
|
||||||
var listener = new ClickListener();
|
var listener = new ClickListener();
|
||||||
|
|
||||||
//left click -> select
|
//left click -> select
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
import arc.util.*;
|
|
||||||
import mindustry.*;
|
|
||||||
import mindustry.gen.*;
|
|
||||||
import mindustry.type.*;
|
|
||||||
import org.junit.jupiter.api.*;
|
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
|
|
||||||
//grabs a version-locked Heavy Armaments Industries commit and makes sure it initializes correctly
|
|
||||||
//this mod was chosen because:
|
|
||||||
//- it is one of the top JS mods, based on stars
|
|
||||||
//- it contains both JS and JSON, which can be used to test compatibility of the two
|
|
||||||
//- it can be used server-side (unlike FactoryDustry, which is a client-side texture pack that cannot be tested here)
|
|
||||||
public class ModTestHAI extends GenericModTest{
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void begin(){
|
|
||||||
//TODO broken as of 136+
|
|
||||||
if(true) return;
|
|
||||||
|
|
||||||
grabMod("https://github.com/Eschatologue/Heavy-Armaments-Industries/archive/d996e92dcf9a30a6acb7b3bfdfb6522dddc3804c.zip");
|
|
||||||
checkExistence("heavy-armaments");
|
|
||||||
|
|
||||||
UnitType type = Vars.content.units().find(u -> u.name.equals("heavy-armaments-t3A_copter"));
|
|
||||||
assertNotNull(type, "A mod unit must be loaded.");
|
|
||||||
assertTrue(type.weapons.size > 0, "A mod unit must have a weapon.");
|
|
||||||
|
|
||||||
Vars.world.loadMap(maps.loadInternalMap("groundZero"));
|
|
||||||
|
|
||||||
Unit unit = type.spawn(0, 0);
|
|
||||||
|
|
||||||
//check for crash
|
|
||||||
unit.update();
|
|
||||||
|
|
||||||
assertTrue(unit.health > 0, "Unit must be spawned and alive.");
|
|
||||||
assertTrue(Groups.unit.size() > 0, "Unit must be spawned and alive.");
|
|
||||||
|
|
||||||
//just an extra sanity check
|
|
||||||
Log.info("Modded units: @", Vars.content.units().select(u -> u.minfo.mod != null));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user