Skip to content

Commit 07d5b03

Browse files
committed
More achievement fixes
1 parent 3c239e8 commit 07d5b03

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

core/src/mindustry/service/GameService.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ private void registerEvents(){
304304
});
305305

306306
Events.on(UnitCreateEvent.class, e -> {
307-
if(campaign()){
307+
if(campaign() && e.unit.team == state.rules.defaultTeam){
308308
if(unitsBuilt.add(e.unit.type.name)){
309309
SStat.unitTypesBuilt.max(content.units().count(u -> unitsBuilt.contains(u.name) && !u.isHidden()));
310310
save();
@@ -316,6 +316,29 @@ private void registerEvents(){
316316
}
317317
});
318318

319+
Events.on(SaveLoadEvent.class, e -> Core.app.post(() -> Core.app.post(() -> {
320+
if(campaign()){
321+
boolean added = false;
322+
for(UnitType type : Vars.content.units()){
323+
var all = state.rules.defaultTeam.data().getUnits(type);
324+
if(all != null && all.size > 0){
325+
if(t5s.contains(type)){
326+
buildT5.complete();
327+
}
328+
329+
if(unitsBuilt.add(type.name)){
330+
added = true;
331+
}
332+
}
333+
}
334+
335+
if(added){
336+
SStat.unitTypesBuilt.max(content.units().count(u -> unitsBuilt.contains(u.name) && !u.isHidden()));
337+
save();
338+
}
339+
}
340+
})));
341+
319342
Events.on(UnitControlEvent.class, e -> {
320343
if(e.unit instanceof BlockUnitc unit && unit.tile().block == Blocks.router){
321344
becomeRouter.complete();

0 commit comments

Comments
 (0)