PC Gaming Shelter
An archive dedicated to preserving PC Gaming history and more

Module:Game: Difference between revisions

From PC Gaming Shelter
No edit summary
No edit summary
(5 intermediate revisions by the same user not shown)
Line 19: Line 19:
}
}
return propMap
return propMap
end
local function infoboxOrderPlan()
local propOrder = {
'Developer',
'Publisher',
'Genre',
'Setting',
'Has game mode',
'Platform',
'Release date',
'System requirements',
'Multiplayer tools',
'Current version'
}
return propOrder
end
end


Line 40: Line 24:
local sectionMap = {
local sectionMap = {
['Game Info'] = {
['Game Info'] = {
'Developer',
heading = 'Game Info',
'Publisher',
template = 'Infobox/Game Info',
'Genre',
order = '1',
'Setting',
rows = {
'Has game mode',
'Developer',
'Platform',
'Publisher',
'Release date',
'Genre',
'System requirements'
'Setting',
'Has game mode',
'Platform',
'Release date',
'System requirements'
}
},
},
['These days'] = {
['These days'] = {
'Multiplayer tools',
heading = 'These days',
'Current version'
template = 'Infobox/These days',
order = '2',
rows = {
'Community links',
'Multiplayer tools',
'Current version',
'Store links'
}
}
}
}
}
return sectionMap
return sectionMap
end
local function dataPlan()
local onecolumn = utils.infoboxSectionClasses()['onecolumn']
local twocolumns = utils.infoboxSectionClasses()['twocolumns']
local sectionFormat = {
['Developer'] = {
label    = 'Developer',
value    = '%s',
separator = ',',
template  = 'render',
valuefmt  = 'wikilink',
class    = twocolumns
},
['Publisher'] = {
label    = 'Publisher',
value    = '%s',
separator = ',',
template  = 'render',
valuefmt  = 'wikilink',
class    = twocolumns
},
['Genre'] = {
label    = 'Genre',
value    = '%s',
separator = ',',
template  = 'render',
valuefmt  = '',
class    = twocolumns
},
['Setting'] = {
label    = 'Setting',
value    = '%s',
separator = ',',
template  = 'render',
valuefmt  = '',
class    = twocolumns
},
['Has game mode'] = {
label    = 'Game Mode',
value    = '%s',
separator = ',',
template  = 'render',
valuefmt  = '',
class    = twocolumns
},
['Platform'] = {
label    = 'Platform',
value    = '%s',
separator = ',',
template  = 'render',
valuefmt  = '',
class    = twocolumns
},
['Release date'] = {
label    = 'Released',
value    = '%s',
separator = ',',
template  = 'render',
valuefmt  = 'date',
class    = twocolumns
},
['System requirements'] = {
label    = 'System Req.',
value    = '%s',
separator = ',',
template  = 'render',
valuefmt  = '',
class    = twocolumns
},
['Current version'] = {
label    = 'Version',
value    = '%s',
separator = ',',
template  = 'render',
valuefmt  = '',
class    = twocolumns
},
['Multiplayer tools'] = {
label    = 'Multiplayer',
value    = '%s',
separator = ',',
template  = 'render',
valuefmt  = '',
class    = twocolumns
}
}
return sectionFormat
end
local function subobjectPlan()
return {
{
subobject = 'Store links',
label = 'Store'
},
{
subobject = 'Community links',
label = 'Community',
order = '9'
}
}
end
end


Line 162: Line 56:
local category  = 'Games'
local category  = 'Games'
local properties = propertiesPlan()
local properties = propertiesPlan()
local order      = infoboxOrderPlan()
local sections  = infoboxSectionPlan()
local sections  = infoboxSectionPlan()
local data      = dataPlan()
local footer    = 'Game footer'
local subobjects = subobjectPlan()
local infobox    = utils.createInfobox(frame, category, properties, sections, footer)
local infobox    = utils.createInfobox(frame, category, properties, order, sections, data, subobjects)
return infobox
return infobox
end
end


return p
return p

Revision as of 22:07, 23 March 2026

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

local utils = require( 'Module:Utils' )

local p = {}

local function propertiesPlan()
	-- ['Form field name'] = { 'Semantic property', 'delimiter' }
	local propMap = {
		['Release date']        = {'Has release date' },
		['Developer']           = {'Has developer', ',' },
		['Publisher']           = {'Has publisher' },
		['Series']              = {'Has series', ',' },
		['Image']               = {'Image', 'file' },
		['Current version']     = {'Has version' },
		['Genre']               = {'Has genre', ',' },
		['Setting']             = {'Has setting', ',' },
		['Has game mode']       = {'Has game mode', ',' },
		['Platform']            = {'Has platform', ',' },
		['Multiplayer tools']   = {'Has multiplayer tools', ',' }
	}
	return propMap
end

local function infoboxSectionPlan()
	local sectionMap = {
		['Game Info'] = {
			heading = 'Game Info',
			template = 'Infobox/Game Info',
			order = '1',
			rows = {
				'Developer',
				'Publisher',
				'Genre',
				'Setting',
				'Has game mode',
				'Platform',
				'Release date',	
				'System requirements'
			}
		},
		['These days'] = {
			heading = 'These days',
			template = 'Infobox/These days',
			order = '2',
			rows = {
				'Community links',
				'Multiplayer tools',
				'Current version',
				'Store links'
			}
		}
	}
	return sectionMap
end

function p.infobox(frame)
	local category   = 'Games'
	local properties = propertiesPlan()
	local sections   = infoboxSectionPlan()
	local footer     = 'Game footer'
	local infobox    = utils.createInfobox(frame, category, properties, sections, footer)
	return infobox
end

return p