DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionWashHeadWettingClothesBase.c
См. документацию.
2{
4 private static ref map<int, float> s_WetnessSurface;
5
6 private map<int, float> GetWetnessMap(bool fromContainer)
7 {
8 if (fromContainer)
9 {
11 {
13 s_WetnessContainer.Insert(InventorySlots.HEADGEAR, 0.24);
14 s_WetnessContainer.Insert(InventorySlots.MASK, 0.24);
15 s_WetnessContainer.Insert(InventorySlots.BODY, 0.12);
16 s_WetnessContainer.Insert(InventorySlots.VEST, 0.08);
17 s_WetnessContainer.Insert(InventorySlots.GLOVES, 0.04);
18 s_WetnessContainer.Insert(InventorySlots.LEGS, 0.06);
19 s_WetnessContainer.Insert(InventorySlots.FEET, 0.04);
20 s_WetnessContainer.Insert(InventorySlots.ARMBAND, 0.06);
21 s_WetnessContainer.Insert(InventorySlots.HIPS, 0.06);
22 s_WetnessContainer.Insert(InventorySlots.BACK, 0.04);
23 }
24 return s_WetnessContainer;
25 }
26 else
27 {
29 {
31 s_WetnessSurface.Insert(InventorySlots.HEADGEAR, 0.12);
32 s_WetnessSurface.Insert(InventorySlots.MASK, 0.24);
33 s_WetnessSurface.Insert(InventorySlots.BODY, 0.12);
34 s_WetnessSurface.Insert(InventorySlots.VEST, 0.08);
35 s_WetnessSurface.Insert(InventorySlots.GLOVES, 0.24);
36 s_WetnessSurface.Insert(InventorySlots.LEGS, 0.06);
37 s_WetnessSurface.Insert(InventorySlots.FEET, 0.04);
38 s_WetnessSurface.Insert(InventorySlots.ARMBAND, 0.06);
39 s_WetnessSurface.Insert(InventorySlots.HIPS, 0.06);
40 s_WetnessSurface.Insert(InventorySlots.BACK, 0.04);
41 }
42 return s_WetnessSurface;
43 }
44 }
45
46 protected float GetEyeIrritationReduction() { return 10.0; }
47 protected bool IsFromContainer() { return false; }
48
49 override void OnFinishProgressServer(ActionData action_data)
50 {
51 super.OnFinishProgressServer(action_data);
52
53 action_data.m_Player.m_AgentPool.ReduceAgent(eAgents.EYES_IRRITATION, GetEyeIrritationReduction());
54 action_data.m_Player.GetThermalBiasHandler().Add(-PlayerConstants.THERMAL_BIAS_WASH_HEAD_DECREMENT);
55 action_data.m_Player.GetThermalBiasHandler().SetTemporaryResistance(PlayerConstants.THERMAL_BIAS_WASH_HEAD_TEMPORARY_RESISTANCE_TIME);
57 }
58
59 override void OnEndServer(ActionData action_data)
60 {
61 float progress = action_data.m_ActionComponent.GetProgress();
62 if (progress > 0)
63 {
64 action_data.m_Player.m_AgentPool.ReduceAgent(eAgents.EYES_IRRITATION, GetEyeIrritationReduction() * progress);
65 action_data.m_Player.GetThermalBiasHandler().Add(-PlayerConstants.THERMAL_BIAS_WASH_HEAD_DECREMENT * progress);
66 ApplyWetnessToClothes(action_data.m_Player, IsFromContainer(), progress);
67 }
68
69 super.OnEndServer(action_data);
70 }
71
72 void ApplyWetnessToClothes(PlayerBase player, bool fromContainer, float scale)
73 {
74 if (!player)
75 return;
76
77 map<int, float> wetnessBySlot = GetWetnessMap(fromContainer);
78
79 foreach (int slotId, float wetnessValue : wetnessBySlot)
80 {
81 float add = wetnessValue * scale;
82
83 ItemBase clothing = ItemBase.Cast(player.GetInventory().FindAttachment(slotId));
84 if (!clothing)
85 continue;
86
87 clothing.SetWet(Math.Clamp(clothing.GetWet() + add, 0.0, 1.0));
88 }
89 }
90}
eAgents
Определения EAgents.c:3
void ActionContinuousBase()
Определения ActionContinuousBase.c:124
PlayerBase m_Player
Определения ActionBase.c:40
ref CABase m_ActionComponent
Определения ActionBase.c:37
Определения ActionBase.c:22
void ApplyWetnessToClothes(PlayerBase player, bool fromContainer, float scale)
override void OnEndServer(ActionData action_data)
override void OnFinishProgressServer(ActionData action_data)
static ref map< int, float > s_WetnessSurface
static ref map< int, float > s_WetnessContainer
map< int, float > GetWetnessMap(bool fromContainer)
float GetProgress()
Определения CABase.c:62
provides access to slot configuration
Определения InventorySlots.c:6
Определения EnMath.c:7
Определения PlayerBaseClient.c:2
static const float THERMAL_BIAS_WASH_HEAD_TEMPORARY_RESISTANCE_TIME
Определения PlayerConstants.c:204
static const float THERMAL_BIAS_WASH_HEAD_DECREMENT
Определения PlayerConstants.c:203
Определения PlayerConstants.c:2
Определения Transport.c:70
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.