fix(teleport): code reuse / fix lot of unnecessary logic running for tping our own ped. (#2246)

This commit is contained in:
Quentin
2023-10-13 00:10:18 +02:00
committed by GitHub
parent bb4ec59086
commit f9c948f909
3 changed files with 22 additions and 21 deletions

View File

@ -41,7 +41,7 @@ namespace big
ImGui::InputFloat3("##Customlocation", new_location);
ImGui::SameLine();
components::button("Teleport", [] {
teleport::teleport_player_to_coords(g_player_service->get_self(), {new_location[0], new_location[1], new_location[2]});
teleport::to_coords({new_location[0], new_location[1], new_location[2]});
});
ImGui::Spacing();
@ -53,10 +53,10 @@ namespace big
ImGui::BeginGroup();
components::button("Forward", [] {
teleport::teleport_player_to_coords(g_player_service->get_self(), ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0, increment, 0));
teleport::to_coords(ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0, increment, 0));
});
components::button("Backward", [] {
teleport::teleport_player_to_coords(g_player_service->get_self(), ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0, -increment, 0));
teleport::to_coords(ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0, -increment, 0));
});
ImGui::EndGroup();
@ -64,10 +64,10 @@ namespace big
ImGui::BeginGroup();
components::button("Left", [] {
teleport::teleport_player_to_coords(g_player_service->get_self(), ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, -increment, 0, 0));
teleport::to_coords(ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, -increment, 0, 0));
});
components::button("Right", [] {
teleport::teleport_player_to_coords(g_player_service->get_self(), ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, increment, 0, 0));
teleport::to_coords(ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, increment, 0, 0));
});
ImGui::EndGroup();
@ -75,10 +75,10 @@ namespace big
ImGui::BeginGroup();
components::button("Up", [] {
teleport::teleport_player_to_coords(g_player_service->get_self(), ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0, 0, increment));
teleport::to_coords(ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0, 0, increment));
});
components::button("Down", [] {
teleport::teleport_player_to_coords(g_player_service->get_self(), ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0, 0, -increment));
teleport::to_coords(ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0, 0, -increment));
});
ImGui::EndGroup();
@ -130,10 +130,7 @@ namespace big
if (components::button("TP_TO_IPL"_T.data()))
{
PED::SET_PED_COORDS_KEEP_VEHICLE(self::ped,
selected_ipl.location.x,
selected_ipl.location.y,
selected_ipl.location.z);
teleport::to_coords(selected_ipl.location);
}
ImGui::Spacing();