Added unit to BlockBuildBeginEvent
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user