1--! \page global_variables Global Variables
2--! \section Factions Factions
4--! See Factions
for the
module on factions.\n\n
5--! FrameworkZ.Factions.List\n
6--! A list of all instanced factions in the game and their online members.
8FrameworkZ = FrameworkZ or {}
10--! \brief Factions module for FrameworkZ. Defines and interacts with FACTION object.
11--! \class FrameworkZ.Factions
12FrameworkZ.Factions = {}
13FrameworkZ.Factions.__index = FrameworkZ.Factions
14FrameworkZ.Factions.List = {}
15FrameworkZ.Factions = FrameworkZ.Foundation:NewModule(FrameworkZ.Factions, "Factions")
17--! \brief Faction class for FrameworkZ.
20FACTION.__index = FACTION
22--! \brief Initialize a faction.
23--! \return \string faction ID
24function FACTION:Initialize()
25 return FrameworkZ.Factions:Initialize(self.name, self)
28function FACTION:GetColor()
32--! \brief Create a new faction object.
33--! \param name \string Faction name.
34--! \return \table The new faction object.
35function FrameworkZ.Factions:New(name)
39 description = "No description available.",
40 color = {r = 1, g = 1, b = 1, a = 1},
45 setmetatable(object, FACTION)
50--! \brief Initialize a faction.
51--! \param data \table The faction object's data.
52--! \param name \string The faction's name (i.e. ID).
53--! \return \string The faction ID.
54function FrameworkZ.Factions:Initialize(id, object)
55 FrameworkZ.Factions.List[id] = object
60--! \brief Get a faction by their ID.
61--! \param factionID \string The faction's ID
62--! \return \table The faction's object.
63function FrameworkZ.Factions:GetFactionByID(factionID)
64 local faction = FrameworkZ.Factions.List[factionID] or nil
69--! \brief Get a faction's name by their ID. Useful for getting a faction's actual name if the initialized faction ID differs from the name field.
70--! \param factionID \string The faction's ID.
71--! \return \string The faction's name.
72function FrameworkZ.Factions:GetFactionNameByID(factionID)
73 local faction = FrameworkZ.Factions.List[factionID] or nil
75 return faction and faction.name
Faction class for FrameworkZ.
string Initialize()
Initialize a faction.
Factions module for FrameworkZ. Defines and interacts with FACTION object.
FrameworkZ Factions __index