Przeglądaj źródła

Updating NetworkRigidBodyComponent to require NetTransform by calling the base class's GetRequiredServices. Also updated Network AutoComponent ninja so that derived components will automatically suggest calling the base class GetRequiredServices.

Signed-off-by: Gene Walters <[email protected]>
Gene Walters 3 lat temu
rodzic
commit
7488bcb724

+ 24 - 0
Gems/Multiplayer/Code/Include/Multiplayer/AutoGen/AutoComponent_Common.jinja

@@ -316,6 +316,10 @@ namespace {{ Component.attrib['Namespace'] }}
         AZ_MULTIPLAYER_COMPONENT({{ Component.attrib['Namespace'] }}::{{ ComponentName }}, s_{{ LowerFirst(ComponentName) }}ConcreteUuid, {{ Component.attrib['Namespace'] }}::{{ ComponentNameBase }});
         AZ_MULTIPLAYER_COMPONENT({{ Component.attrib['Namespace'] }}::{{ ComponentName }}, s_{{ LowerFirst(ComponentName) }}ConcreteUuid, {{ Component.attrib['Namespace'] }}::{{ ComponentNameBase }});
 
 
         static void Reflect(AZ::ReflectContext* context);
         static void Reflect(AZ::ReflectContext* context);
+        static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
+        static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
+        static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
+        static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
 
 
         void OnInit() override;
         void OnInit() override;
         void OnActivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
         void OnActivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
@@ -393,6 +397,26 @@ namespace {{ Component.attrib['Namespace'] }}
         {{ ComponentNameBase }}::Reflect(context);
         {{ ComponentNameBase }}::Reflect(context);
     }
     }
 
 
+    void {{ ComponentName }}::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
+    {
+        {{ ComponentNameBase }}::GetProvidedServices(provided);
+    }
+
+    void {{ ComponentName }}::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
+    {
+        {{ ComponentNameBase }}::GetRequiredServices(required);
+    }
+
+    void {{ ComponentName }}::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
+    {
+        {{ ComponentNameBase }}::GetDependentServices(dependent);
+    }
+
+    void {{ ComponentName }}::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
+    {
+        {{ ComponentNameBase }}::GetIncompatibleServices(incompatible);
+    }
+
     void {{ ComponentName }}::OnInit()
     void {{ ComponentName }}::OnInit()
     {
     {
     }
     }

+ 1 - 0
Gems/Multiplayer/Code/Include/Multiplayer/Components/NetworkRigidBodyComponent.h

@@ -39,6 +39,7 @@ namespace Multiplayer
         static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
         static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
         static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
         static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
         static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
         static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
+        static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
 
 
         NetworkRigidBodyComponent();
         NetworkRigidBodyComponent();
 
 

+ 9 - 0
Gems/Multiplayer/Code/Source/Components/NetworkRigidBodyComponent.cpp

@@ -28,20 +28,29 @@ namespace Multiplayer
 
 
     void NetworkRigidBodyComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
     void NetworkRigidBodyComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
     {
     {
+        NetworkRigidBodyComponentBase::GetProvidedServices(provided);
         provided.push_back(AZ_CRC_CE("NetworkRigidBodyService"));
         provided.push_back(AZ_CRC_CE("NetworkRigidBodyService"));
     }
     }
 
 
     void NetworkRigidBodyComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
     void NetworkRigidBodyComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
     {
     {
+        NetworkRigidBodyComponentBase::GetRequiredServices(required);
         required.push_back(AZ_CRC_CE("PhysXRigidBodyService"));
         required.push_back(AZ_CRC_CE("PhysXRigidBodyService"));
     }
     }
 
 
     void NetworkRigidBodyComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
     void NetworkRigidBodyComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
     {
     {
+        NetworkRigidBodyComponentBase::GetDependentServices(dependent);
         dependent.push_back(AZ_CRC_CE("TransformService"));
         dependent.push_back(AZ_CRC_CE("TransformService"));
         dependent.push_back(AZ_CRC_CE("PhysXRigidBodyService"));
         dependent.push_back(AZ_CRC_CE("PhysXRigidBodyService"));
     }
     }
 
 
+    void NetworkRigidBodyComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
+    {
+        NetworkRigidBodyComponentBase::GetIncompatibleServices(incompatible);
+    }
+
+
     NetworkRigidBodyComponent::NetworkRigidBodyComponent()
     NetworkRigidBodyComponent::NetworkRigidBodyComponent()
         : m_syncRewindHandler([this](){ OnSyncRewind(); })
         : m_syncRewindHandler([this](){ OnSyncRewind(); })
         , m_transformChangedHandler([this]([[maybe_unused]] const AZ::Transform& localTm, const AZ::Transform& worldTm){ OnTransformUpdate(worldTm); })
         , m_transformChangedHandler([this]([[maybe_unused]] const AZ::Transform& localTm, const AZ::Transform& worldTm){ OnTransformUpdate(worldTm); })