mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-10-02 11:10:50 +03:00
World label flag for only being visible to the parent
This commit is contained in:
@@ -18,7 +18,13 @@ public abstract class WorldLabelComp implements Posc, Drawc, Syncc{
|
||||
@Import int id;
|
||||
@Import float x, y;
|
||||
|
||||
public static final byte flagBackground = 1, flagOutline = 2, flagAlignLeft = 4, flagAlignRight = 8, flagAutoscale = 16;
|
||||
public static final byte
|
||||
flagBackground = 1,
|
||||
flagOutline = 2,
|
||||
flagAlignLeft = 4,
|
||||
flagAlignRight = 8,
|
||||
flagAutoscale = 16,
|
||||
flagOnlyParentVisible = 32;
|
||||
|
||||
public String text = "sample text";
|
||||
public float fontSize = 1f, z = Layer.playerName + 1;
|
||||
@@ -38,6 +44,9 @@ public abstract class WorldLabelComp implements Posc, Drawc, Syncc{
|
||||
if(parent != null){
|
||||
x += parent.x();
|
||||
y += parent.y();
|
||||
if((flags & flagOnlyParentVisible) != 0 && !parent.isLocal()){
|
||||
return;
|
||||
}
|
||||
}
|
||||
drawAt(text, x, y, z, flags, fontSize, Align.center, (flags & flagAlignLeft) != 0 ? Align.left : (flags & flagAlignRight) != 0 ? Align.right : Align.center);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user