Record Class DrawCommand.Tile

java.lang.Object
java.lang.Record
com.botwithus.bot.api.draw.DrawCommand.Tile
Record Components:
key - the command's identity within this connection
style - colour, stroke, fill, order and lifetime
tileX - absolute world tile X
tileY - absolute world tile Y
plane - 0..DrawLimits.MAX_PLANE
caption - the label drawn against the resolved footprint, or DrawCaption.NONE
All Implemented Interfaces:
DrawCommand, DrawCommand.Highlight
Enclosing interface:
DrawCommand

public static record DrawCommand.Tile(String key, DrawStyle style, int tileX, int tileY, int plane, DrawCaption caption) extends Record implements DrawCommand.Highlight
A highlight over exactly one game tile, on a named plane.

Coordinates are whole tiles, not sub-tiles — the producer's highlight_tile is where the two units meet, so nothing downstream of it sees both. A world-space DrawCommand.Rect at the same place takes tile * DrawLimits.SUBTILE_SCALE instead.

plane is honoured by refusal, not by lookup, and a caller needs to know that. The producer's only ground-height source is the local player's own elevation, so a tile on any other plane resolves unavailable — nothing is drawn, deliberately, rather than a marker placed convincingly wrong on the player's floor. DrawCommand.Entity is the exemption, because an entity carries its own height. So a tile highlight one floor up is accepted, stored, and invisible until the player is on that floor; that is the producer's answer to an unanswerable question, not a fault in this binding.

Sends no w/h: highlight_tile refuses them rather than dropping them, because a silently-ignored w is how a caller ends up convinced a 5x5 highlight rendered as 1x1 because of a projection bug. DrawCommand.Area is the call that takes an extent.

  • Constructor Details

    • Tile

      public Tile(String key, DrawStyle style, int tileX, int tileY, int plane, DrawCaption caption)
      Creates an instance of a Tile record class.
      Parameters:
      key - the value for the key record component
      style - the value for the style record component
      tileX - the value for the tileX record component
      tileY - the value for the tileY record component
      plane - the value for the plane record component
      caption - the value for the caption record component
  • Method Details

    • autoKey

      public static String autoKey(int tileX, int tileY, int plane)
      The key a tile highlight gets when the caller names none: tile:<x>:<y>:<plane>, for example tile:3200:3200:0.

      The plane is in the key because it distinguishes two highlights. A key is an identity and a set under an existing key replaces it, so any field the key omits is a field two highlights can disagree on while colliding — and the loser vanishes with no error, because replacing is a legitimate operation. The same x/y on two floors is two tiles. The producer's first cut was tile:<x>:<y> and collided for exactly that case.

    • kind

      public DrawKind kind()
      Description copied from interface: DrawCommand
      The primitive this command draws.
      Specified by:
      kind in interface DrawCommand
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • key

      public String key()
      Returns the value of the key record component.
      Specified by:
      key in interface DrawCommand
      Returns:
      the value of the key record component
    • style

      public DrawStyle style()
      Returns the value of the style record component.
      Specified by:
      style in interface DrawCommand
      Returns:
      the value of the style record component
    • tileX

      public int tileX()
      Returns the value of the tileX record component.
      Returns:
      the value of the tileX record component
    • tileY

      public int tileY()
      Returns the value of the tileY record component.
      Returns:
      the value of the tileY record component
    • plane

      public int plane()
      Returns the value of the plane record component.
      Returns:
      the value of the plane record component
    • caption

      public DrawCaption caption()
      Returns the value of the caption record component.
      Specified by:
      caption in interface DrawCommand.Highlight
      Returns:
      the value of the caption record component