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
9
10
11
12
13
14








































15
16
17
18
19
20
21
		local dumpout = ''
		for i=1,string.len(binary) do
			dumpout = dumpout .. string.format('%x%s',string.byte(binary,i),(i%16==0 and '\n') or ' ') 
		end
		print(dumpout)
	end;
})









































-- minetest.register_chatcommand('hover', {
-- 	description = 'Test hover effect';
-- 	privs = { fly = true };
-- 	func = function(caller,params)
-- 		local player = minetest.get_player_by_name(caller)
-- 		late.new_effect(player, {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
		local dumpout = ''
		for i=1,string.len(binary) do
			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)
-- 		local player = minetest.get_player_by_name(caller)
-- 		late.new_effect(player, {

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

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

	return {
		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)
		if e and #e.spells > 0 then
			return 'enchant'







<
<
<
<
<
<
<
<
<
<







35
36
37
38
39
40
41










42
43
44
45
46
47
48

	return {
		force = force;
		aff = { aff1, aff2 };
	}
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)
		if e and #e.spells > 0 then
			return 'enchant'