sorcery  Diff

Differences From Artifact [5335f5f5e0]:

To Artifact [f718356661]:


1
2
3






4
5
6
7
8
9
10
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
...
217
218
219
220
221
222
223

224
225
226
227
228












229
230
231
232
233
234
235
local altar_item_offset = {
	x = 0, y = -0.3, z = 0
}







local get_altar_ent = function(pos)
	for _, obj in pairs(minetest.get_objects_inside_radius(pos,0.9)) do
		if not obj then goto nextloop end
		local ent = obj:get_luaentity()
		if not ent then goto nextloop end

................................................................................
			local bestow = function(item,color)
				if type(item) == 'string' then
					item = ItemStack(item)
				end
				if color == nil then
					color = sorcery.lib.color(god.color)
				end
				local range = function(min, max)
					local span = max - min
					local val = math.random() * span
					return val + min
				end
				for i=0,32 do
					minetest.add_particle{
						pos = {
							x = altar.x + range(-0.4,0.4);
							z = altar.z + range(-0.4,0.4);
							y = altar.y + range(-0.2,0.3);
						};
................................................................................
				-- loop through the list of things this god will consecrate and
				-- check whether the item on the altar is any of them
				for s, cons in pairs(god.consecrate) do
					local cost, tx = cons[1], cons[2]
					if type(tx) == "table" then
						tx = tx[math.random(#tx)]
					end

					local gift = ItemStack(tx)
					local wear = stack:get_wear()
					if wear > 0 then
						gift:set_wear(wear)
					end












					if itemname == s then
						if divine_favor >= cost then
							bestow(gift)
							divine_favor = divine_favor - cost
							print(god.name..'has consecrated ' ..s.. ' into ' ..tx.. ', for the cost of ' ..cost.. ' points of divine favor')
							goto refresh
						end



>
>
>
>
>
>







 







<
<
<
<
<







 







>





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







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
...
104
105
106
107
108
109
110





111
112
113
114
115
116
117
...
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
local altar_item_offset = {
	x = 0, y = -0.3, z = 0
}

local range = function(min, max)
	local span = max - min
	local val = math.random() * span
	return val + min
end

local get_altar_ent = function(pos)
	for _, obj in pairs(minetest.get_objects_inside_radius(pos,0.9)) do
		if not obj then goto nextloop end
		local ent = obj:get_luaentity()
		if not ent then goto nextloop end

................................................................................
			local bestow = function(item,color)
				if type(item) == 'string' then
					item = ItemStack(item)
				end
				if color == nil then
					color = sorcery.lib.color(god.color)
				end





				for i=0,32 do
					minetest.add_particle{
						pos = {
							x = altar.x + range(-0.4,0.4);
							z = altar.z + range(-0.4,0.4);
							y = altar.y + range(-0.2,0.3);
						};
................................................................................
				-- loop through the list of things this god will consecrate and
				-- check whether the item on the altar is any of them
				for s, cons in pairs(god.consecrate) do
					local cost, tx = cons[1], cons[2]
					if type(tx) == "table" then
						tx = tx[math.random(#tx)]
					end
					-- preserve wear
					local gift = ItemStack(tx)
					local wear = stack:get_wear()
					if wear > 0 then
						gift:set_wear(wear)
					end
					-- preserve meta
					gift:get_meta():from_table(stack:get_meta():to_table())
					-- reflash enchantments to ensure label is accurate
					local ench = sorcery.enchant.get(gift)
					if #ench.spells > 0 then
						-- add a bit of energy as a gift?
						if math.random(math.ceil(god.stinginess * 0.5)) == 1 then
							local max = 0.05 * god.generosity
							ench.energy = ench.energy * range(0.7*max,max)
						end
						sorcery.enchant.set(gift,ench)
					end
					if itemname == s then
						if divine_favor >= cost then
							bestow(gift)
							divine_favor = divine_favor - cost
							print(god.name..'has consecrated ' ..s.. ' into ' ..tx.. ', for the cost of ' ..cost.. ' points of divine favor')
							goto refresh
						end