6 class SCR_MotorExhaustEffectGeneralComponent : MotorExhaustEffectComponent
38 [
Attribute(
"{AEA751F0BE7FE821}Particles/Vehicle/Vehicle_smoke_car_exhaust_damage.ptc", UIWidgets.ResourceNamePicker,
desc:
"Particle effect for damaged engine",
params:
"ptc")]
41 [
Attribute(
"1", UIWidgets.Auto,
desc:
"Time to play damaged exhaust particle after startup")]
47 if (System.IsConsoleApp())
54 m_SignalsManager = SignalsManagerComponent.Cast(owner.FindComponent(SignalsManagerComponent));
68 super.OnDelete(owner);
75 protected static int GetStageIndex(
string emitterName)
77 static const string EMITTER_STAGE_PREFIX =
"s";
78 static const string EMITTER_STAGE_SUFIX =
"_";
80 int offset = EMITTER_STAGE_PREFIX.Length();
81 if (!emitterName.StartsWith(EMITTER_STAGE_PREFIX) || !emitterName.IsDigitAt(offset))
85 int stageNo = emitterName.ToInt(offset: offset, parsed: numberLen);
87 if (!emitterName.ContainsAt(EMITTER_STAGE_SUFIX, offset))
98 protected static array<ref array<int>> CreateStageIndexes(notnull ParticleEffectEntity effectEntity)
100 Particles particles = effectEntity.GetParticles();
104 array<ref array<int>> ret = {{}};
106 array<string> emitterNames = {};
107 int emitterNamesCount = particles.GetEmitterNames(emitterNames);
109 for (
int i; i < emitterNamesCount; i++)
111 int stage = GetStageIndex(emitterNames[i]);
115 if (stage >= ret.Count())
116 ret.Resize(stage + 1);
121 ret[stage].Insert(i);
162 CameraBase camera =
GetGame().GetCameraManager().CurrentCamera();
255 ParticleEffectEntitySpawnParams spawnParams();
260 spawnParams.PivotID = effectPosition.GetNodeId();
261 effectPosition.GetLocalTransform(spawnParams.Transform);
264 spawnParams.UseFrameEvent =
true;
271 protected void AdjustEngineEffects(notnull ParticleEffectEntity effectEntity, array<ref array<int>> stageIndexes)
273 Particles particles = effectEntity.GetParticles();
277 if (stageIndexes && !stageIndexes.IsEmpty())
280 particles.SetParam(-1, EmitterParam.BIRTH_RATE, 0);
281 particles.SetParam(-1, EmitterParam.BIRTH_RATE_RND, 0);
284 int iMaxStage = stageIndexes.Count();
285 int stage = Math.ClampInt(Math.Ceil(iMaxStage *
m_fEngineLoad), 1, iMaxStage) - 1;
286 array<int> stageEmitterIDs = stageIndexes[stage];
289 for (
int i; i < stageEmitterIDs.Count(); i++)
291 particles.MultParam(stageEmitterIDs[i], EmitterParam.BIRTH_RATE,
m_fRPMScaled* 0.5 + 0.5);
292 particles.MultParam(stageEmitterIDs[i], EmitterParam.BIRTH_RATE_RND,
m_fRPMScaled* 0.5 + 0.5);
293 particles.MultParam(stageEmitterIDs[i], EmitterParam.VELOCITY, (
m_fRPMScaled* 3));
294 particles.MultParam(stageEmitterIDs[i], EmitterParam.VELOCITY_RND, (
m_fRPMScaled* 3));
295 particles.MultParam(stageEmitterIDs[i], EmitterParam.AIR_RESISTANCE,
m_fRPMScaled);
296 particles.MultParam(stageEmitterIDs[i], EmitterParam.AIR_RESISTANCE_RND,
m_fRPMScaled);
302 particles.MultParam(-1, EmitterParam.BIRTH_RATE,
m_fRPMScaled* 1);
303 particles.MultParam(-1, EmitterParam.BIRTH_RATE_RND,
m_fRPMScaled* 1);
306 particles.MultParam(-1, EmitterParam.VELOCITY, (
m_fRPMScaled* 7));
307 particles.MultParam(-1, EmitterParam.VELOCITY_RND, (
m_fRPMScaled* 7));
308 particles.MultParam(-1, EmitterParam.AIR_RESISTANCE,
m_fRPMScaled);
309 particles.MultParam(-1, EmitterParam.AIR_RESISTANCE_RND,
m_fRPMScaled);
344 World world =
GetOwner().GetWorld();
349 updateSystem.Register(
this);
355 World world =
GetOwner().GetWorld();
360 updateSystem.Unregister(
this);