Add FoCAPI docus

This commit is contained in:
2026-03-10 17:05:01 -05:00
parent 7226e4891f
commit 5609738464
4 changed files with 50 additions and 8 deletions

View File

@@ -0,0 +1,39 @@
---@diagnostic disable
-- ==================================================
-- I/O
-- ==================================================
---@public
---Appends the text to file.
---@param file string The file name.
---@param text string The text to append.
function WriteToFile(file, text) end
-- ==================================================
-- Finders
-- ==================================================
---Finds all Players in the game.
---@return PlayerObject[]
function Get_All_Players() end
-- ==================================================
-- UI
-- ==================================================
---@public
---Adds the specified text to the tutorial text box.
---@param key string The key to use.
---@param text string The text to add.
---@param duration number The duration to keep text on screen, defaults to -1 (infinite).
---@param r number The red color component.
---@param g number The green color component.
---@param b number The blue color component.
---@param a number The alpha channel component.
function Add_Tutorial_Text(key, text, duration, r, g, b, a) end
---@public
---Removes the specified text key from the tutorial text box.
---@param key string The key to remove.
function Remove_Tutorial_Text(key) end

View File

@@ -4,6 +4,7 @@ require("PGBase")
---@field R number The red component.
---@field G number The green component.
---@field B number The blue component.
---@field A number The alpha component.
ColorStruct = {}
ColorStruct.__index = ColorStruct
@@ -11,17 +12,19 @@ ColorStruct.__index = ColorStruct
---@param r number The red component
---@param g number The green component
---@param b number The blue component
---@param a number The alpha component
---@return ColorStruct
function ColorStruct:New(r, g, b)
function ColorStruct:New(r, g, b, a)
local self = setmetatable({}, ColorStruct)
self.R = Clamp(r, 0, 1)
self.G = Clamp(g, 0, 1)
self.B = Clamp(b, 0, 1)
self.A = Clamp(a, 0, 1)
return self
end
function ColorStruct:Debug()
return string.format("RGB (%d, %d, %d)", self.R, self.G, self.B)
return string.format("RGB (%d, %d, %d, %d)", self.R, self.G, self.B, self.A)
end

View File

@@ -15,7 +15,7 @@ function DefineFactions()
local RebelFaction = FactionStruct:New("REBEL")
RebelFaction.DisplayName = "Rebellion"
RebelFaction.Color = ColorStruct:New(1, 0, 0)
RebelFaction.Color = ColorStruct:New(1, 0, 0, 1)
RebelFaction.Icon = "I_ICON_SPECTATOR_REBEL.TGA"
RebelFaction.LandStartUnitName = "Rebel_Infantry_Squad"
RebelFaction.SpaceStartUnitName = "Rebel_X-Wing_Squadron"
@@ -26,7 +26,7 @@ function DefineFactions()
local EmpireFaction = FactionStruct:New("EMPIRE")
EmpireFaction.DisplayName = "Empire"
EmpireFaction.Color = ColorStruct:New(0, 1, 1)
EmpireFaction.Color = ColorStruct:New(0, 1, 1, 1)
EmpireFaction.Icon = "I_ICON_SPECTATOR_EMPIRE.TGA"
EmpireFaction.LandStartUnitName = "Imperial_Stormtrooper_Squad"
EmpireFaction.SpaceStartUnitName = "TIE_Interceptor_Squadron_Container"
@@ -37,7 +37,7 @@ function DefineFactions()
local UnderworldFaction = FactionStruct:New("UNDERWORLD")
UnderworldFaction.DisplayName = "Zann Consortium"
UnderworldFaction.Color = ColorStruct:New(1, 1, 0)
UnderworldFaction.Color = ColorStruct:New(1, 1, 0, 1)
UnderworldFaction.Icon = "I_ICON_SPECTATOR_UNDERWORLD.TGA"
UnderworldFaction.LandStartUnitName = "Underworld_Merc_Squad"
UnderworldFaction.SpaceStartUnitName = "StarViper_Team"
@@ -47,7 +47,7 @@ function DefineFactions()
local HuttFaction = FactionStruct:New("HUTTS")
HuttFaction.DisplayName = "Hutt Cartel"
HuttFaction.Color = ColorStruct:New(1, 0, 1)
HuttFaction.Color = ColorStruct:New(1, 0, 1, 1)
HuttFaction.Icon = "I_ICON_SPECTATOR_HUTTS.TGA"
HuttFaction.LandStartUnitName = "Hutt_Soldier_Squad"
HuttFaction.SpaceStartUnitName = "V_Wing_Squadron_Container"
@@ -57,7 +57,7 @@ function DefineFactions()
local PirateFaction = FactionStruct:New("PIRATES")
PirateFaction.DisplayName = "Pirates"
PirateFaction.Color = ColorStruct:New(0, 1, 0)
PirateFaction.Color = ColorStruct:New(0, 1, 0, 1)
PirateFaction.Icon = "I_ICON_SPECTATOR_PIRATES.TGA"
PirateFaction.LandStartUnitName = "Pirate_Soldier_Squad"
PirateFaction.SpaceStartUnitName = "Pirate_Fighter_Squadron"

View File

@@ -18,7 +18,7 @@ function FactionStruct:New(name)
self.Name = name
self.DisplayName = name
self.Color = ColorStruct:New(1, 1, 1)
self.Color = ColorStruct:New(1, 1, 1, 1)
self.Icon = ""
self.LandStartUnitName = ""
self.SpaceStartUnitName = ""