Fixed block team change not processing correctly
This commit is contained in:
@@ -156,7 +156,9 @@ public class Logic implements ApplicationListener{
|
|||||||
//TODO maybe make it a separate rule?
|
//TODO maybe make it a separate rule?
|
||||||
//makes cores go derelict in RTS mode, helps clean things up
|
//makes cores go derelict in RTS mode, helps clean things up
|
||||||
if(e.tile.build instanceof CoreBuild core && core.team.isAI() && core.team.rules().rtsAi){
|
if(e.tile.build instanceof CoreBuild core && core.team.isAI() && core.team.rules().rtsAi){
|
||||||
core.team.data().makeDerelict(core.x, core.y, state.rules.enemyCoreBuildRadius);
|
Core.app.post(() -> {
|
||||||
|
core.team.data().makeDerelict(core.x, core.y, state.rules.enemyCoreBuildRadius);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -175,9 +177,7 @@ public class Logic implements ApplicationListener{
|
|||||||
//listen to core changes; if all cores have been destroyed, set to derelict.
|
//listen to core changes; if all cores have been destroyed, set to derelict.
|
||||||
Events.on(CoreChangeEvent.class, e -> Core.app.post(() -> {
|
Events.on(CoreChangeEvent.class, e -> Core.app.post(() -> {
|
||||||
if(state.rules.cleanupDeadTeams && state.rules.pvp && !e.core.isAdded() && e.core.team != Team.derelict && e.core.team.cores().isEmpty()){
|
if(state.rules.cleanupDeadTeams && state.rules.pvp && !e.core.isAdded() && e.core.team != Team.derelict && e.core.team.cores().isEmpty()){
|
||||||
Core.app.post(() -> {
|
e.core.team.data().destroyToDerelict();
|
||||||
e.core.team.data().destroyToDerelict();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1527,10 +1527,16 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
/** Changes this building's team in a safe manner. */
|
/** Changes this building's team in a safe manner. */
|
||||||
public void changeTeam(Team next){
|
public void changeTeam(Team next){
|
||||||
Team last = this.team;
|
Team last = this.team;
|
||||||
indexer.removeIndex(tile);
|
boolean was = isValid();
|
||||||
|
|
||||||
|
if(was) indexer.removeIndex(tile);
|
||||||
|
|
||||||
this.team = next;
|
this.team = next;
|
||||||
indexer.addIndex(tile);
|
|
||||||
Events.fire(teamChangeEvent.set(last, self()));
|
if(was){
|
||||||
|
indexer.addIndex(tile);
|
||||||
|
Events.fire(teamChangeEvent.set(last, self()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPickup(){
|
public boolean canPickup(){
|
||||||
|
|||||||
Reference in New Issue
Block a user