sorcery  Diff

Differences From Artifact [6f8619640d]:

  • File astrolabe.lua — part of check-in [3f6a913e4e] at 2020-09-29 12:40:28 on branch trunk — * remove former hacky registration system, replace with consistent and flexible API; rewrite metal/gem generation to take advantage of this new API; tweaks to init system to enable world-local tweaks to lore and sorcery behavior * initial documentation commit * initial steps towards calendar - add default date format, astrolabe; prepare infra for division/melding/transmutation spells, various tweaks and fixes (user: lexi, size: 626) [annotate] [blame] [check-ins using]

To Artifact [06e518da22]:

  • File astrolabe.lua — part of check-in [ea6e475e44] at 2020-10-19 09:52:11 on branch trunk — continue dev on celestial mechanics, add melding+division spells (resonance), refine itemclasses, add keypunch and punchcards, add paper pulp, add a shitload of visuals, add convenience scripts for working with the wiki, make the flamebolt spell actually useful instead of just a pretty lightshow, add essences, inferno crystal, and other goodies; iterate on wands, lots of shit i can't remember, various bugfixes (user: lexi, size: 3919) [annotate] [blame] [check-ins using]





































































1
2
3
4
5
6
7
8
9
10
11
12
..
18
19
20
21
22
23
24
























25
26
27
28
29
30













































































local albox = {
	type = 'fixed';
	fixed = {
		-0.43,-0.5,-0.43;
		 0.43, 0.3, 0.43;
	};
}
minetest.register_node('sorcery:astrolabe',{
	description = 'Astrolabe';
	drawtype = 'mesh';
	mesh = 'sorcery-astrolabe.obj';
	groups = {
................................................................................
	after_dig_node = sorcery.lib.node.purge_containers;
	tiles = {
		'default_steel_block.png';
		'default_bronze_block.png';
		'default_copper_block.png';
		'default_aspen_wood.png';
	};
























	_sorcery = {
		recipe = {
			note = 'Unravel the secrets of the stars';
		};
	};
})









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




|







 







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






>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
..
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
local calendar_style_list = function()
	local k = sorcery.lib.tbl.keys(sorcery.data.calendar.styles)
	table.sort(k)
	local r = {}
	for i,v in ipairs(k) do
		r[i] = {
			id = k[i];
			name = sorcery.data.calendar.styles[v].name;
		}
	end
	print(dump(r))
	return r
end
local astrolabe_formspec = function(pos)
	local m = minetest.get_meta(pos)
	local i = m:get_inventory()
	local datestamp = minetest.get_day_count()
	local date = sorcery.calendar.date(datestamp)
	local strd = sorcery.calendar.stars(datestamp)
	local style = m:get_string('datestyle')
	if style == '' then style = sorcery.data.calendar.default end
	local fdate = string.format('<global halign=center valign=middle size=20><b>%s</b>\n%s',
		sorcery.calendar.shortdate(datestamp,style),
		sorcery.calendar.longdate(datestamp,style))
	sstr=string.format('<global halign=center valign=middle><style size=20>Sign of the %s</style>\n<i>Stellar cycle %u</i>',strd.sign.patron,strd.cycle)
	local lphase = sorcery.calendar.contmatch(sorcery.calendar.moon_phases,date.lunar_phase)
	local menu
	local mi = calendar_style_list()
	local activestyle = 1
	local getphaseimg = function(body,fac)
		if fac >= 1 then fac = 0 end
		return 'sorcery_'..body..'_phases.png^[verticalframe:19:' .. tostring(math.floor(fac * 20))
	end
	local planetphase = getphaseimg('planet',minetest.get_timeofday())
	local ltime = '<global halign=center size=15>' .. sorcery.calendar.contmatch(sorcery.calendar.timesofday,minetest.get_timeofday()+0.1)
	local moonphase = getphaseimg('moon',date.lunar_phase)
	local moonlabel = string.format('<global halign=center size=15>%s Moon', lphase)
	for i,s in ipairs(mi) do
		if s.id == style then activestyle = i end
		local esc = minetest.formspec_escape(s.name)
		if menu
			then menu = menu .. ',' .. esc
			else menu = esc
		end
	end
	m:set_string('formspec', string.format([[
		formspec_version[3] size[14,4.25]
		box[0.25,0.25;3.75,3.75;#000000FF]
		hypertext[0.25,2.75;3.75,1;;%s]
		dropdown[4.1,0.25;5.1;style;%s;%u]

		box[4.1,1.5;2.50,2.50;#000000FF]
		image[4.1,1.5;2.50,2.50;%s]
		hypertext[4.1,3.50;2.50,1;;%s]

		box[6.7,1.5;2.50,2.50;#000000FF]
		image[6.7,1.5;2.50,2.50;%s]
		hypertext[6.7,3.50;2.50,1;;%s]

		hypertext[9.60,1.5;4.15,2.5;;%s]

	]],
		minetest.formspec_escape(sstr),
		menu, activestyle,
		moonphase, minetest.formspec_escape(moonlabel),
		planetphase, minetest.formspec_escape(ltime),
		minetest.formspec_escape(fdate)))
end
local albox = {
	type = 'fixed';
	fixed = {
		-0.43,-0.5,-0.43;
		 0.43, 0.35, 0.43;
	};
}
minetest.register_node('sorcery:astrolabe',{
	description = 'Astrolabe';
	drawtype = 'mesh';
	mesh = 'sorcery-astrolabe.obj';
	groups = {
................................................................................
	after_dig_node = sorcery.lib.node.purge_containers;
	tiles = {
		'default_steel_block.png';
		'default_bronze_block.png';
		'default_copper_block.png';
		'default_aspen_wood.png';
	};
	on_construct = function(pos)
		local m = minetest.get_meta(pos)
		local i = m:get_inventory()
		m:set_string('infotext','Astrolabe')
		astrolabe_formspec(pos)
	end;
	on_rightclick = function(pos)
		astrolabe_formspec(pos)
	end;
	on_receive_fields = function(pos,name,fields)
		local m = minetest.get_meta(pos)
		local i = m:get_inventory()

		local csl = calendar_style_list()
		if fields.style then
			for _,s in pairs(csl) do
				if s.name == fields.style then
					m:set_string('datestyle',s.id)
					astrolabe_formspec(pos)
					break
				end
			end
		end
	end;
	_sorcery = {
		recipe = {
			note = 'Unravel the secrets of the stars';
		};
	};
})

minetest.register_craft {
	output = 'sorcery:astrolabe';
	recipe = {
		{'sorcery:steel_screw','default:steel_ingot','sorcery:steel_screw'};
		{'default:copper_ingot',sorcery.data.metals.brass.parts.block,'default:copper_ingot'};
		{'default:stick','sorcery:screw_steel','default:stick'};
	};
};