xurfer/src/ext/janusxr/main.lua
2026-06-09 17:27:06 +02:00

43 lines
1.1 KiB
Lua

local api = ...
local ecs = api.ecs
local util = api.util
return {
name = "janusxr",
enabled = true,
init = function()
JMLLoader = ecs.processingSystem()
JMLLoader.updatesystem = true
JMLLoader.filter = ecs.requireAll('URL', 'method', 'data', 'ok')
function JMLLoader:process(req, dt)
if req.ok and req.xml == nil then
-- JML heuristic
if req.data.find("<fireboxroom>") or req.data.match("<room[ >]") then
local JML0
local JML
req.xml = api.parser.xml.newParser()
local xmlstr = req.data
-- cleanup JML0
local JML0 = xmlstr:gsub("[=%w].*<room>","<fireboxroom")
JML0 = JML0:gsub("[=%w]</room>","</room>")
util.traverseXML( req.xml:ParseXmlText(JML0), function(node,raw)
print_r(node)
end)
os.exit()
--api.world.add({
-- x = 0,
-- y = 0,
-- z = 0,
-- model = req.model,
-- req = req
--})
end
end
end
api.world.add(JMLLoader)
end,
}