79 RegisterNetSyncVariableFloat(
"m_Radius", 0, 0, 2);
80 RegisterNetSyncVariableFloat(
"m_PositiveHeight", 0, 0, 2);
81 RegisterNetSyncVariableFloat(
"m_NegativeHeight", 0, 0, 2);
83 RegisterNetSyncVariableInt(
"m_InnerRings");
84 RegisterNetSyncVariableInt(
"m_InnerSpacing");
85 RegisterNetSyncVariableInt(
"m_OuterRingOffset");
86 RegisterNetSyncVariableInt(
"m_OuterSpacing");
87 RegisterNetSyncVariableInt(
"m_VerticalLayers");
88 RegisterNetSyncVariableInt(
"m_VerticalOffset");
90 RegisterNetSyncVariableInt(
"m_ParticleID");
96 RegisterNetSyncVariableBool(
"m_OuterRingToggle");
107 if ( params.m_ParamName !=
"" )
108 m_Name = params.m_ParamName;
109 if ( params.m_ParamTriggerType !=
"" )
112 if ( params.m_ParamRadius > 0 )
114 if ( params.m_ParamPosHeight > -1 )
116 if ( params.m_ParamNegHeight > -1 )
120 if ( params.m_ParamInnerSpace > -1 )
124 if ( params.m_ParamOuterSpace > -1 )
128 if ( params.m_ParamVertLayers > 0 )
130 if ( params.m_ParamVerticalOffset > 0 )
137 if ( params.m_ParamPpeRequesterType !=
"" )
173 if ( !
GetGame().IsDedicatedServer() )
220 void PlaceParticles(
vector pos,
float radius,
int nbRings,
int innerSpacing,
bool outerToggle,
int outerSpacing,
int outerOffset,
int partId )
227 Error(
"[WARNING] :: [EffectArea PlaceParticles] :: no particle defined, skipping area particle generation" );
231 bool snapFirstLayer =
true;
233 snapFirstLayer =
false;
240 Error(
"[WARNING] :: [EffectArea PlaceParticles] :: Radius of contaminated zone is set to 0, this should not happen");
244 if ( outerToggle && radius == outerOffset )
246 Error(
"[WARNING] :: [EffectArea PlaceParticles] :: Your outerOffset is EQUAL to your Radius, this will result in division by 0");
251 if ( innerSpacing == 0 )
257 int numberOfEmitters = 1;
264 ParticlePropertiesArray props =
new ParticlePropertiesArray();
278 props.Insert(ParticleProperties(partPos, ParticlePropertiesFlags.PLAY_ON_CREATION, null,
vector.
Zero,
this));
282 for (
int i = 1; i <= nbRings + outerToggle; i++ )
287 float angleIncrement;
295 ab = radius - outerOffset;
298 angleIncrement =
Math.
Acos( 1 - ( ( outerSpacing * outerSpacing ) / ( 2 *
Math.
SqrInt(ab) ) ) );
299 temp[2] = temp[2] + ab;
305 ab = ( radius / ( nbRings + 1 ) ) * i;
308 angleIncrement =
Math.
Acos( 1 - ( ( innerSpacing * innerSpacing ) / ( 2 *
Math.
SqrInt(ab) ) ) );
309 temp[2] = temp[2] + ab;
314 for (
int j = 0; j <= (
Math.
PI2 / angleIncrement ); j++ )
320 float sinAngle =
Math.
Sin( angle );
321 float cosAngle =
Math.
Cos( angle );
327 if ( k == 0 && snapFirstLayer ==
true )
329 else if ( k == 0 && snapFirstLayer ==
false )
336 props.Insert(ParticleProperties(partPos, ParticlePropertiesFlags.PLAY_ON_CREATION, null,
GetGame().GetSurfaceOrientation( partPos[0], partPos[2] ),
this));
342 angle += angleIncrement;
354 if (createdParticles.Count() != partCounter)
356 if (gPM.IsFinishedAllocating())
358 ErrorEx(
string.Format(
"Not enough particles in pool for EffectArea: %1",
m_Name));
378 if (p.GetOwner() ==
this)
385 typename t = type.
ToType();
441 super.EEDelete( parent );
int m_ParamVerticalOffset
string m_ParamTriggerType
string m_ParamPpeRequesterType
enum eZoneType m_ParamName
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
proto native void ObjectDelete(Object obj)
proto native float SurfaceY(float x, float z)
Super root of all classes in Enforce script.
Trigger with cylinder shape.
override bool DisableVicinityIcon()
override void OnCEUpdate()
void PlaceParticles(vector pos, float radius, int nbRings, int innerSpacing, bool outerToggle, int outerSpacing, int outerOffset, int partId)
override bool CanBeTargetedByAI(EntityAI ai)
override bool CanPutInCargo(EntityAI parent)
ref array< Particle > m_ToxicClouds
void CreateTrigger(vector pos, int radius)
override void EEDelete(EntityAI parent)
void SetupZoneData(EffectAreaParams params)
void OnParticleAllocation(ParticleManager pm, array< ParticleSource > particles)
string m_PPERequesterType
override bool CanPutIntoHands(EntityAI parent)
CylinderTrigger m_Trigger
int GetRequesterIndex(string type)
void SetLocalEffects(int aroundPartId, int tinyPartId, int ppeRequesterIdx)
int GetRequesterIDX()
Returns requester index.
Legacy way of using particles in the game.
static const int CONTAMINATED_AREA_GAS_TINY
static const int CONTAMINATED_AREA_GAS_AROUND
static const int CONTAMINATED_AREA_GAS_BIGASS
Entity which has the particle instance as an ObjectComponent.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static vector RotateAroundZero(vector pos, vector axis, float cosAngle, float sinAngle)
Rotate a vector around 0,0,0.
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Acos(float c)
Returns angle in radians from cosinus.
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static proto int SqrInt(int i)
Returns squared value.
static proto float Sin(float angle)
Returns sinus of angle in radians.
proto native ToType()
Returns internal type representation. Can be used in runtime, or cached in variables and used for fas...