feat(Vehicle): Added vehicle dirt control (#1714)

This commit is contained in:
Sixhei Tartari 2023-07-15 22:58:09 +02:00 committed by GitHub
parent 973121076e
commit 6e69b73550
4 changed files with 58 additions and 5 deletions

View File

@ -0,0 +1,21 @@
#include "backend/looped_command.hpp"
#include "natives.hpp"
namespace big
{
class keep_vehicle_clean : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
if (ENTITY::DOES_ENTITY_EXIST(self::veh))
{
VEHICLE::SET_VEHICLE_DIRT_LEVEL(self::veh, 0.0f);
}
}
};
keep_vehicle_clean
g_keep_vehicle_clean("keepvehicleclean", "Keep Vehicle Clean", "Keeps the vehicle clean", g.vehicle.keep_vehicle_clean);
}

View File

@ -680,6 +680,7 @@ namespace big
bool disable_engine_auto_start = false;
bool change_engine_state_immediately = false;
bool keep_engine_running = false;
bool keep_vehicle_clean = false;
bool vehinvisibility = false;
bool localveh_visibility = false;
bool localped_visibility = true;
@ -688,7 +689,7 @@ namespace big
bool unlimited_weapons = false;
bool siren_mute = false;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(vehicle, speedo_meter, fly, rainbow_paint, speed_unit, god_mode, proof_bullet, proof_fire, proof_collision, proof_melee, proof_explosion, proof_steam, proof_water, proof_mask, auto_drive_destination, auto_drive_style, auto_drive_speed, auto_turn_signals, boost_behavior, drive_on_water, horn_boost, instant_brake, block_homing, seatbelt, turn_signals, vehicle_jump, keep_vehicle_repaired, no_water_collision, disable_engine_auto_start, change_engine_state_immediately, keep_engine_running, vehinvisibility, localveh_visibility, localped_visibility, keep_on_ground, no_collision, unlimited_weapons, siren_mute)
NLOHMANN_DEFINE_TYPE_INTRUSIVE(vehicle, speedo_meter, fly, rainbow_paint, speed_unit, god_mode, proof_bullet, proof_fire, proof_collision, proof_melee, proof_explosion, proof_steam, proof_water, proof_mask, auto_drive_destination, auto_drive_style, auto_drive_speed, auto_turn_signals, boost_behavior, drive_on_water, horn_boost, instant_brake, block_homing, seatbelt, turn_signals, vehicle_jump, keep_vehicle_repaired, no_water_collision, disable_engine_auto_start, change_engine_state_immediately, keep_engine_running, keep_vehicle_clean, vehinvisibility, localveh_visibility, localped_visibility, keep_on_ground, no_collision, unlimited_weapons, siren_mute)
} vehicle{};
struct weapons

View File

@ -14,7 +14,6 @@ namespace big
{
void view::fun_vehicle()
{
ImGui::SeparatorText("SEAT_CHANGER"_T.data());
{
static std::map<int, bool> seats;
@ -134,6 +133,34 @@ namespace big
if (components::button("EMERGENCY_STOP"_T))
g.vehicle.auto_drive_destination = AutoDriveDestination::EMERGENCY_STOP;
}
ImGui::SeparatorText("DIRT_LEVEL"_T.data());
{
if (!ENTITY::DOES_ENTITY_EXIST(self::veh))
{
ImGui::Text("PLEASE_ENTER_VEHICLE"_T.data());
return;
}
if (g.vehicle.keep_vehicle_clean)
{
ImGui::Text("KEEP_VEHICLE_CLEAN"_T.data());
return;
}
if (g.vehicle.keep_vehicle_repaired)
{
ImGui::Text("KEEP_VEHICLE_REPAIRED"_T.data());
return;
}
float dirt_level = VEHICLE::GET_VEHICLE_DIRT_LEVEL(self::veh);
if (ImGui::SliderFloat("DIRT_LEVEL"_T.data(), &dirt_level, 0.f, 15.f, "%.1f"))
{
VEHICLE::SET_VEHICLE_DIRT_LEVEL(self::veh, dirt_level);
}
}
ImGui::SeparatorText("RAINBOW_PAINT"_T.data());
{
components::command_checkbox<"rainbowpri">("PRIMARY"_T);
@ -175,7 +202,10 @@ namespace big
}
ImGui::Separator();
const char* boost_behaviors[] = {"DEFAULT"_T.data(), "INSTANT_REFILL"_T.data(), "INFINITE"_T.data(), "HOLD_FOR_BOOST"_T.data()};
const char* boost_behaviors[] = {"DEFAULT"_T.data(),
"INSTANT_REFILL"_T.data(),
"INFINITE"_T.data(),
"HOLD_FOR_BOOST"_T.data()};
if (ImGui::BeginCombo("BOOST_BEHAVIOR"_T.data(), boost_behaviors[static_cast<int>(g.vehicle.boost_behavior)]))
{
for (int i = 0; i < 4; i++)

View File

@ -17,9 +17,9 @@ namespace big
});
ImGui::SameLine();
components::button("Delete Current",[]{
components::button("Delete Current", [] {
auto handle = self::veh;
if(ENTITY::DOES_ENTITY_EXIST(handle))
if (ENTITY::DOES_ENTITY_EXIST(handle))
TASK::CLEAR_PED_TASKS_IMMEDIATELY(self::ped), entity::delete_entity(handle);
});
@ -86,6 +86,7 @@ namespace big
components::command_checkbox<"blockhoming">();
components::command_checkbox<"driveonwater">();
components::command_checkbox<"vehiclecontrol">();
components::command_checkbox<"keepvehicleclean">();
ImGui::EndGroup();