[NvCloth] Replace legacy IsDedicated() call with new AZ_CVAR sv_isDedicated

This commit is contained in:
Aaron Ruiz Mora
2021-05-14 19:10:58 +01:00
committed by GitHub
parent 8b8a582f02
commit 883786796d
4 changed files with 37 additions and 83 deletions
@@ -10,9 +10,8 @@
*
*/
#include <ISystem.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Console/Console.h>
#include <Components/ClothComponent.h>
@@ -55,10 +54,14 @@ namespace NvCloth
void ClothComponent::Activate()
{
// Cloth components do not run on dedicated servers.
AZ_Assert(gEnv, "Environment not ready");
if (gEnv->IsDedicated())
if (auto* console = AZ::Interface<AZ::IConsole>::Get())
{
return;
bool isDedicated = false;
if (const auto result = console->GetCvarValue("sv_isDedicated", isDedicated);
result == AZ::GetValueResult::Success && isDedicated)
{
return;
}
}
AZ::Render::MeshComponentNotificationBus::Handler::BusConnect(GetEntityId());