Merge pull request #3157 from aws-lumberyard-dev/GitIssue3155_MultiplayerComponentsUsingNetInputRequirePlayerInputComponent

Multiplayer Auto-Components Using NetworkInput Now Require MultiplayerInputDriver Service
This commit is contained in:
kberg-amzn
2021-09-01 12:49:40 -07:00
committed by GitHub
3 changed files with 12 additions and 0 deletions
@@ -21,6 +21,7 @@ namespace Multiplayer
AZ_MULTIPLAYER_COMPONENT(Multiplayer::LocalPredictionPlayerInputComponent, s_localPredictionPlayerInputComponentConcreteUuid, Multiplayer::LocalPredictionPlayerInputComponentBase);
static void Reflect([[maybe_unused]] AZ::ReflectContext* context);
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
void OnInit() override;
void OnActivate([[maybe_unused]] Multiplayer::EntityIsMigrating entityIsMigrating) override;
@@ -1476,6 +1476,11 @@ namespace {{ Component.attrib['Namespace'] }}
{% call(ComponentService) ParseComponentServiceNames(Component, ClassType, 'Required') %}
required.push_back(AZ_CRC_CE("{{ ComponentService }}"));
{% endcall %}
{% if NetworkInputCount > 0 %}
// This component uses NetworkInputs so it requires a MultiplayerInputDriver service which is responsible for calling CreateInput and ProcessInput
required.push_back(AZ_CRC_CE("MultiplayerInputDriver"));
{% endif %}
}
void {{ ComponentBaseName }}::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
@@ -81,6 +81,12 @@ namespace Multiplayer
LocalPredictionPlayerInputComponentBase::Reflect(context);
}
void LocalPredictionPlayerInputComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
LocalPredictionPlayerInputComponentBase::GetProvidedServices(provided);
provided.push_back(AZ_CRC_CE("MultiplayerInputDriver"));
}
void LocalPredictionPlayerInputComponent::OnInit()
{
;