×
Create a new article
Write your page title here:
We currently have 5 articles on Test2 Wiki. Type your article name above or create one of the articles listed here!



    Test2 Wiki
    5Articles
    This wiki has been automatically closed because there have been no edits or log actions made within the last 60 days. If you are a user (who is not the bureaucrat) that wishes for this wiki to be reopened, please request that at Requests for reopening wikis. If this wiki is not reopened within 6 months it may be deleted. Note: If you are a bureaucrat on this wiki, you can go to Special:ManageWiki and uncheck the "Closed" box to reopen it.

    Documentation for this module may be created at Module:GetInfo/doc

    local getArgs = require("Module:Args").getArgs
    local resourceTypes = require("Module:ResourceTypes")
    
    local m = {}
    
    function m.GetImages(f)
    	local baseTypes = {
    		plank = "Wood",
    		slab = "Stone",
    		ingot = "Metal",
    		glass = "Pane"
    	}
    	local exceptions = { --\\ Future proofing
    		bluespruce = "Blue_Spruce"
    	}
    
    	local materials = getArgs(f).Material
    	materials = materials:gsub("<br%s?/>",""); materials = materials:gsub(",%s*","")
    	local imageSize = getArgs(f).ImageSize or "25px"
    	for num, str in materials:gmatch("(%d+)%s*([%a%s]+)") do
    		str = str:gsub("%s",""); local lowerStr = str:lower()
    		if baseTypes[lowerStr] or baseTypes[lowerStr:gsub("e?s?$","")] then
    			local formattedStr = baseTypes[lowerStr] and str or str:gsub("e?s?$","")
    			materials = materials:gsub(num.."%s*"..str, num.." [[File:Base"..formattedStr..".png|"..imageSize.."|link="..(baseTypes[lowerStr] or baseTypes[lowerStr:gsub("e?s?$","")]).."]]<br/>")
    		else
    			local link = exceptions[str:lower()] and exceptions[str:lower()] or nil
    			for index, resourceTable in pairs(resourceTypes) do
    				for _, material in pairs(resourceTable) do
    					if lowerStr == material:lower() then
    						materials = materials:gsub(num.."%s*"..str, num.." [[File:"..material..index..".png|"..imageSize.."|link="..(link or material).."]]<br/>")
    					end
    				end
    			end
    		end
    	end
    	materials = materials:gsub("<br/>$","")
    	return materials
    end
    
    function m.GetMetalSpawns(f)
    	local metalSpawns = require("Module:MetalSpawns")
    	
    	local stones = getArgs(f).Stone or ""
    	local metals = getArgs(f).Metal or ""
    	if metals ~= "" and not metals:match("[<br/>]$") then metals = metals.."<br/>" end
    	
    	for str in stones:gmatch("(%a[%a%s]+)") do
    		if not str:match("<br/>") and metalSpawns[str] then
    			for _,v in pairs(metalSpawns[str]) do
    				if not metals:match(v) then
    					metals = metals.."[["..v.."]]<br/>"
    				end
    			end
    		end
    	end
    	metals = metals:gsub("<br/>$","")
    	return metals
    end
    
    return m
    
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.

    Recent changes

  • Fjalon • 3 months ago
  • Fjalon • 3 months ago
  • Fjalon • 3 months ago
  • Fjalon • 3 months ago
  • Cookies help us deliver our services. By using our services, you agree to our use of cookies.