sorcery  Diff

Differences From Artifact [0b21397e89]:

To Artifact [fedc837bad]:


   204    204   
   205    205   	local inv = meta:get_inventory()
   206    206   	local infusion = inv:get_list('infusion')
   207    207   	local potions = inv:get_list('potions')
   208    208   	local elixir = infusion[1]:get_definition()
   209    209   	local probe = sorcery.spell.probe(pos)
   210    210   	local fx = infuser_mods(pos)
          211  +	local sparkle_color = {sorcery.lib.color(255, 0, 145)};
   211    212   	if probe.disjunction then return true end
   212    213   
   213    214   	local potionct = 0
   214    215   
          216  +	local cancel = true
   215    217   	do
   216    218   		local ingredient -- *eyeroll*
   217    219   		if infusion[1]:is_empty() then goto cancel end
   218    220   		ingredient = infusion[1]:get_name()
   219    221   		for i = 1,#potions do
   220    222   			if potions[i]:is_empty() then goto skip end
   221    223   			potionct = potionct + 1
   222    224   			local base = potions[i]:get_name()
   223    225   			local potion = potions[i]:get_definition()
   224    226   			if elixir_can_apply(elixir._proto,potion) then
   225    227   				-- at least one combination makes a valid potion;
   226    228   				-- we can start the infuser
   227         -				goto start
          229  +				if elixir._proto.color then
          230  +					sparkle_color[#sparkle_color+1] = sorcery.lib.color(elixir._proto.color)
          231  +				end
          232  +				cancel = false
   228    233   			end
   229    234   			for _,v in pairs(sorcery.register.infusions.db) do
   230    235   				if v.infuse == ingredient and v.into == base then
   231    236   					-- at least one combination makes a valid
   232    237   					-- potion; we can start the infuser
   233         -					goto start
          238  +					if v.output.data and v.output.data.color then
          239  +						sparkle_color[#sparkle_color+1] = sorcery.lib.color(v.output.data.color)
          240  +					end
          241  +					cancel = false
   234    242   				end
   235    243   			end
   236    244   		::skip:: end
   237    245   
   238         -		::cancel:: do
          246  +		::cancel:: if cancel then
   239    247   			infuser_stop(pos)
   240    248   			return false
   241    249   		end
   242    250   
   243    251   		::start::
   244    252   	end
   245    253   
................................................................................
   268    276   				type = "vertical_frames";
   269    277   				aspect_h = 16;
   270    278   				aspect_w = 16;
   271    279   				length = 4.1;
   272    280   			};
   273    281   		}
   274    282   	end
   275         -	-- for i=0,4 do
   276         -		spawn('sorcery_spark.png^[multiply:#FF8FDD', 1, 32 * 4)
   277         -	-- end
   278         -	-- for i=0,4 do
   279         -		spawn('sorcery_spark.png^[multiply:#FFB1F6', 0.5, 64 * 4)
   280         -	-- end
   281         -	
          283  +	local spark = sorcery.lib.image('sorcery_spark.png')
          284  +	for i = 1,4 do
          285  +		local fac = 1 / i
          286  +		local _, spc = sorcery.lib.tbl.pick(sparkle_color)
          287  +		local sp = spark:glow(spc)
          288  +
          289  +		spawn(sp:render(), fac, (32/fac) * 4)
          290  +	end
          291  +
   282    292   	local discharge = sorcery.lib.node.discharger(pos)
   283    293   	
   284    294   	if newtime >= infusion_time then
   285    295   		-- finished
   286    296   		local ingredient = infusion[1]:get_name()
   287    297   		local result, residue = sorcery.alchemy.infuse(infusion[1], potions)
   288    298   		for i, r in pairs(result) do