From 5609738464d2964fdb0c468d0a77542e6f1aa12f Mon Sep 17 00:00:00 2001 From: Drew C Date: Tue, 10 Mar 2026 17:05:01 -0500 Subject: [PATCH] Add FoCAPI docus --- .luadefs/focapi-functions-emmyluadoc.lua | 39 +++++++++++++++++++ .../Miscellaneous/GameManager/ColorStruct.lua | 7 +++- .../Miscellaneous/GameManager/Constants.lua | 10 ++--- .../GameManager/FactionStruct.lua | 2 +- 4 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 .luadefs/focapi-functions-emmyluadoc.lua diff --git a/.luadefs/focapi-functions-emmyluadoc.lua b/.luadefs/focapi-functions-emmyluadoc.lua new file mode 100644 index 0000000..a291342 --- /dev/null +++ b/.luadefs/focapi-functions-emmyluadoc.lua @@ -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 diff --git a/Data/Scripts/Miscellaneous/GameManager/ColorStruct.lua b/Data/Scripts/Miscellaneous/GameManager/ColorStruct.lua index 6f2d13b..ef424f9 100644 --- a/Data/Scripts/Miscellaneous/GameManager/ColorStruct.lua +++ b/Data/Scripts/Miscellaneous/GameManager/ColorStruct.lua @@ -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 diff --git a/Data/Scripts/Miscellaneous/GameManager/Constants.lua b/Data/Scripts/Miscellaneous/GameManager/Constants.lua index b3f3286..7c9c8b2 100644 --- a/Data/Scripts/Miscellaneous/GameManager/Constants.lua +++ b/Data/Scripts/Miscellaneous/GameManager/Constants.lua @@ -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" diff --git a/Data/Scripts/Miscellaneous/GameManager/FactionStruct.lua b/Data/Scripts/Miscellaneous/GameManager/FactionStruct.lua index 4bb21e5..b676061 100644 --- a/Data/Scripts/Miscellaneous/GameManager/FactionStruct.lua +++ b/Data/Scripts/Miscellaneous/GameManager/FactionStruct.lua @@ -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 = ""