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
(24 intermediate revisions by the same user not shown)
Line 16: Line 16:
['Has game mode']      = {'Has game mode', ',' },
['Has game mode']      = {'Has game mode', ',' },
['Platform']            = {'Has platform', ',' },
['Platform']            = {'Has platform', ',' },
['Multiplayer tools']  = {'Has multiplayer tools', ',' }
}
}
return propMap
return propMap
end
end


local function infoboxOrderPlan()
local function infoboxSectionPlan()
local propOrder = {
local sectionMap = {
'Developer',
['Game Info'] = {
'Publisher',
heading = 'Game Info',
'Genre',
template = 'Infobox/Game Info',
'Setting',
order = '1',
'Has game mode',
rows = {
'Platform',
'Developer',
'Current version',
'Publisher',
'Release date',
'Genre',
}
'Setting',
return propOrder
'Has game mode',
end
'Platform',
 
'Release date',
local function dataPlan()
'System requirements'
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'] = {
['These days'] = {
label    = 'Publisher',
heading = 'These days',
value    = '%s',
template = 'Infobox/These days',
separator = ',',
order = '2',
template  = 'render',
rows = {
valuefmt  = 'wikilink',
'Community links',
class    = twocolumns
'Multiplayer tools',
},
'Current version',
['Genre'] = {
'Store links'
label    = 'Genre',
}
value    = '%s',
separator = ',',
template  = '',
valuefmt  = '',
class    = twocolumns
},
['Setting'] = {
label    = 'Setting',
value    = '%s',
separator = ',',
template = '',
valuefmt  = '',
class    = twocolumns
},
['Has game mode'] = {
label    = 'Game Mode',
value    = '%s',
separator = ',',
template  = '',
valuefmt  = '',
class    = twocolumns
},
['Platform'] = {
label    = 'Platform',
value    = '%s',
separator = ',',
template  = '',
valuefmt  = 'wikilink',
class    = twocolumns
}
}
}
}
return sectionFormat
return sectionMap
end
 
local function subobjectPlan()
return {}
end
end


Line 97: Line 56:
local category  = 'Games'
local category  = 'Games'
local properties = propertiesPlan()
local properties = propertiesPlan()
local order      = infoboxOrderPlan()
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, 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