sorcery  Diff

Differences From Artifact [db73c43862]:

To Artifact [b7e36caf54]:


    89     89   		local geom = {
    90     90   			pxl {2,0,2; 14, 2, 14};
    91     91   			pxl {2,2,2; 4,h,14};
    92     92   			pxl {2,2,2; 14,h,4};
    93     93   
    94     94   			pxl {12,2,2; 14,h,14};
    95     95   			pxl {2,2,12; 14,h,14};
    96         -
    97     96   		}
    98     97   		if lvl > 0 then
    99     98   			local fac = lvl / M
   100     99   			return L.tbl.append({
   101    100   				pxl {4,2,4; 12, 2 + ((h-3)*fac), 12};
   102    101   			}, geom)
   103    102   		else return geom end
................................................................................
   106    105   	for i = 1*f,M*f do
   107    106   		local top = L.image('sorcery_trough_top_overlay.png')
   108    107   		if liq then top = top:blit( 
   109    108   			L.image('sorcery_node_liquid.png'):multiply(L.color(liq.color))
   110    109   		) else top=top:blit(
   111    110   			L.image('sorcery_trough_bottom.png')
   112    111   		) end
   113         -		local trough_title = liq and string.format('%s Trough', L.str.capitalize(liq.name))
   114         -		local trough_content = liq and string.format('%s of %s', liq.measure(i * Q), liq.name)
   115         -		local function trough_caption(pos,i) 
          112  +		local ttlc = function(liq) return
          113  +			liq and string.format('%s Trough', L.str.capitalize(liq.name)),
          114  +			liq and string.format('%s of %s', liq.measure(i * Q), liq.name)
          115  +		end
          116  +		local trough_title, trough_content = ttlc(liq)
          117  +		local function trough_caption(pos,i,l) 
          118  +			local trough_title, trough_content = ttlc(l or liq)
   116    119   			minetest.get_meta(pos):set_string('infotext', i > 0 and string.format(
   117    120   				'%s\n(%s)', trough_title, trough_content
   118    121   			) or 'Empty Trough')
   119    122   		end
   120    123   		sorcery.register.residue.link(lid(i),lid(0))
   121    124   		minetest.register_node(':'..lid(i), {
   122    125   			description = liq and L.ui.tooltip {
................................................................................
   174    177   						trough_caption(pos, vol)
   175    178   					end;
   176    179   					set_node_liq = function(pos, liq, vol)
   177    180   						log.act('adding', vol, 'to trough at', liq)
   178    181   						vol = vol or Q * i
   179    182   						local idx = math.min(M, math.floor(vol/Q))
   180    183   						minetest.swap_node(pos, {name = trough_mkid(liq, idx)})
   181         -						trough_caption(pos, idx)
          184  +						trough_caption(pos, idx, liq)
   182    185   					end
   183    186   				}
   184    187   			};
   185    188   		})
   186    189   	end
   187    190   end
   188    191   sorcery.liquid.mktrough()