PlayerAvatar

The player avatar class represents an avatar for the purposes of player information packet. Every player will have a respective avatar that contains basic information about that player, such as their coordinates and how far to render other players.

Properties

Link copied to clipboard
var currentCoord: CoordGrid

The current known coordinate of the given player. The coordinate property will need to be updated for all players prior to computing player info packet for any of them.

Link copied to clipboard

Extended info repository, commonly referred to as "masks", will track everything relevant inside itself. Setting properties such as a spotanim would be done through this. The extendedInfo is also responsible for caching the non-temporary blocks, such as appearance and move speed.

Link copied to clipboard

The current world that the player is on, by default the root world. When a player moves onto a world entity (a ship), this value must be updated.

Functions

Link copied to clipboard
fun forceResizeRange(range: Int)

Forces the resize range to range while disabling the auto resizing feature.

Link copied to clipboard

Gets the preferred resize range. This value represents the ideal number that player info will strive towards. If the value is Int.MAX_VALUE, resizing is disabled and getResizeRange is what is used as a constant.

Link copied to clipboard

Gets the current resize range. This variable might change over time.

Link copied to clipboard
open override fun postUpdate()

Updates the previous cycle's coordinate to be the current cycle's coordinate. This is called at the end of the cycle, to prepare for the next cycle.

Link copied to clipboard
fun setHidden(hidden: Boolean)

Sets the avatar as hidden (or unhidden, depending on hidden). When hidden via this function, no information is transmitted to the clients about this avatar. It is a hard-hiding function, unlike the one via appearance extended info, which strictly only hides client-side, but all clients still receive information about the client existing. The benefit to this function is that no plugins or RuneLite implementations can snoop on other players that are meant to be hidden. The downside, however, is that because the client has no knowledge of that specific avatar whatsoever, un-hiding while the player is moving is not as smooth as with the appearance variant, since it first appears as if the player teleported in.

Link copied to clipboard

Sets this avatar as high priority, meaning they will be rendered in large crowds if the size of the crowd causes the view range to decrease below the preferred range. As an example, a typical preferred range is 15 tiles, but if there's a large crowd of people around, it might drop down to say 5 tiles. If there's a player that has been marked as high priority 10 tiles away from us, they will still render to us if marked as high priority.

Link copied to clipboard

Sets the avatar as normal priority. This reverses the effects of setHighPriority.

Link copied to clipboard

Sets the preferred resize range, effectively how far to render players from. The preferred bit here means that it can resize down if there are too many players around.

Link copied to clipboard
fun updateCoord(level: Int, x: Int, z: Int)

Updates the current known coordinate of the given PlayerAvatar. This function must be called on each avatar before player info is computed.

Link copied to clipboard
fun updateWorld(worldId: Int)

Updates the world id for a given player. Whether a player renders to you is determined based on the player's distance to that world's render coord, as defined by PlayerInfo.