Use FoCAPI GameObjectTypeWrapper Get_Display_Name()
This commit is contained in:
@@ -39,3 +39,15 @@ function Add_Tutorial_Text(key, text, duration, r, g, b, a) end
|
|||||||
---Removes the specified text key from the tutorial text box.
|
---Removes the specified text key from the tutorial text box.
|
||||||
---@param key string The key to remove.
|
---@param key string The key to remove.
|
||||||
function Remove_Tutorial_Text(key) end
|
function Remove_Tutorial_Text(key) end
|
||||||
|
|
||||||
|
-- ==================================================
|
||||||
|
-- GameObjectType extensions
|
||||||
|
-- ==================================================
|
||||||
|
|
||||||
|
---@class GameObjectType
|
||||||
|
---A generic GameObjectType that represents a C++ GameObjectTypeClass
|
||||||
|
local GameObjectType = {}
|
||||||
|
---@public
|
||||||
|
---Returns the display name for the object type.
|
||||||
|
---@return string
|
||||||
|
function GameObjectType.Get_Display_Name() end
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ function SkirmishGameClass:CombatTextUnitBuilt(unit)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local timeText = FormatTime(unit.BuildTime)
|
local timeText = FormatTime(unit.BuildTime)
|
||||||
local text = string.format("%s\t<T%d> [%s]: BUILT %s ($%d)", timeText, team.Number, owner.Name, unit.Name,
|
local text = string.format("%s\t<T%d> [%s]: BUILT %s ($%d)", timeText, team.Number, owner.Name, unit.DisplayName,
|
||||||
unit.BuildCost)
|
unit.BuildCost)
|
||||||
local faction = Factions[owner.Faction]
|
local faction = Factions[owner.Faction]
|
||||||
---@type ColorStruct
|
---@type ColorStruct
|
||||||
@@ -95,7 +95,8 @@ function SkirmishGameClass:CombatTextUnitKilled(unit)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local text = string.format("%s\t<T%d> [%s]: MISTAKES WERE MADE %s", timeText, team.Number, owner.Name, unit.Name)
|
local text = string.format("%s\t<T%d> [%s]: MISTAKES WERE MADE %s", timeText, team.Number, owner.Name,
|
||||||
|
unit.DisplayName)
|
||||||
local color = ColorStruct:New(0.8, 0.8, 0.8, 1)
|
local color = ColorStruct:New(0.8, 0.8, 0.8, 1)
|
||||||
|
|
||||||
self.CombatFeed:Append(text, -1, color)
|
self.CombatFeed:Append(text, -1, color)
|
||||||
@@ -106,7 +107,8 @@ function SkirmishGameClass:CombatTextUnitKilled(unit)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local text = string.format("%s\t<T%d> [%s]: KILLED %s (%s)", timeText, team.Number, killer.Name, unit.Name,
|
local text = string.format("%s\t<T%d> [%s]: KILLED %s (%s)", timeText, team.Number, killer.Name, unit
|
||||||
|
.DisplayName,
|
||||||
owner.Name)
|
owner.Name)
|
||||||
local faction = Factions[killer.Faction]
|
local faction = Factions[killer.Faction]
|
||||||
---@type ColorStruct
|
---@type ColorStruct
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ require("PGBase")
|
|||||||
|
|
||||||
---@class UnitClass
|
---@class UnitClass
|
||||||
---@field Name string Unit name.
|
---@field Name string Unit name.
|
||||||
|
---@field DisplayName string The localized display name.
|
||||||
---@field OwnerId integer Owner Player ID.
|
---@field OwnerId integer Owner Player ID.
|
||||||
---@field BuildCost integer Tactical build cost.
|
---@field BuildCost integer Tactical build cost.
|
||||||
---@field CombatRating integer AI combat power rating.
|
---@field CombatRating integer AI combat power rating.
|
||||||
@@ -15,12 +16,13 @@ UnitClass = {}
|
|||||||
UnitClass.__index = UnitClass
|
UnitClass.__index = UnitClass
|
||||||
|
|
||||||
---Constructs a new Unit object.
|
---Constructs a new Unit object.
|
||||||
---@param objectType table FoC GameObjectTypeWrapper object
|
---@param objectType GameObjectType FoC GameObjectTypeWrapper object
|
||||||
---@param playerId integer The Owner Player ID
|
---@param playerId integer The Owner Player ID
|
||||||
function UnitClass:New(objectType, playerId)
|
function UnitClass:New(objectType, playerId)
|
||||||
local self = setmetatable({}, UnitClass)
|
local self = setmetatable({}, UnitClass)
|
||||||
|
|
||||||
self.Name = objectType.Get_Name()
|
self.Name = objectType.Get_Name()
|
||||||
|
self.DisplayName = objectType.Get_Display_Name()
|
||||||
self.OwnerId = playerId
|
self.OwnerId = playerId
|
||||||
self.BuildCost = objectType.Get_Tactical_Build_Cost()
|
self.BuildCost = objectType.Get_Tactical_Build_Cost()
|
||||||
self.CombatRating = objectType.Get_Combat_Rating()
|
self.CombatRating = objectType.Get_Combat_Rating()
|
||||||
|
|||||||
Reference in New Issue
Block a user