Skip to content

Commit

Permalink
Carrying - Revert to not broadcast attaching/detaching of helper (#56)
Browse files Browse the repository at this point in the history
Do not broadcast adding/removing helper compartment as child
  • Loading branch information
Kexanone authored Apr 17, 2024
1 parent 40e6bd2 commit 1d6f124
Showing 1 changed file with 3 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@ class ACE_Carrying_HelperCompartment : GenericEntity
m_pCarrier = carrier;
m_pCarried = carried;

RplComponent carrierRpl = RplComponent.Cast(carrier.FindComponent(RplComponent));
if (!carrierRpl)
return;

RpcDo_AttachToCarrier(carrierRpl.Id());
Rpc(RpcDo_AttachToCarrier, carrierRpl.Id());

carrier.AddChild(this, carrier.GetAnimation().GetBoneIndex("Spine5"));

PlayerManager playerManager = GetGame().GetPlayerManager();
SCR_PlayerController carrierPlayerController = SCR_PlayerController.Cast(playerManager.GetPlayerController(playerManager.GetPlayerIdFromControlledEntity(carrier)));

Expand Down Expand Up @@ -63,38 +58,6 @@ class ACE_Carrying_HelperCompartment : GenericEntity

compartmentAccess.MoveInVehicle(this, ECompartmentType.Cargo);
}

//------------------------------------------------------------------------------------------------
//! Broadcast attaching of helper to carrier
[RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
void RpcDo_AttachToCarrier(RplId carrierId)
{
RplComponent carrierRpl = RplComponent.Cast(Replication.FindItem(carrierId));
if (!carrierRpl)
return;

IEntity carrier = carrierRpl.GetEntity();
if (!carrier)
return;

carrier.AddChild(this, carrier.GetAnimation().GetBoneIndex("Spine5"));
}

//------------------------------------------------------------------------------------------------
//! Broadcast detaching of helper from carrier
[RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
void RpcDo_DetachFromCarrier(RplId carrierId)
{
RplComponent carrierRpl = RplComponent.Cast(Replication.FindItem(carrierId));
if (!carrierRpl)
return;

IEntity carrier = carrierRpl.GetEntity();
if (!carrier)
return;

carrier.RemoveChild(this);
}

//------------------------------------------------------------------------------------------------
//! Called on carrier's machine
Expand Down Expand Up @@ -147,12 +110,7 @@ class ACE_Carrying_HelperCompartment : GenericEntity
{
if (m_pCarrier)
{
RplComponent carrierRpl = RplComponent.Cast(m_pCarrier.FindComponent(RplComponent));
if (carrierRpl)
{
RpcDo_DetachFromCarrier(carrierRpl.Id());
Rpc(RpcDo_DetachFromCarrier, carrierRpl.Id());
}
m_pCarrier.RemoveChild(this, true);

SCR_CharacterControllerComponent carrierController = SCR_CharacterControllerComponent.Cast(m_pCarrier.FindComponent(SCR_CharacterControllerComponent));
if (!carrierController)
Expand Down

0 comments on commit 1d6f124

Please sign in to comment.