From 979e39f5880492495e7d3066da0d1b57c4043bd7 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 29 Nov 2020 12:14:46 -0500 Subject: [PATCH] Added unit to BlockBuildBeginEvent --- core/src/mindustry/game/EventType.java | 8 +++++--- core/src/mindustry/world/Build.java | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/mindustry/game/EventType.java b/core/src/mindustry/game/EventType.java index f0aa3278b2..3fd2826cb5 100644 --- a/core/src/mindustry/game/EventType.java +++ b/core/src/mindustry/game/EventType.java @@ -278,11 +278,13 @@ public class EventType{ public static class BlockBuildBeginEvent{ public final Tile tile; public final Team team; + public final @Nullable Unit unit; public final boolean breaking; - public BlockBuildBeginEvent(Tile tile, Team team, boolean breaking){ + public BlockBuildBeginEvent(Tile tile, Team team, Unit unit, boolean breaking){ this.tile = tile; this.team = team; + this.unit = unit; this.breaking = breaking; } } @@ -310,10 +312,10 @@ public class EventType{ public static class BuildSelectEvent{ public final Tile tile; public final Team team; - public final Builderc builder; + public final Unit builder; public final boolean breaking; - public BuildSelectEvent(Tile tile, Team team, Builderc builder, boolean breaking){ + public BuildSelectEvent(Tile tile, Team team, Unit builder, boolean breaking){ this.tile = tile; this.team = team; this.builder = builder; diff --git a/core/src/mindustry/world/Build.java b/core/src/mindustry/world/Build.java index 2ea4478655..2355dd8118 100644 --- a/core/src/mindustry/world/Build.java +++ b/core/src/mindustry/world/Build.java @@ -42,7 +42,7 @@ public class Build{ tile.build.health = tile.build.maxHealth * prevPercent; if(unit != null && unit.isPlayer()) tile.build.lastAccessed = unit.getPlayer().name; - Core.app.post(() -> Events.fire(new BlockBuildBeginEvent(tile, team, true))); + Core.app.post(() -> Events.fire(new BlockBuildBeginEvent(tile, team, unit, true))); } /** Places a ConstructBlock at this location. */ @@ -89,7 +89,7 @@ public class Build{ result.placeBegan(tile, previous); - Core.app.post(() -> Events.fire(new BlockBuildBeginEvent(tile, team, false))); + Core.app.post(() -> Events.fire(new BlockBuildBeginEvent(tile, team, unit, false))); } /** Returns whether a tile can be placed at this location by this team. */