Skip to content

Commit

Permalink
improve rpc stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
g0aty committed Feb 27, 2024
1 parent 4362067 commit e13a547
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions rpc/RpcSetColor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ RpcForceColor::RpcForceColor(PlayerControl* player, uint8_t bodyColor)
void RpcForceColor::Process()
{
if (!PlayerSelection(Player).has_value()) return;

//PlayerControl_RpcSetColor(Player, bodyColor, NULL);

for (auto p : GetAllPlayerControl()) {
auto writer = InnerNetClient_StartRpcImmediately((InnerNetClient*)(*Game::pAmongUsClient), Player->fields._.NetId,
uint8_t(RpcCalls__Enum::SetColor), SendOption__Enum::None, p->fields._.OwnerId, NULL);
MessageWriter_WriteByte(writer, uint8_t(bodyColor), NULL);
InnerNetClient_FinishRpcImmediately((InnerNetClient*)(*Game::pAmongUsClient), writer, NULL);
}

PlayerControl_RpcSetColor(Player, bodyColor, NULL);
}
3 changes: 2 additions & 1 deletion rpc/RpcSnapTo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ void RpcForceSnapTo::Process()
{
if (!PlayerSelection(Player).has_value()) return;

//CustomNetworkTransform_RpcSnapTo((Player)->fields.NetTransform, targetVector, NULL);
CustomNetworkTransform_SnapTo(Player->fields.NetTransform, targetVector, Player->fields.NetTransform->fields.lastSequenceId + 100, NULL);
for (auto p : GetAllPlayerControl()) {
if (p == *Game::pLocalPlayer) continue;
Expand All @@ -33,4 +32,6 @@ void RpcForceSnapTo::Process()
InnerNetClient_FinishRpcImmediately((InnerNetClient*)(*Game::pAmongUsClient), writer, NULL);
}
Player->fields.NetTransform->fields.lastSequenceId += 100;

CustomNetworkTransform_RpcSnapTo((Player)->fields.NetTransform, targetVector, NULL);
}

0 comments on commit e13a547

Please sign in to comment.