diff --git a/Runtime/World/CScriptEffect.cpp b/Runtime/World/CScriptEffect.cpp index 80c45fadb..c7b391a37 100644 --- a/Runtime/World/CScriptEffect.cpp +++ b/Runtime/World/CScriptEffect.cpp @@ -76,6 +76,7 @@ CScriptEffect::CScriptEffect(TUniqueId uid, std::string_view name, const CEntity xf4_electric->SetGlobalTranslation(xf.origin); xf4_electric->SetGlobalScale(scale); xf4_electric->SetParticleEmission(active); + xf4_electric->SetModulationColor(lParms.GetNoLightsAmbient()); } xe7_29_drawEnabled = true; } @@ -97,7 +98,6 @@ void CScriptEffect::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt x104_particleSystem->SetOrientation(newXf); x104_particleSystem->SetGlobalTranslation(GetTranslation()); x104_particleSystem->SetGlobalScale(scale); - x104_particleSystem->SetParticleEmission(oldActive); x104_particleSystem->SetModulationColor(color); x104_particleSystem->SetModelsUseLights(x138_actorLights != nullptr); } @@ -111,7 +111,6 @@ void CScriptEffect::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt xf4_electric->SetOrientation(newXf); xf4_electric->SetGlobalTranslation(GetTranslation()); xf4_electric->SetGlobalScale(scale); - xf4_electric->SetParticleEmission(oldActive); xf4_electric->SetModulationColor(color); } } @@ -152,26 +151,28 @@ void CScriptEffect::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt mgr.SendScriptMsg(light, uid, msg); if (oldActive != GetActive()) { - std::vector playIds; - for (const SConnection& conn : x20_conns) { - if (conn.x0_state != EScriptObjectState::Play || conn.x4_msg != EScriptObjectMessage::Activate) - continue; + if (GetActive()) { + std::vector playIds; + for (const SConnection& conn : x20_conns) { + if (conn.x0_state != EScriptObjectState::Play || conn.x4_msg != EScriptObjectMessage::Activate) + continue; - TUniqueId uid = mgr.GetIdForScript(conn.x8_objId); - if (uid != kInvalidUniqueId) - playIds.push_back(uid); - } + TUniqueId connId = mgr.GetIdForScript(conn.x8_objId); + if (connId != kInvalidUniqueId) + playIds.push_back(connId); + } - if (playIds.size() > 0) { - TCastToConstPtr otherAct = - mgr.GetObjectById(playIds[u32(0.99f * playIds.size() * mgr.GetActiveRandom()->Float())]); - if (otherAct) { - if (light) - light->SetTransform(otherAct->GetTransform()); - else + if (!playIds.empty()) { + TCastToConstPtr otherAct = + mgr.GetObjectById(playIds[u32(0.99f * playIds.size() * mgr.GetActiveRandom()->Float())]); + if (otherAct) { SetTransform(otherAct->GetTransform()); + if (light) + light->SetTransform(otherAct->GetTransform()); + } } } + x110_24_enable = true; if (x104_particleSystem) x104_particleSystem->SetParticleEmission(GetActive());