game
Read the visible players and mobs, the local player position and project world positions to the screen. It lives at xiao.game.
These functions return empty results outside on_frame, think callbacks and paint listeners. See xiao.signal and xiao.paint.
Functions
xiao.game.players(): entity[]
xiao.game.players(): entity[]
- Returns an array of entities for the visible players.
xiao.game.entities(): entity[]
xiao.game.entities(): entity[]
- Returns an array of entities for the visible mobs.
xiao.game.local_player(): vector3 | nil
xiao.game.local_player(): vector3 | nil
- Returns a
vector3of the local player position, ornil.
xiao.game.world_to_screen(point: vector3): vector2 | nil
xiao.game.world_to_screen(point: vector3): vector2 | nil
- Returns a
vector2on screen, ornilwhen behind the camera.
xiao.game.world_to_screen(x: number, y: number, z: number): vector2 | nil
xiao.game.world_to_screen(x: number, y: number, z: number): vector2 | nil
- Same as the
pointform, with the coordinates given separately.
xiao.game.time(): number
xiao.game.time(): number
- Returns the seconds since the system started.
Types
entity
Example
local paint = xiao.paint
local gold = paint.color.hex("#F0C250")
paint.add("names", function(w, h)
for _, player in ipairs(xiao.game.players()) do
local head = paint.point.vector3(player.x, player.y + 2, player.z)
paint.text.center(head, player.name, gold, paint.color.rgb(0, 0, 0))
end
end)