sorcery  Diff

Differences From Artifact [fd9aa86a12]:

To Artifact [bae6ceb605]:


   139    139   }
   140    140   
   141    141   local rune_set = function(stack,r)
   142    142   	local m = stack:get_meta()
   143    143   	local def = stack:get_definition()._proto.data
   144    144   	local grade
   145    145   	if r.grade then grade = r.grade
   146         -	elseif m:contains('rune_grade') then grade = m:get_int('rune_grade') end
          146  +	elseif m:contains 'rune_grade' then grade = m:get_int 'rune_grade' end
   147    147   
   148    148   	local qpfx = constants.rune_grades[grade]
   149    149   	local title = sorcery.lib.color(def.tone):readable():fmt(string.format('%s %s Rune',qpfx,def.name))
   150    150   
   151    151   	m:set_int('rune_grade',grade)
   152    152   	m:set_string('description',title)
   153    153   end
   154    154   
   155    155   sorcery.amulet = {}
   156    156   sorcery.amulet.setrune = function(stack,rune,user)
   157    157   	local m = stack:get_meta()
   158    158   	if rune then
   159    159   		local rp = rune:get_definition()._proto
   160         -		local rg = rune:get_meta():get_int('rune_grade')
          160  +		local rg = rune:get_meta():get_int 'rune_grade'
   161    161   		m:set_string('amulet_rune', rp.id)
   162    162   		m:set_int('amulet_rune_grade', rg)
   163    163   		local spell = sorcery.amulet.getspell(stack)
   164    164   		if not spell then return nil end
   165    165   		local name
   166    166   		if spell.mingrade and spell.mingrade > 0 then -- indicating quality makes less sense if it's restricted
   167    167   			name = string.format('Amulet of %s', spell.name)
................................................................................
   436    436   			local wear = 65535 / wrench.powers[cap]
   437    437   			s:add_wear(wear)
   438    438   			inv:set_stack('wrench',1,s)
   439    439   		end
   440    440   		if fl == 'active' then
   441    441   			inv:set_stack('amulet',1,sorcery.amulet.setrune(inv:get_stack('amulet',1),nil,user))
   442    442   			-- only special wrenches can extract runes intact
   443         -			if wrench.powers.extract then wwear('extract')
          443  +			if wrench.powers.extract then wwear 'extract'
   444    444   				minetest.sound_play('sorcery_chime', { pos = pos, gain = 0.5 })
   445         -			elseif wrench.powers.purge then wwear('purge')
          445  +			elseif wrench.powers.purge then wwear 'purge'
   446    446   				inv:set_stack(tl,ti,ItemStack(nil))
   447    447   				minetest.sound_play('sorcery_disjoin', { pos = pos, gain = 0.5 })
   448    448   			end
   449    449   		elseif tl == 'active' and wrench.powers.imbue then
   450    450   			local amulet = sorcery.amulet.setrune(inv:get_stack('amulet',1), inv:get_stack(tl,ti), user)
   451    451   			local spell = sorcery.amulet.getspell(amulet)
   452    452   			sorcery.vfx.enchantment_sparkle({
   453    453   				under = pos;
   454    454   				above = vector.add(pos,{x=0,y=1,z=0});
   455    455   			}, spell.tone:brighten(1.2):hex())
   456    456   			minetest.sound_play('xdecor_enchanting', { pos = pos, gain = 0.5 })
   457    457   			inv:set_stack('amulet',1,amulet)
   458         -			wwear('imbue')
          458  +			wwear 'imbue'
   459    459   		end
   460    460   		-- trigger the update early to clean up the ghost image :/
   461    461   		-- minetest needs a cleaner way to handle these
   462    462   		runeforge_update(pos)
   463    463   	end;
   464    464   	on_metadata_inventory_put = function(pos, list, idx, stack, user)
   465    465   		local inv = minetest.get_meta(pos):get_inventory()