DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ OnFinishProgressServer()

override void ActionRepairMotorbikePart::OnFinishProgressServer ( ActionData action_data)
inlineprivate

См. определение в файле ActionRepairMotorbikePart.c строка 65

66 {
67 Object tgObject = action_data.m_Target.GetObject();
68
69 string damageZone = RepairMotorbikePartActionData.Cast(action_data).m_DamageZone;
70 if (!g_Game.IsMultiplayer())
71 damageZone = m_CurrentDamageZone;
72
73 if (tgObject)
74 {
75 MotorbikePart motorbikePart = MotorbikePart.Cast(tgObject);
76 if (motorbikePart)
77 {
78 int newDmgLevel = Math.Clamp(motorbikePart.GetHealthLevel(damageZone) - 1, GameConstants.STATE_WORN, GameConstants.STATE_RUINED);
79 float zoneMax = motorbikePart.GetMaxHealth("", "");
80 float randomValue = Math.RandomFloatInclusive(zoneMax * 0.05, zoneMax * 0.15);
81
82 switch (newDmgLevel)
83 {
84 case GameConstants.STATE_BADLY_DAMAGED:
85 motorbikePart.SetHealth("", "", (zoneMax * GameConstants.DAMAGE_RUINED_VALUE) + randomValue);
86 break;
87
88 case GameConstants.STATE_DAMAGED:
89 motorbikePart.SetHealth("", "", (zoneMax * GameConstants.DAMAGE_BADLY_DAMAGED_VALUE) + randomValue);
90 break;
91
92 case GameConstants.STATE_WORN:
93 motorbikePart.SetHealth("", "", (zoneMax * GameConstants.DAMAGE_DAMAGED_VALUE) + randomValue);
94 break;
95
96 default:
97 break;
98 }
99
100 if (action_data.m_MainItem.HasQuantity())
101 {
102 if (action_data.m_MainItem.GetQuantity() > 1)
103 {
104 int qnt = action_data.m_MainItem.GetQuantity();
105 qnt -= action_data.m_MainItem.GetQuantityMax() * 0.25;
106 action_data.m_MainItem.SetQuantity(qnt);
107 }
108 else
109 action_data.m_MainItem.Delete();
110 }
111 }
112 }
113 }
DayZGame g_Game
Определения DayZGame.c:4074
ref ActionTarget m_Target
Определения ActionBase.c:39
ItemBase m_MainItem
Определения ActionBase.c:35
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfBricks.c:64
class LOD Object

Перекрестные ссылки Math::Clamp(), GameConstants::DAMAGE_BADLY_DAMAGED_VALUE, GameConstants::DAMAGE_DAMAGED_VALUE, GameConstants::DAMAGE_RUINED_VALUE, g_Game, ActionRepairVehiclePartBase::m_CurrentDamageZone, ActionData::m_MainItem, ActionData::m_Target, Math::RandomFloatInclusive(), ItemBase::SetQuantity(), GameConstants::STATE_BADLY_DAMAGED, GameConstants::STATE_DAMAGED, GameConstants::STATE_RUINED и GameConstants::STATE_WORN.