Module:Factions

From BTAWiki
Revision as of 03:23, 20 January 2021 by Rust dev (talk | contribs) (Created page with "-- Module:Factions handles translating faction tags to their full names local p = {} local mechs = require('Module:Mech').core local getArgs = require('Module:Arguments').ge...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

-- Module:Factions handles translating faction tags to their full names

local p = {}

local mechs = require('Module:Mech').core
local getArgs = require('Module:Arguments').getArgs

p.factionTags = {
  AuriganDirectorate = 'Aurigan Directorate',
  AuriganMercenaries = 'Mercenaries',
  AuriganPirates = 'Pirates',
  AuriganRestoration = 'Aurigan Restoration (Arano)',
  Chainelane = 'Chainelane Isles',
  Circinus = 'Circinus Federation',
  ClanGhostBear = 'Clan Ghost Bear',
  ClanJadeFalcon = 'Clan Jade Falcon',
  ClanWolf = 'Clan Wolf',
  ComStar = 'Comstar',
  Davion = 'Federated Suns (Davion)',
  Delphi = 'New Delphi Compact',
  Hanse = 'Hanseatic League',
  JarnFolk = 'JarnFolk',
  Kurita = 'Draconis Combine (Kurita)',
  Liao = 'Capellan Confederation (Liao)',
  Locals = 'Local Government',
  MagistocracyOfCanopus = 'Magistocracy of Canopus',
  Marian = 'Marian Hegemony',
  Marik = 'Free Worlds League (Marik)',
  Outworld = 'Outworld Alliance',
  Rasalhague = 'Free Rasalhague Republic',
  Rim = 'Rim Collection',
  Steiner = 'Lyran Commonwealth (Steiner)',
  TaurianConcordat = 'Taurian Concordat',
  Tortuga = 'Tortuga Dominions'
}

function p.mechFactions(frame)
  local tpl_args = getArgs(frame, {parentFirst=true})
  variant = tpl_args[1]

  local mech = mechs.mech:new(variant)

  local factionList = mw.html.create('ul')

  for _, tag in ipairs(mech.tags) do
    if p.factionTags[tag] ~= nil then
      factionList:tag('li'):wikitext(p.factionTags[tag])
    end
  end
  
  return factionList
end

return p