sorcery  Check-in [ef607df117]

Overview
Comment:add leyline debugger
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ef607df117f2e994a40f653fb170a173b322a743c5d15a03f460c7393635f4b2
User & Date: lexi on 2021-07-06 16:55:36
Other Links: manifest | tags
Context
2021-07-06
17:35
disassembler no longer disintegrates glass bottles check-in: e8e42c6029 user: lexi tags: trunk
16:55
add leyline debugger check-in: ef607df117 user: lexi tags: trunk
14:32
coin press fixes check-in: 38ae873453 user: lexi tags: trunk
Changes

Modified admin.lua from [41dac58ae7] to [a984f71f32].

     8      8   		local dumpout = ''
     9      9   		for i=1,string.len(binary) do
    10     10   			dumpout = dumpout .. string.format('%x%s',string.byte(binary,i),(i%16==0 and '\n') or ' ') 
    11     11   		end
    12     12   		print(dumpout)
    13     13   	end;
    14     14   })
           15  +
           16  +minetest.register_chatcommand('leynet', {
           17  +	description = 'Dump information about the ley-net in front of you';
           18  +	privs = { debug = true };
           19  +	func = function(caller,params)
           20  +		local user = minetest.get_player_by_name(caller)
           21  +		local pos = user:get_pos()
           22  +		local dir = user:get_look_dir()
           23  +		local nodes = minetest.raycast(pos,pos + (dir*5), false, false)
           24  +		for pt in nodes do
           25  +			local node = minetest.get_node(pt.under)
           26  +			if node.name ~= 'air' then
           27  +				print('mapping',pt.under,node.name)
           28  +				local n = minetest.registered_nodes[node.name]
           29  +				if minetest.get_item_group(node.name, 'sorcery_ley_device') ~= 0 then
           30  +					local l = sorcery.ley.netcaps(pt.under, 1, nil, 0)
           31  +					print('ley netcaps for pos',pt.under,dump(l))
           32  +					minetest.chat_send_player(caller, 'ley netcaps:' .. dump({
           33  +						freepower = l.freepower;
           34  +						maxpower = l.maxpower;
           35  +						self = l.self;
           36  +						devs = l.net.devices.consume;
           37  +					}))
           38  +					break
           39  +				end
           40  +			end
           41  +		end
           42  +	end;
           43  +})
           44  +
           45  +
           46  +minetest.register_chatcommand('leyline', {
           47  +	description = 'See details about local ley force';
           48  +	privs = { debug = true };
           49  +	func = function(caller,params)
           50  +		local pos = minetest.get_player_by_name(caller):get_pos()
           51  +		local ley = sorcery.ley.estimate(pos)
           52  +		minetest.chat_send_player(caller, 'Leyline force ' .. tostring(ley.force) .. ' with affinities ' .. table.concat(ley.aff, ','))
           53  +	end;
           54  +})
    15     55   
    16     56   -- minetest.register_chatcommand('hover', {
    17     57   -- 	description = 'Test hover effect';
    18     58   -- 	privs = { fly = true };
    19     59   -- 	func = function(caller,params)
    20     60   -- 		local player = minetest.get_player_by_name(caller)
    21     61   -- 		late.new_effect(player, {

Modified leylines.lua from [3f1f974e2b] to [a10175fdaa].

    35     35   
    36     36   	return {
    37     37   		force = force;
    38     38   		aff = { aff1, aff2 };
    39     39   	}
    40     40   end
    41     41   
    42         -minetest.register_chatcommand('leyline', {
    43         -	description = 'See details about local ley force';
    44         -	privs = { server = true };
    45         -	func = function(caller,params)
    46         -		local pos = minetest.get_player_by_name(caller):get_pos()
    47         -		local ley = sorcery.ley.estimate(pos)
    48         -		minetest.chat_send_player(caller, 'Leyline force ' .. tostring(ley.force) .. ' with affinities ' .. table.concat(ley.aff, ','))
    49         -	end;
    50         -})
    51         -
    52     42   sorcery.ley.chargetype = function(stack)
    53     43   	if minetest.get_item_group(stack:get_name(),'sorcery_wand') ~= 0 then
    54     44   		return 'wear'
    55     45   	else
    56     46   		local e = sorcery.enchant.get(stack)
    57     47   		if e and #e.spells > 0 then
    58     48   			return 'enchant'