2021-05-19 14:35:30 +02:00
|
|
|
#include "backend.hpp"
|
2023-03-01 21:27:15 +00:00
|
|
|
|
2022-06-30 00:11:54 +02:00
|
|
|
#include "looped/looped.hpp"
|
2022-12-22 21:23:32 +00:00
|
|
|
#include "looped_command.hpp"
|
2023-03-01 21:27:15 +00:00
|
|
|
#include "script.hpp"
|
|
|
|
#include "script_patches.hpp"
|
|
|
|
#include "services/context_menu/context_menu_service.hpp"
|
2023-03-30 00:37:10 +02:00
|
|
|
#include "services/orbital_drone/orbital_drone.hpp"
|
2023-03-01 21:27:15 +00:00
|
|
|
#include "thread_pool.hpp"
|
2021-05-19 14:35:30 +02:00
|
|
|
|
2023-03-30 00:37:10 +02:00
|
|
|
|
2021-05-19 14:35:30 +02:00
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
void backend::loop()
|
|
|
|
{
|
2022-12-22 21:23:32 +00:00
|
|
|
for (auto& command : g_looped_commands)
|
|
|
|
command->refresh();
|
|
|
|
|
2022-11-12 18:35:28 +00:00
|
|
|
register_script_patches();
|
|
|
|
|
2023-03-01 21:27:15 +00:00
|
|
|
while (g_running)
|
2022-11-12 18:35:28 +00:00
|
|
|
{
|
2022-07-05 16:54:45 -04:00
|
|
|
looped::system_self_globals();
|
|
|
|
looped::system_update_pointers();
|
2022-09-12 18:44:47 +00:00
|
|
|
looped::system_desync_kick_protection();
|
2022-12-08 12:23:57 +00:00
|
|
|
looped::system_spoofing();
|
2022-12-06 16:12:02 +00:00
|
|
|
looped::system_mission_creator();
|
2021-05-20 18:00:03 +02:00
|
|
|
|
2022-12-22 21:23:32 +00:00
|
|
|
for (auto command : g_looped_commands)
|
|
|
|
if (command->is_enabled())
|
|
|
|
command->on_tick();
|
|
|
|
|
2022-07-05 16:54:45 -04:00
|
|
|
script::get_current()->yield();
|
2021-09-18 22:10:38 +02:00
|
|
|
}
|
2021-05-19 14:35:30 +02:00
|
|
|
}
|
2022-06-27 20:12:45 +02:00
|
|
|
|
|
|
|
void backend::self_loop()
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Starting script: Self";
|
|
|
|
|
|
|
|
while (g_running)
|
|
|
|
{
|
|
|
|
looped::self_police();
|
2022-11-07 13:23:24 -06:00
|
|
|
looped::self_hud();
|
2022-12-06 16:12:02 +00:00
|
|
|
looped::self_dance_mode();
|
2022-06-27 20:12:45 +02:00
|
|
|
|
|
|
|
script::get_current()->yield();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void backend::weapons_loop()
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Starting script: Weapons";
|
|
|
|
|
|
|
|
while (g_running)
|
|
|
|
{
|
|
|
|
looped::weapons_ammo_special_type();
|
|
|
|
looped::weapons_cage_gun();
|
|
|
|
looped::weapons_delete_gun();
|
|
|
|
looped::weapons_gravity_gun();
|
|
|
|
looped::weapons_repair_gun();
|
|
|
|
looped::weapons_steal_vehicle_gun();
|
|
|
|
looped::weapons_vehicle_gun();
|
2023-02-11 05:33:47 +08:00
|
|
|
looped::weapons_c4_limit();
|
2022-06-27 20:12:45 +02:00
|
|
|
|
|
|
|
script::get_current()->yield();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void backend::vehicles_loop()
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Starting script: Vehicles";
|
|
|
|
|
|
|
|
while (g_running)
|
|
|
|
{
|
2022-07-31 00:53:08 +08:00
|
|
|
looped::vehicle_auto_drive();
|
2022-08-09 13:14:02 -04:00
|
|
|
looped::vehicle_boost_behavior();
|
2022-06-27 20:12:45 +02:00
|
|
|
looped::vehicle_god_mode();
|
|
|
|
looped::vehicle_speedo_meter();
|
2023-01-06 23:25:16 +00:00
|
|
|
looped::derail_train();
|
|
|
|
looped::drive_train();
|
2022-06-27 20:12:45 +02:00
|
|
|
|
|
|
|
script::get_current()->yield();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void backend::turnsignal_loop()
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Starting script: turnsignal";
|
|
|
|
|
|
|
|
while (g_running)
|
|
|
|
{
|
|
|
|
looped::vehicle_turn_signals();
|
|
|
|
|
|
|
|
script::get_current()->yield();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void backend::misc_loop()
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Starting script: Miscellaneous";
|
|
|
|
|
|
|
|
while (g_running)
|
|
|
|
{
|
|
|
|
looped::hud_transition_state();
|
|
|
|
looped::session_local_time();
|
2022-12-06 16:12:02 +00:00
|
|
|
looped::session_pop_multiplier_areas();
|
|
|
|
looped::session_force_thunder();
|
|
|
|
looped::session_randomize_ceo_colors();
|
|
|
|
looped::session_auto_kick_host();
|
2023-01-22 21:57:32 +00:00
|
|
|
looped::session_block_jobs();
|
2022-06-27 20:12:45 +02:00
|
|
|
|
|
|
|
script::get_current()->yield();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void backend::remote_loop()
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Starting script: Remote";
|
|
|
|
|
|
|
|
while (g_running)
|
|
|
|
{
|
2022-11-21 15:42:12 +00:00
|
|
|
looped::player_good_options();
|
2023-01-03 16:48:32 +00:00
|
|
|
looped::player_toxic_options();
|
2022-06-27 20:12:45 +02:00
|
|
|
looped::player_spectate();
|
2022-11-21 15:42:12 +00:00
|
|
|
looped::player_remote_control_vehicle();
|
2022-06-27 20:12:45 +02:00
|
|
|
|
|
|
|
script::get_current()->yield();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void backend::lscustoms_loop()
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Starting script: Ls customs";
|
|
|
|
|
|
|
|
while (g_running)
|
|
|
|
{
|
|
|
|
looped::vehicle_ls_customs();
|
|
|
|
|
|
|
|
script::get_current()->yield();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-14 18:19:33 +08:00
|
|
|
void backend::rainbowpaint_loop()
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Starting script: Rainbow paint";
|
|
|
|
|
|
|
|
while (g_running)
|
|
|
|
{
|
|
|
|
looped::vehicle_rainbow_paint();
|
|
|
|
|
|
|
|
script::get_current()->yield();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-27 20:12:45 +02:00
|
|
|
void backend::vehiclefly_loop()
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Starting script: Vehicle fly";
|
|
|
|
|
|
|
|
while (g_running)
|
|
|
|
{
|
|
|
|
looped::vehicle_fly();
|
|
|
|
|
|
|
|
script::get_current()->yield();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void backend::disable_control_action_loop()
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Starting script: Disable Control Action";
|
|
|
|
|
|
|
|
while (g_running)
|
|
|
|
{
|
|
|
|
looped::custom_gun_disable_control_action();
|
|
|
|
context_menu_service::disable_control_action_loop();
|
|
|
|
|
|
|
|
script::get_current()->yield();
|
|
|
|
}
|
|
|
|
}
|
2023-01-22 21:57:32 +00:00
|
|
|
|
|
|
|
void backend::world_loop()
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Starting script: World";
|
|
|
|
|
|
|
|
while (g_running)
|
|
|
|
{
|
|
|
|
looped::world_spawn_ped();
|
|
|
|
script::get_current()->yield();
|
|
|
|
}
|
|
|
|
}
|
2023-03-30 00:37:10 +02:00
|
|
|
|
|
|
|
void backend::orbital_drone()
|
|
|
|
{
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
if (g.world.orbital_drone.enabled && PAD::IS_CONTROL_JUST_PRESSED(2, (int)ControllerInputs::INPUT_VEH_LOOK_BEHIND))
|
|
|
|
{
|
|
|
|
if (!g_orbital_drone_service.initialized())
|
|
|
|
g_orbital_drone_service.init();
|
|
|
|
else
|
|
|
|
g_orbital_drone_service.destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
g_orbital_drone_service.tick();
|
|
|
|
|
|
|
|
script::get_current()->yield();
|
|
|
|
}
|
|
|
|
}
|
2022-05-05 23:51:18 +03:00
|
|
|
}
|