Skip to content

Commit

Permalink
1va: reassign all enemy cores to other team
Browse files Browse the repository at this point in the history
  • Loading branch information
buj committed Nov 4, 2024
1 parent e5370be commit cc2833d
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/main/java/darkdustry/features/OnevAll.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,22 @@ public static void init() {
Events.on(EventType.PlayEvent.class, event -> {
flags[0] = false;
});

Events.on(EventType.BlockDestroyEvent.class, event -> {
if (flags[0]) return;
if (!enabled()) return;
if (otherTeam().core() != null && state.rules.defaultTeam.core() != null) return;

flags[0] = true;

Groups.build.each(build -> {
if (!(build.block instanceof CoreBlock)) return;
if (build.team == otherTeam() || build.team == state.rules.defaultTeam) return;
build.tile().setNet(Blocks.air);
});
});
}

public static void nextMap() {
single = nextSingle;
nextSingle = null;
team = null;
gameOverFlag = false;

if (!enabled()) return;

for (var team : Team.all) {
if (team == Team.derelict || team == state.rules.defaultTeam || team == otherTeam()) continue;
if (team.core() == null) continue;

Groups.build.each(x -> x.team == team, x -> x.team(team));
}
}

private static Team otherTeam() {
Expand Down

0 comments on commit cc2833d

Please sign in to comment.