Added remote tile set/remove methods

This commit is contained in:
Anuken
2020-01-11 19:32:08 -05:00
parent 4aa4e15de5
commit d6dec002c1
+24 -1
View File
@@ -1,10 +1,11 @@
package mindustry.world; package mindustry.world;
import arc.struct.*;
import arc.func.*; import arc.func.*;
import arc.math.*; import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
import arc.struct.*;
import arc.util.ArcAnnotate.*; import arc.util.ArcAnnotate.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.entities.traits.*; import mindustry.entities.traits.*;
import mindustry.entities.type.*; 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(){ public byte rotation(){
return rotation; return rotation;
} }
@@ -506,4 +517,16 @@ public class Tile implements Position, TargetTrait{
public String toString(){ public String toString(){
return floor.name + ":" + block.name + ":" + overlay + "[" + x + "," + y + "] " + "entity=" + (entity == null ? "null" : (entity.getClass())) + ":" + getTeam(); 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);
}
} }