VALORANT Esports Wiki
Register
Advertisement

To edit the documentation or categories for this module, click here.


For names see {{Rolenames}}m

Allowed settings:

  • |sub= (makes it a sub)
  • |sorted= (adds a display:none; sort number before the rest of the output)
  • |allowdefault= (allow the input to be displayed even if it's not recognized as a valid input, use for staff etc)

Call p.main() from MediaWiki via #invoke; do NOT call this from Lua though, instead call a style function directly.


local p = require('Module:RoleAbstract'):extends()

p.modifierLengths = {
	sub = {
		short = 'Sub',
		name = "Substitute",
		role = "Substitute",
		store = "Substitute",
		sentence = "substitute",
		prep = "for",
		article = "a",
		sortnumber = 16,
	},
	trainee = {
		short = 'TRN',
		name = 'Trainee',
		role = 'Trainee',
		store = 'Trainee',
		sentence = 'trainee',
		prep = 'with',
		article = 'a',
		sortnumber = 17,
	},
}

function p:name(opts)
	if not opts then opts = {} end
	if self.is_nil then return end
	if self:hasPrefix() and self:isIngame() then
		return self.modifierLengths[self.modifier][opts.len or self.defaultlength]
	end
	return self:get(opts.len)
end

function p:getSpriteKey(opts)
	if self:hasPrefix() and self:isIngame() then
		return self.modifierLengths[self.modifier].name
	end
	return self:super('getSpriteKey', opts)
end

return p
Advertisement