/
SN1054NGC
/
DayZ_Projects_cpp
Обзор
Документация
Войти
/
SN1054NGC
/
DayZ_Projects_cpp
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
scripts/4_world/classes/remoteplayerdebug/remoteplayerstatdebug.c
96 строк
2 KB
SN1054NGC
Initial DayZ mod project commit
26 ноя 2025, 01:03
26 ноя 2025, 01:03
fddb039
Код
Авторство
О чём код?
enum eRemoteStatType { NONE, DAMAGE_SYSTEM = 1, PLAYER_STATS = 2, OTHER = 4, } class RemotePlayerStatDebug { PlayerBase m_Player; ref array<ref StatDebugObject> m_Stats = new array<ref StatDebugObject>; string m_Name; vector m_Pos; void RemotePlayerStatDebug(PlayerBase player) { m_Player = player; Init(); } void Init() { UpdatePlayerStatsValues(); InjectDamageSystemValues(); m_Pos = m_Player.GetWorldPosition(); m_Name = m_Player.GetIdentity().GetName(); } PlayerBase GetPlayer() { return m_Player; } void UpdatePlayerStatsValues() { m_Player.GetPlayerStats().GetDebugInfo(m_Stats, 0); } void InjectDamageSystemValues() { m_Stats.Insert( new StatDebugObject("Health", m_Player.GetHealth("",""), eRemoteStatType.DAMAGE_SYSTEM) ); m_Stats.Insert( new StatDebugObject("Blood", m_Player.GetHealth("","Blood"), eRemoteStatType.DAMAGE_SYSTEM) ); m_Stats.Insert( new StatDebugObject("Shock", m_Player.GetHealth("","Shock"), eRemoteStatType.DAMAGE_SYSTEM) ); } void SerializeNames(array<string> names, eRemoteDebugType type) { for(int i = 0; i < m_Stats.Count(); i++) { if( type == eRemoteDebugType.ALL ) { names.Insert(m_Stats.Get(i).GetName()); } else if( type == eRemoteDebugType.DAMAGE_ONLY ) { StatDebugObject obj = m_Stats.Get(i); eRemoteStatType debug_type = obj.GetType(); if(debug_type == eRemoteStatType.DAMAGE_SYSTEM) { names.Insert(m_Stats.Get(i).GetName()); } } } } void SerializeValues(array<string> values, eRemoteDebugType type) { for(int i = 0; i < m_Stats.Count(); i++) { if( type == eRemoteDebugType.ALL ) { values.Insert(m_Stats.Get(i).GetValue()); } else if( type == eRemoteDebugType.DAMAGE_ONLY ) { StatDebugObject obj = m_Stats.Get(i); eRemoteStatType debug_type = obj.GetType(); if(debug_type == eRemoteStatType.DAMAGE_SYSTEM) { values.Insert(m_Stats.Get(i).GetValue()); } } } } void Debug() { for(int i = 0; i < m_Stats.Count(); i++) { m_Stats.Get(i).Debug(); } } }