Skip to content

Commit 7db2df4

Browse files
committed
asd
1 parent 8db1225 commit 7db2df4

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

gui/tabs/players_tab.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,14 @@ namespace PlayersTab {
12311231
}
12321232
}
12331233
}
1234+
if ((IsInGame() || IsInLobby()) && ImGui::Button("Vanish Self For")) {
1235+
if (IsInGame()) State.rpcQueue.push(new RpcGoneForTarget(selectedPlayer, false));
1236+
if (IsInLobby()) State.lobbyRpcQueue.push(new RpcGoneForTarget(selectedPlayer, false));
1237+
}
1238+
if ((IsInGame() || IsInLobby()) && ImGui::Button("Vanish Back")) {
1239+
if (IsInGame()) State.rpcQueue.push(new RpcGoneForTarget(selectedPlayer, true));
1240+
if (IsInLobby()) State.lobbyRpcQueue.push(new RpcGoneForTarget(selectedPlayer, true));
1241+
}
12341242
}
12351243
}
12361244
if (openInfo && (IsInMultiplayerGame() || IsInLobby()) && selectedPlayer.has_value()) {

rpc/RpcSnapTo.cpp

+19-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,22 @@ void RpcForceSnapTo::Process()
3434
Player->fields.NetTransform->fields.lastSequenceId += 100;
3535

3636
CustomNetworkTransform_RpcSnapTo((Player)->fields.NetTransform, targetVector, NULL);
37-
}
37+
}
38+
39+
RpcGoneForTarget::RpcGoneForTarget(PlayerSelection target, bool back)
40+
{
41+
this->target = target;
42+
this->back = back;
43+
}
44+
45+
void RpcGoneForTarget::Process()
46+
{
47+
if (!target.validate().has_value()) return;
48+
auto writer = InnerNetClient_StartRpcImmediately((InnerNetClient*)(*Game::pAmongUsClient), (*Game::pLocalPlayer)->fields.NetTransform->fields._.NetId,
49+
uint8_t(RpcCalls__Enum::SnapTo), SendOption__Enum::None, target.validate().get_PlayerControl()->fields._.OwnerId, NULL);
50+
MessageWriter_WriteUShort(writer, back ? 0 : 65535, NULL);
51+
MessageWriter_WriteUShort(writer, back ? 0 : 65535, NULL);
52+
MessageWriter_WriteUShort(writer, (*Game::pLocalPlayer)->fields.NetTransform->fields.lastSequenceId + 100, NULL);
53+
InnerNetClient_FinishRpcImmediately((InnerNetClient*)(*Game::pAmongUsClient), writer, NULL);
54+
(*Game::pLocalPlayer)->fields.NetTransform->fields.lastSequenceId += 100;
55+
}

rpc/_rpc.h

+8
Original file line numberDiff line numberDiff line change
@@ -469,4 +469,12 @@ class RpcBootFromVent : public RPCInterface {
469469
public:
470470
RpcBootFromVent(PlayerControl* Player, int ventId);
471471
virtual void Process() override;
472+
};
473+
474+
class RpcGoneForTarget : public RPCInterface {
475+
PlayerSelection target;
476+
bool back;
477+
public:
478+
RpcGoneForTarget(PlayerSelection target, bool back);
479+
virtual void Process() override;
472480
};

0 commit comments

Comments
 (0)