More achievement fixes
This commit is contained in:
@@ -304,7 +304,7 @@ public class GameService{
|
||||
});
|
||||
|
||||
Events.on(UnitCreateEvent.class, e -> {
|
||||
if(campaign()){
|
||||
if(campaign() && e.unit.team == state.rules.defaultTeam){
|
||||
if(unitsBuilt.add(e.unit.type.name)){
|
||||
SStat.unitTypesBuilt.max(content.units().count(u -> unitsBuilt.contains(u.name) && !u.isHidden()));
|
||||
save();
|
||||
@@ -316,6 +316,29 @@ public class GameService{
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(SaveLoadEvent.class, e -> Core.app.post(() -> Core.app.post(() -> {
|
||||
if(campaign()){
|
||||
boolean added = false;
|
||||
for(UnitType type : Vars.content.units()){
|
||||
var all = state.rules.defaultTeam.data().getUnits(type);
|
||||
if(all != null && all.size > 0){
|
||||
if(t5s.contains(type)){
|
||||
buildT5.complete();
|
||||
}
|
||||
|
||||
if(unitsBuilt.add(type.name)){
|
||||
added = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(added){
|
||||
SStat.unitTypesBuilt.max(content.units().count(u -> unitsBuilt.contains(u.name) && !u.isHidden()));
|
||||
save();
|
||||
}
|
||||
}
|
||||
})));
|
||||
|
||||
Events.on(UnitControlEvent.class, e -> {
|
||||
if(e.unit instanceof BlockUnitc unit && unit.tile().block == Blocks.router){
|
||||
becomeRouter.complete();
|
||||
|
||||
Reference in New Issue
Block a user