Module:Infobox2

From Against the Storm Official Wiki
Revision as of 18:19, 6 October 2024 by Aeredor (talk | contribs) (WIP new infobox module)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

---
--- Retrieves data for the specified building, good, order, perk, etc. and sends the data over to the view, another template.
---
--- @module Infobox2
local Infobox2 = {}


local VIEW_TEMPLATE = "Template:Infobox"

local ARG_TYPE = "type"
local ARG_ID = "id"

--region Public methods

function Infobox2.main(frame)

	local type = frame.args[ARG_TYPE]
	if not type then
		error("You must specify the type of Infobox. Please see the template documentation for how to use the parameters.")
	end
	local id = frame.args[ARG_ID]
	if not id then
		error("You must specify the id of the " .. type .. ". Please see the  template documentation for how to use the parameters.")
	end
	
	

	local viewParameters = {
		["title"] = "Furnace",
		["subtitle"] = "Production Building",
		["description"] = "Can produce: Pie (**), Skewers (**), Copper Bars (**). Can use: Drizzle Water.",
		["specialization"] = "Warmth",
		["iconfilename"] = "Furnace_icon.png",
		["workplaces"] = 3,
		["id"] = "Furnace",
	}

	return frame:expandTemplate{ title = VIEW_TEMPLATE, args = viewParameters }
end

--endregion

return Infobox2