Index: admin.lua ================================================================== --- admin.lua +++ admin.lua @@ -10,10 +10,50 @@ dumpout = dumpout .. string.format('%x%s',string.byte(binary,i),(i%16==0 and '\n') or ' ') end print(dumpout) end; }) + +minetest.register_chatcommand('leynet', { + description = 'Dump information about the ley-net in front of you'; + privs = { debug = true }; + func = function(caller,params) + local user = minetest.get_player_by_name(caller) + local pos = user:get_pos() + local dir = user:get_look_dir() + local nodes = minetest.raycast(pos,pos + (dir*5), false, false) + for pt in nodes do + local node = minetest.get_node(pt.under) + if node.name ~= 'air' then + print('mapping',pt.under,node.name) + local n = minetest.registered_nodes[node.name] + if minetest.get_item_group(node.name, 'sorcery_ley_device') ~= 0 then + local l = sorcery.ley.netcaps(pt.under, 1, nil, 0) + print('ley netcaps for pos',pt.under,dump(l)) + minetest.chat_send_player(caller, 'ley netcaps:' .. dump({ + freepower = l.freepower; + maxpower = l.maxpower; + self = l.self; + devs = l.net.devices.consume; + })) + break + end + end + end + end; +}) + + +minetest.register_chatcommand('leyline', { + description = 'See details about local ley force'; + privs = { debug = true }; + func = function(caller,params) + local pos = minetest.get_player_by_name(caller):get_pos() + local ley = sorcery.ley.estimate(pos) + minetest.chat_send_player(caller, 'Leyline force ' .. tostring(ley.force) .. ' with affinities ' .. table.concat(ley.aff, ',')) + end; +}) -- minetest.register_chatcommand('hover', { -- description = 'Test hover effect'; -- privs = { fly = true }; -- func = function(caller,params) Index: leylines.lua ================================================================== --- leylines.lua +++ leylines.lua @@ -37,20 +37,10 @@ force = force; aff = { aff1, aff2 }; } end -minetest.register_chatcommand('leyline', { - description = 'See details about local ley force'; - privs = { server = true }; - func = function(caller,params) - local pos = minetest.get_player_by_name(caller):get_pos() - local ley = sorcery.ley.estimate(pos) - minetest.chat_send_player(caller, 'Leyline force ' .. tostring(ley.force) .. ' with affinities ' .. table.concat(ley.aff, ',')) - end; -}) - sorcery.ley.chargetype = function(stack) if minetest.get_item_group(stack:get_name(),'sorcery_wand') ~= 0 then return 'wear' else local e = sorcery.enchant.get(stack)