DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
SandstormExposure.c
См. документацию.
1class SandstormZoneSmall_TESTONLY : ContaminatedArea_Static
2{
3 override void OnPlayerEnterServer(PlayerBase player, EffectTrigger trigger)
4 {
5 player.GetModifiersManager().ActivateModifier(eModifiers.MDF_SANDSTORM_EXPOSURE_STATIC);
6 }
7
8 override void OnPlayerExitServer(PlayerBase player, EffectTrigger trigger)
9 {
10 player.GetModifiersManager().DeactivateModifier(eModifiers.MDF_SANDSTORM_EXPOSURE_STATIC);
11 }
12}
13
14class SandstormExposureMdfrBase : ModifierBase
15{
16 protected const float SILICOSIS_AGENTS_PER_SEC = 1.0;
17 protected const float EYES_IRRITATION_AGENTS_PER_SEC = 1.0;
18
19 private ref PluginTransmissionAgents m_AgentTransmision;
21
22 override void Init()
23 {
28
29 m_AgentTransmision = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
30 }
31
32 override void OnActivate(PlayerBase player)
33 {
34 m_SquintSymptom = player.GetSymptomManager().QueueUpSecondarySymptomEx(SymptomIDs.SYMPTOM_SQUINT);
35
36 TransmitAgents(eAgents.SILICOSIS, player, 1);
37 TransmitAgents(eAgents.EYES_IRRITATION, player, 1);
38 }
39
40 override void OnDeactivate(PlayerBase player)
41 {
42 player.GetSymptomManager().RemoveSecondarySymptom(SymptomIDs.SYMPTOM_SQUINT);
43 }
44
45 protected float TransmitAgents(int type, PlayerBase player, float count)
46 {
47 if (player.IsUnconscious())
48 return 0.0;
49
50 return m_AgentTransmision.TransmitAgentsEx(null, player, AGT_AIRBOURNE_SOLID, count, type);
51 }
52}
53
54class SandstormExposureStaticMdfr : SandstormExposureMdfrBase
55{
56 override void Init()
57 {
58 super.Init();
59
60 m_ID = eModifiers.MDF_SANDSTORM_EXPOSURE_STATIC;
61
64 }
65
66 override bool ActivateCondition(PlayerBase player)
67 {
68 return false;
69 }
70
71 override bool DeactivateCondition(PlayerBase player)
72 {
73 return false;
74 }
75
76 override void OnTick(PlayerBase player, float deltaT)
77 {
80 }
81}
82
83class SandstormExposureDynamicMdfr : SandstormExposureMdfrBase
84{
85 private const float COUGH_INTERVAL_MIN = 3.0;
86 private const float COUGH_INTERVAL_MAX = 25.0;
87
89
90 protected float m_CoughTimer;
91
92 override void Init()
93 {
94 super.Init();
95
96 m_ID = eModifiers.MDF_SANDSTORM_EXPOSURE_DYNAMIC;
97
98 m_SandstormController = ScriptedSandstormController.Cast(g_Game.GetWeather().GetSandstorm());
99 }
100
101 override bool ActivateCondition(PlayerBase player)
102 {
103 return (player && m_SandstormController.IsActive() && m_SandstormController.GetIntensityForPlayer(player) > 0.0);
104 }
105
106 override bool DeactivateCondition(PlayerBase player)
107 {
108 return (player && m_SandstormController.IsActive() && m_SandstormController.GetIntensityForPlayer(player) <= 0.0);
109 }
110
111 override void OnTick(PlayerBase player, float deltaT)
112 {
113 if (!m_SandstormController.IsActive())
114 return;
115
116 float sandstormIntensity = m_SandstormController.GetIntensityForPlayer(player);
117
118 HandleCoughing(player, sandstormIntensity, deltaT);
119
120 TransmitAgents(eAgents.SILICOSIS, player, sandstormIntensity * SILICOSIS_AGENTS_PER_SEC * deltaT);
121 TransmitAgents(eAgents.EYES_IRRITATION, player, sandstormIntensity * EYES_IRRITATION_AGENTS_PER_SEC * deltaT);
122 }
123
124 protected void HandleCoughing(PlayerBase player, float sandstormIntensity, float deltaTime)
125 {
128 query.m_Placement = ECachedEquipmentPlacement.ATTACHMENT;
129 query.m_MaximumDepth = 2;
130
131 float protectionLevel = 0.0;
132 ItemBase coverItem = null;
133 array<Entity> coverItems = player.GetCachedEquipment().GetEntitiesByCategory(query);
134 int coverItemsCount = coverItems.Count();
135 for (int i = 0; i < coverItemsCount; ++i)
136 {
137 coverItem = ItemBase.Cast(coverItems[i]);
138 protectionLevel = coverItem.GetProtectionLevel(DEF_DUST_PARTICLE_BREATH);
139 if (protectionLevel > 0.0)
140 break;
141 }
142
143 float coughIntensity = Math.Clamp(sandstormIntensity - protectionLevel, 0.0, 1.0);;
144 float coughInterval = Math.Lerp(COUGH_INTERVAL_MAX, COUGH_INTERVAL_MIN, coughIntensity);
145
146 if (coughIntensity > 0.0)
147 m_CoughTimer += deltaTime;
148 else
149 m_CoughTimer = 0.0;
150
151 if (m_CoughTimer >= coughInterval)
152 {
153 m_CoughTimer = 0.0;
154
155 Math.Randomize(Math.RandomInt(1, 1000));
156 float rand = Math.RandomFloat01();
157 if (rand <= coughIntensity)
158 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH);
159 }
160 }
161}
void OnDeactivate()
Определения BunkerBroadcastComponent.c:239
DayZGame g_Game
Определения DayZGame.c:4074
override Widget Init()
Определения DayZGame.c:127
int m_ID
Определения DustKickupEffects.c:26
eAgents
Определения EAgents.c:3
ECachedEquipmentItemCategory
Определения ECachedEquipmentItemCategory.c:2
ECachedEquipmentPlacement
Определения ECachedEquipmentPlacement.c:2
DayZPlayer m_Player
Определения Hand_Events.c:42
bool m_TrackActivatedTime
overall time this modifier was active
Определения ModifierBase.c:14
void DisableDeactivateCheck()
Определения ModifierBase.c:86
bool ActivateCondition(PlayerBase player)
Определения ModifierBase.c:176
void DisableActivateCheck()
Определения ModifierBase.c:81
bool DeactivateCondition(PlayerBase player)
Определения ModifierBase.c:181
void OnTick(PlayerBase player, float deltaT)
Определения HeatStroke.c:186
bool m_AnalyticsStatsEnabled
Определения ModifierBase.c:31
float m_TickIntervalActive
Определения ModifierBase.c:18
float m_TickIntervalInactive
Определения ModifierBase.c:17
const int DEFAULT_TICK_TIME_INACTIVE
Определения ModifiersManager.c:29
const int DEFAULT_TICK_TIME_ACTIVE_SHORT
Определения ModifiersManager.c:28
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:326
ScriptedSandstormController m_SandstormController
seconds
Определения SandstormExposure.c:88
ref SymptomBase m_SquintSymptom
Определения SandstormExposure.c:20
ref PluginTransmissionAgents m_AgentTransmision
Определения SandstormExposure.c:19
const float COUGH_INTERVAL_MAX
seconds
Определения SandstormExposure.c:86
float TransmitAgents(int type, PlayerBase player, float count)
Определения SandstormExposure.c:45
float m_CoughTimer
Определения SandstormExposure.c:90
const float EYES_IRRITATION_AGENTS_PER_SEC
Определения SandstormExposure.c:17
void HandleCoughing(PlayerBase player, float sandstormIntensity, float deltaTime)
Определения SandstormExposure.c:124
SandstormZoneSmall_TESTONLY SILICOSIS_AGENTS_PER_SEC
SandstormExposureStaticMdfr COUGH_INTERVAL_MIN
void OnActivate()
Определения Trap_LandMine.c:67
ECachedEquipmentItemCategory m_Category
Определения CachedEquipmentStorageBase.c:5
ECachedEquipmentPlacement m_Placement
Определения CachedEquipmentStorageBase.c:6
Определения EnMath.c:7
Определения BreathVapourMdfr.c:4
Определения PlayerBaseClient.c:2
override bool DeactivateCondition(PlayerBase player)
Определения SandstormExposure.c:71
override bool ActivateCondition(PlayerBase player)
Определения SandstormExposure.c:66
override void OnTick(PlayerBase player, float deltaT)
Определения SandstormExposure.c:76
override void Init()
Определения SandstormExposure.c:56
override void OnPlayerEnterServer(PlayerBase player, EffectTrigger trigger)
Определения SandstormExposure.c:3
override void OnPlayerExitServer(PlayerBase player, EffectTrigger trigger)
Определения SandstormExposure.c:8
Определения StateBase.c:2
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
eModifiers
Определения eModifiers.c:2
const int DEF_DUST_PARTICLE_BREATH
Определения 3_Game/DayZ/constants.c:549
const int AGT_AIRBOURNE_SOLID
Определения 3_Game/DayZ/constants.c:545
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Определения EnMath.c:126
static proto int Randomize(int seed)
Sets the seed for the random number generator.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
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'.
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].