1
0
Fork 0
mirror of https://github.com/dragonfireclient/hydra-dragonfire.git synced 2024-11-21 10:24:01 -05:00
hydra-dragonfire/example/print-node.lua
2022-06-01 18:09:48 +02:00

24 lines
526 B
Lua
Executable file

#!/usr/bin/env hydra-dragonfire
local client = require("client")()
client:enable("pkts", "map")
client.pkts:subscribe("move_player")
client:connect()
local pos
while true do
local evt = client:poll(1)
if not evt or evt.type == "disconnect" or evt.type == "interrupt" then
break
elseif evt.type == "pkt" then
pos = (evt.pkt_data.pos / hydra.BS + vec3(0, -1, 0)):round()
elseif evt.type == "timeout" and pos then
local node = client.map:get():node(pos)
print(pos, node and node.param0)
end
end
client:close()