allow 6x17 for enemies and objects

This commit is contained in:
Martin Michelsen
2025-11-05 23:06:17 -08:00
parent 36eeee5641
commit 7210441878
+8 -9
View File
@@ -3750,11 +3750,8 @@ static asio::awaitable<void> on_set_entity_pos_and_angle_6x17(shared_ptr<Client>
} }
// 6x17 is used to transport players to the other part of the Vol Opt boss // 6x17 is used to transport players to the other part of the Vol Opt boss
// arena, so phase 2 can begin. We only allow 6x17 if the sender is the // arena, so phase 2 can begin. We only allow 6x17 in the Monitor Room (Vol
// leader and both players (sender and receiver) are in the Vol Opt arena. // Opt arena).
if (cmd.header.entity_id >= 0x1000) {
throw runtime_error("client sent 6x17 command affecting a non-player entity");
}
if (l->episode != Episode::EP1) { if (l->episode != Episode::EP1) {
throw runtime_error("client sent 6x17 command in non-Ep1 game"); throw runtime_error("client sent 6x17 command in non-Ep1 game");
} }
@@ -3764,11 +3761,13 @@ static asio::awaitable<void> on_set_entity_pos_and_angle_6x17(shared_ptr<Client>
// If the target is on a different floor or does not exist, just drop the // If the target is on a different floor or does not exist, just drop the
// command instead of raising; this could have been due to a data race // command instead of raising; this could have been due to a data race
auto target = l->clients.at(cmd.header.entity_id); if (cmd.header.entity_id < 0x1000) {
if (!target || target->floor != c->floor) { auto target = l->clients.at(cmd.header.entity_id);
co_return; if (!target || target->floor != c->floor) {
co_return;
}
target->pos = cmd.pos;
} }
target->pos = cmd.pos;
co_await forward_subcommand_with_entity_id_transcode_t<G_SetEntityPositionAndAngle_6x17>(c, msg); co_await forward_subcommand_with_entity_id_transcode_t<G_SetEntityPositionAndAngle_6x17>(c, msg);
} }