42 lines
1.0 KiB
Lua
42 lines
1.0 KiB
Lua
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
local ____exports = {}
|
|
--- Синхронизация «ярости» (игровая мана) с клиентом для кастомного HUD.
|
|
local TABLE = "hero_rage"
|
|
function ____exports.syncHeroRageNetTable(self, hero, current, max, active)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local pid = hero:GetPlayerOwnerID()
|
|
if pid < 0 then
|
|
return
|
|
end
|
|
local row = {
|
|
current = math.floor(current + 0.5),
|
|
max = math.max(
|
|
0,
|
|
math.floor(max + 0.5)
|
|
),
|
|
active = active and 1 or 0
|
|
}
|
|
CustomNetTables:SetTableValue(
|
|
TABLE,
|
|
tostring(pid),
|
|
row
|
|
)
|
|
end
|
|
function ____exports.clearHeroRageNetTable(self, hero)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local pid = hero:GetPlayerOwnerID()
|
|
if pid < 0 then
|
|
return
|
|
end
|
|
CustomNetTables:SetTableValue(
|
|
TABLE,
|
|
tostring(pid),
|
|
{current = 0, max = 0, active = 0}
|
|
)
|
|
end
|
|
return ____exports
|