From d6dec002c13d1549acf6d262619e605603197160 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 11 Jan 2020 19:32:08 -0500 Subject: [PATCH] Added remote tile set/remove methods --- core/src/mindustry/world/Tile.java | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/world/Tile.java b/core/src/mindustry/world/Tile.java index fe319fd02e..606a3f1ccd 100644 --- a/core/src/mindustry/world/Tile.java +++ b/core/src/mindustry/world/Tile.java @@ -1,10 +1,11 @@ package mindustry.world; -import arc.struct.*; import arc.func.*; import arc.math.*; import arc.math.geom.*; +import arc.struct.*; import arc.util.ArcAnnotate.*; +import mindustry.annotations.Annotations.*; import mindustry.content.*; import mindustry.entities.traits.*; import mindustry.entities.type.*; @@ -215,6 +216,16 @@ public class Tile implements Position, TargetTrait{ } } + /** remove()-s this tile, except it's synced across the network */ + public void removeNet(){ + Call.removeTile(this); + } + + /** set()-s this tile, except it's synced across the network */ + public void setNet(Block block, Team team, int rotation){ + Call.setTile(this, block, team, rotation); + } + public byte rotation(){ return rotation; } @@ -506,4 +517,16 @@ public class Tile implements Position, TargetTrait{ public String toString(){ return floor.name + ":" + block.name + ":" + overlay + "[" + x + "," + y + "] " + "entity=" + (entity == null ? "null" : (entity.getClass())) + ":" + getTeam(); } + + //remote utility methods + + @Remote(called = Loc.server) + public static void removeTile(Tile tile){ + tile.remove(); + } + + @Remote(called = Loc.server) + public static void setTile(Tile tile, Block block, Team team, int rotation){ + tile.set(block, team, rotation); + } }