18 SetVisibleDuringDaylight(
false);
21 SetFlareVisible(
false);
22 SetAmbientColor(1.0, 1.0, 0.3);
23 SetDiffuseColor(1.0, 1.0, 0.3);
25 SetDisableShadowsWithinRadius(-1);
26 SetCastShadow(
false );
33 protected ref
Timer m_StartupTimer;
34 protected ref
Timer m_FXTimer;
37 protected vector m_OffsetPos;
41 const int AIRBORNE_EXPLOSION_DELAY = 20;
42 const int AREA_SETUP_DELAY = 10;
43 const float AIRBORNE_FX_OFFSET = 50;
44 const float ARTILLERY_SHELL_SPEED = 100;
47 const float DECAY_START_PART_SIZE = 32;
48 const int DECAY_START_PART_BIRTH_RATE = 1;
49 const float DECAY_END_PART_SIZE = 17;
50 const int DECAY_END_PART_BIRTH_RATE = 1;
51 const float START_DECAY_LIFETIME = 900;
52 const float FINISH_DECAY_LIFETIME = 300;
55 const ref
array<string> SPAWN_ITEM_TYPE = {
"Grenade_ChemGas"};
56 const ref
array<int> SPAWN_ITEM_COUNT = {
Math.RandomIntInclusive(2,5)};
63 RegisterNetSyncVariableInt(
"m_DecayState");
66 override void EEOnCECreate()
70 m_PPERequesterIdx = GetRequesterIndex(m_PPERequesterType);
78 m_OffsetPos = areaPos;
79 m_OffsetPos[1] = m_OffsetPos[1] + AIRBORNE_FX_OFFSET;
83 vector closestPoint = areaPos;
87 for (
int i = 0; i < artilleryPoints.Count(); i++ )
89 temp =
vector.DistanceSq( artilleryPoints.Get( i ), areaPos );
90 if ( temp < dist || dist == 0 )
97 closestPoint = artilleryPoints.Get( index );
100 float delay =
vector.Distance( closestPoint, areaPos );
101 delay = delay / ARTILLERY_SHELL_SPEED;
102 delay += AIRBORNE_EXPLOSION_DELAY;
112 params.Insert( pos );
113 GetGame().RPC(
null,
ERPCs.RPC_SOUND_ARTILLERY_SINGLE, params,
true );
116 m_FXTimer.Run( delay,
this,
"PlayFX" );
118 delay += AREA_SETUP_DELAY;
121 m_StartupTimer.Run( delay,
this,
"InitZone" );
125 float GetRemainingTime()
127 return GetLifetime();
130 float GetStartDecayLifetime()
132 return START_DECAY_LIFETIME;
135 float GetFinishDecayLifetime()
137 return FINISH_DECAY_LIFETIME;
142 if ( GetRemainingTime() < GetFinishDecayLifetime() )
147 else if ( GetRemainingTime() < GetStartDecayLifetime() )
156 void SetDecayState(
int newState )
158 if (m_DecayState != newState)
160 m_DecayState = newState;
170 override void EEInit()
173 if ( !m_ToxicClouds )
177 m_Name =
"Default Dynamic";
179 m_PositiveHeight = 7;
180 m_NegativeHeight = 10;
184 m_OuterRingOffset = 0;
186 m_TriggerType =
"ContaminatedTrigger_Dynamic";
201 m_OffsetPos[1] = m_OffsetPos[1] + AIRBORNE_FX_OFFSET;
216 override void InitZone()
224 override void InitZoneServer()
226 super.InitZoneServer();
230 if ( m_TriggerType !=
"" )
237 foreach (
int j,
string type:SPAWN_ITEM_TYPE)
240 for (
int i = 0; i < SPAWN_ITEM_COUNT[j]; i++)
243 float randomDist =
Math.RandomFloatInclusive(SPAWN_ITEM_RAD_MIN[j],SPAWN_ITEM_RAD_MAX[j]);
247 Math3D.MatrixIdentity4(mat);
249 il.SetGround(NULL, mat);
256 override void InitZoneClient()
258 super.InitZoneClient();
260 if ( !m_ToxicClouds )
264 PlaceParticles( GetWorldPosition(),
m_Radius, m_InnerRings, m_InnerSpacing, m_OuterRingToggle, m_OuterSpacing, m_OuterRingOffset, m_ParticleID );
269 super.OnParticleAllocation(pm, particles);
277 p.SetParameter( 0,
EmitorParam.BIRTH_RATE, DECAY_END_PART_BIRTH_RATE );
278 p.SetParameter( 0,
EmitorParam.SIZE, DECAY_END_PART_SIZE );
282 p.SetParameter( 0,
EmitorParam.BIRTH_RATE, DECAY_START_PART_BIRTH_RATE );
283 p.SetParameter( 0,
EmitorParam.SIZE, DECAY_START_PART_SIZE );
289 override void CreateTrigger(
vector pos,
int radius )
291 super.CreateTrigger( pos, radius );
297 dynaTrigger.SetLocalEffects( m_AroundParticleID, m_TinyParticleID, m_PPERequesterIdx );
298 dynaTrigger.SetAreaState( m_DecayState );
310 pos =
new Param1<vector>(
vector.Zero );
314 pos.param1 = m_OffsetPos;
315 params.Insert( pos );
316 GetGame().RPC(
null,
ERPCs.RPC_SOUND_CONTAMINATION, params,
true );
324 void PlayExplosionLight()
341 override void EEDelete(
EntityAI parent )
343 super.EEDelete( parent );
346 override void OnVariablesSynchronized()
348 super.OnVariablesSynchronized();
350 if ( !m_ToxicClouds )
353 switch ( m_DecayState )
356 PlayExplosionLight();
366 foreach (
Particle p : m_ToxicClouds )
368 p.SetParameter( 0,
EmitorParam.BIRTH_RATE, DECAY_START_PART_BIRTH_RATE );
369 p.SetParameter( 0,
EmitorParam.SIZE, DECAY_START_PART_SIZE );
378 foreach (
Particle prt : m_ToxicClouds )
380 prt.SetParameter( 0,
EmitorParam.BIRTH_RATE, DECAY_END_PART_BIRTH_RATE );
381 prt.SetParameter( 0,
EmitorParam.SIZE, DECAY_END_PART_SIZE );