DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
OilPitTrigger.c
См. документацию.
2{
3 protected const string SOUND_BURNING = "oil_pit_burn_SoundSet";
4 protected const float SOUND_AUDIBLE_RANGE = 200.0; // max distance (m) at which the burning sound is audible/active
5 protected const float SOUND_CHECK_RATE = 2.0; // seconds between distance re-checks, to avoid a per-frame distance calc for every pit
6
7 protected const float DAMAGE_TICK_RATE = 1.0; // seconds between fire damage ticks
8 protected const float DAMAGE_MULTIPLIER = 20.0; // damage per tick
9
10 protected bool m_IsBurning;
11 protected bool m_PlayerInRange;
12 protected float m_SoundCheckAccu;
14 protected EOilPitState m_OilPitState = EOilPitState.INACTIVE; // synchronized state
15
19
20 #ifndef SERVER
21 #ifndef NO_GUI
22 protected BonfireLight m_MainLight;
23 #endif
24 #endif
25
27 {
28 RegisterNetSyncVariableInt("m_OilPitState", 0, 1);
29 }
30
31 override void DeferredInit()
32 {
33 super.DeferredInit();
34
36
37 if (!g_Game.IsHeadlessOrDedicatedServer())
39 }
40
41 override string GetDisplayName()
42 {
43 return "#STR_oilpit";
44 }
45
46 override void EEDelete( EntityAI parent )
47 {
49
50 super.EEDelete(parent);
51 }
52
53 override void OnStayStartServerEvent(int nrOfInsiders)
54 {
55 if (!CheckState(EOilPitState.BURNING))
56 return;
57
60 m_DealDamageFlag = true;
61 }
62
63 override void OnStayServerEvent(TriggerInsider insider, float deltaTime)
64 {
66 return;
67
68 EntityAI entity = EntityAI.Cast(insider.GetObject());
69 if (entity)
70 entity.ProcessDirectDamage(DamageType.CUSTOM, this, "", "HeatDamage", "0 0 0", DAMAGE_MULTIPLIER);
71 }
72
74 {
76 {
78 m_DealDamageFlag = false;
79 }
80 }
81
83 {
84 super.OnVariablesSynchronized();
85
86 if (IsInitialized())
88 }
89
90 protected void UpdateState()
91 {
92 if (CheckState(EOilPitState.BURNING) && !m_IsBurning)
93 {
94 #ifndef SERVER
95 #ifndef NO_GUI
96 if (!m_MainLight)
97 {
98 m_MainLight = BonfireLight.Cast(ScriptedLightBase.CreateLight(BonfireLight, GetPosition() + "0 2.5 0", 2.0));
99 m_MainLight.FadeBrightnessTo(m_MainLight.m_Brightness, 0.0);
100 m_MainLight.FadeRadiusTo(m_MainLight.m_FireRadius, 0.0);
101 }
102 #endif
103 #endif
104
105 Math.Randomize(-1);
106 int random = Math.RandomIntInclusive(1, 10);
107 if (random % 2)
108 {
111 }
112 else
113 {
116 }
117
118 UpdateSound();
119
120 m_IsBurning = true;
121 }
122 else if (!CheckState(EOilPitState.BURNING) && m_IsBurning)
123 {
124 StopEffects();
125 }
126 }
127
128 protected vector GetAdjustedPosition(float height = 0)
129 {
130 vector pos = GetPosition();
131 pos[1] = g_Game.SurfaceRoadY(pos[0], pos[2], RoadSurfaceDetection.UNDER) + height;
132
133 return pos;
134 }
135
137 {
138 if (m_IsBurning)
139 {
140 if (m_FireParticle)
141 m_FireParticle.StopParticle();
142
143 if (m_SmokeParticle)
144 m_SmokeParticle.StopParticle();
145
146 if (m_SoundBurning)
147 {
149 m_SoundBurning = null;
150 }
151
152 m_IsBurning = false;
153 }
154
155 #ifndef SERVER
156 #ifndef NO_GUI
157 if (m_MainLight)
158 {
159 m_MainLight.Destroy();
160 m_MainLight = null;
161 }
162 #endif
163 #endif
164 }
165
167 {
168 m_OilPitState |= state;
169 SetSynchDirty();
170 }
171
173 {
174 m_OilPitState &= ~state;
175 SetSynchDirty();
176 }
177
179 {
180 if (state == EOilPitState.INACTIVE)
181 return (m_OilPitState == state);
182 else
183 return (m_OilPitState & state) != 0;
184 }
185
186 override void EOnFrame(IEntity other, float timeSlice)
187 {
188 super.EOnFrame(other, timeSlice);
189
190 if (!g_Game.IsHeadlessOrDedicatedServer())
191 {
192 m_SoundCheckAccu += timeSlice;
194 {
197 }
198 }
199 }
200
201 protected void UpdateSoundRange()
202 {
203 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
204 if (player)
206 else
207 m_PlayerInRange = false;
208
209 UpdateSound();
210 }
211
212 protected void UpdateSound()
213 {
215 {
216 if (!m_SoundBurning)
218 }
219 else if (m_SoundBurning)
220 {
222 m_SoundBurning = null;
223 }
224 }
225
227 {
228 return m_OilPitState;
229 }
230}
override bool IsInitialized()
Определения CombinationLock.c:96
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:4074
EOilPitState
Определения OilPitArea.c:2
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
Wrapper class for managing sound through SEffectManager.
Определения EffectSound.c:5
float m_TimeAccuStay
Определения EffectTrigger.c:9
void EffectTrigger()
Определения EffectTrigger.c:20
float m_DeltaTime
Определения EffectTrigger.c:8
bool m_DealDamageFlag
Определения EffectTrigger.c:10
Определения EnEntity.c:165
Определения EnMath.c:7
const string SOUND_BURNING
Определения OilPitTrigger.c:3
const float SOUND_CHECK_RATE
Определения OilPitTrigger.c:5
bool CheckState(EOilPitState state)
Определения OilPitTrigger.c:178
override void OnVariablesSynchronized()
Определения OilPitTrigger.c:82
void OilPitTrigger()
Определения OilPitTrigger.c:26
override void EOnFrame(IEntity other, float timeSlice)
Определения OilPitTrigger.c:186
override void OnStayFinishServerEvent()
Определения OilPitTrigger.c:73
bool m_PlayerInRange
Определения OilPitTrigger.c:11
override string GetDisplayName()
Определения OilPitTrigger.c:41
const float DAMAGE_TICK_RATE
Определения OilPitTrigger.c:7
override void OnStayServerEvent(TriggerInsider insider, float deltaTime)
Определения OilPitTrigger.c:63
ParticleSource m_SmokeParticle
Определения OilPitTrigger.c:17
EffectSound m_SoundBurning
Определения OilPitTrigger.c:18
void RemoveState(EOilPitState state)
Определения OilPitTrigger.c:172
void AddState(EOilPitState state)
Определения OilPitTrigger.c:166
void UpdateState()
Определения OilPitTrigger.c:90
EOilPitState GetState()
Определения OilPitTrigger.c:226
void UpdateSound()
Определения OilPitTrigger.c:212
const float DAMAGE_MULTIPLIER
Определения OilPitTrigger.c:8
override void OnStayStartServerEvent(int nrOfInsiders)
Определения OilPitTrigger.c:53
void StopEffects()
Определения OilPitTrigger.c:136
override void EEDelete(EntityAI parent)
Определения OilPitTrigger.c:46
EOilPitState m_OilPitState
Определения OilPitTrigger.c:14
const float SOUND_AUDIBLE_RANGE
Определения OilPitTrigger.c:4
BonfireLight m_MainLight
Определения OilPitTrigger.c:22
vector GetAdjustedPosition(float height=0)
Определения OilPitTrigger.c:128
ParticleSource m_FireParticle
Определения OilPitTrigger.c:16
void UpdateSoundRange()
Определения OilPitTrigger.c:201
float m_SoundCheckAccu
Определения OilPitTrigger.c:12
bool m_IsBurning
Определения OilPitTrigger.c:10
override void DeferredInit()
Определения OilPitTrigger.c:31
vector m_DefaultPosition
Определения OilPitTrigger.c:13
static const int OIL_FIRE1
Определения ParticleList.c:411
static const int OIL_FIRE2
Определения ParticleList.c:412
static const int SMOKE_GENERIC_WRECK
Определения ParticleList.c:290
static const int BONFIRE_SMOKE
Определения ParticleList.c:309
Определения ParticleList.c:12
Entity which has the particle instance as an ObjectComponent.
Определения ParticleSource.c:128
Определения PlayerBaseClient.c:2
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
Определения EffectManager.c:178
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
Определения EffectManager.c:280
Manager class for managing Effect (EffectParticle, EffectSound)
Определения EffectManager.c:6
Object GetObject()
Определения Trigger.c:28
The object which is in a trigger and its metadata.
Определения Trigger.c:3
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
Определения EnConvert.c:119
static proto int Randomize(int seed)
Sets the seed for the random number generator.
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Определения EnMath.c:54
vector GetPosition()
Get the world position of the Effect.
Определения Effect.c:473