Restoring stat tables WIP

This commit is contained in:
2026-03-20 09:49:44 -05:00
parent 68449e1a78
commit a5fb7e950a
6 changed files with 437 additions and 30 deletions

View File

@@ -2,9 +2,10 @@ require("PGBase")
---@class UnitClass
---@field Name string Unit name.
---@field DisplayName string The localized display name.
---@field DisplayName string|nil The localized display name.
---@field OwnerId integer Owner Player ID.
---@field BuildCost integer Tactical build cost.
---@field BuildCost integer Galactic build cost.
---@field TacticalBuildCost integer Tactical build cost.
---@field CombatRating integer AI combat power rating.
---@field ScoreValue integer Score cost credits.
---@field BuildTime number Game time that this unit was built.
@@ -17,15 +18,16 @@ UnitClass = {}
UnitClass.__index = UnitClass
---Constructs a new Unit object.
---@param objectType GameObjectType FoC GameObjectTypeWrapper object
---@param objectType GameObjectType The game object type.
---@param playerId integer The Owner Player ID
function UnitClass:New(objectType, playerId)
local self = setmetatable({}, UnitClass)
self.Name = objectType.Get_Name()
self.DisplayName = objectType.Get_Display_Name()
_, self.DisplayName = pcall(objectType.Get_Display_Name)
self.OwnerId = playerId
self.BuildCost = objectType.Get_Tactical_Build_Cost()
self.BuildCost = objectType.Get_Build_Cost()
self.TacticalBuildCost = objectType.Get_Tactical_Build_Cost()
self.CombatRating = objectType.Get_Combat_Rating()
self.ScoreValue = objectType.Get_Score_Cost_Credits()
self.BuildTime = GetCurrentTime()