Further fixes to Server to Authority RPC generation

Signed-off-by: puvvadar <puvvadar@amazon.com>
This commit is contained in:
puvvadar
2021-08-18 14:31:05 -07:00
parent 716275b8da
commit 32d01f6abd
2 changed files with 7 additions and 5 deletions
@@ -318,7 +318,11 @@ void {{ ClassName }}::{{ UpperFirst(Property.attrib['Name']) }}({{ ', '.join(par
constexpr AzNetworking::ReliabilityType isReliable = Multiplayer::ReliabilityType::Unreliable;
{% endif %}
{% if InvokeFrom == 'Server' and HandleOn == 'Authority' %}
const Multiplayer::NetComponentId netComponentId = GetNetComponentId();
{% else %}
const Multiplayer::NetComponentId netComponentId = GetParent().GetNetComponentId();
{% endif %}
Multiplayer::NetworkEntityRpcMessage rpcMessage(Multiplayer::RpcDeliveryType::{{ InvokeFrom }}To{{ HandleOn }}, GetNetEntityId(), netComponentId, rpcId, isReliable);
{% if paramNames|count > 0 %}
{{ UpperFirst(Component.attrib['Name']) }}Internal::{{ UpperFirst(Property.attrib['Name']) }}RpcStruct rpcStruct({{ ', '.join(paramNames) }});
@@ -1544,8 +1548,8 @@ namespace {{ Component.attrib['Namespace'] }}
{{ DefineNetworkPropertyGets(Component, 'Authority', 'Client', true, ComponentBaseName)|indent(4) }}
{{ DefineNetworkPropertyGets(Component, 'Autonomous', 'Authority', true, ComponentBaseName)|indent(4) }}
{{ DefineArchetypePropertyGets(Component, ClassType, ComponentBaseName)|indent(4) -}}
{{ DefineRpcInvocations(Component, ControllerBaseName, 'Server', 'Authority', false)|indent(4) -}}
{{ DefineRpcInvocations(Component, ControllerBaseName, 'Server', 'Authority', true)|indent(4) }}
{{ DefineRpcInvocations(Component, ComponentBaseName, 'Server', 'Authority', false)|indent(4) -}}
{{ DefineRpcInvocations(Component, ComponentBaseName, 'Server', 'Authority', true)|indent(4) }}
void {{ ComponentBaseName }}::SetOwningConnectionId([[maybe_unused]] AzNetworking::ConnectionId connectionId)
{