feat(CustomWeapons): Added repair gun

This commit is contained in:
Yimura 2021-05-20 18:19:01 +02:00
parent 371432ea4e
commit f6ee0687fa
5 changed files with 51 additions and 2 deletions

View File

@ -22,6 +22,7 @@ namespace big
QUEUE_JOB_BEGIN_CLAUSE()
{
looped::weapons_gravity_gun();
looped::weapons_repair_gun();
}QUEUE_JOB_END_CLAUSE
QUEUE_JOB_BEGIN_CLAUSE()

View File

@ -9,6 +9,8 @@ namespace big
static void self_noclip();
static void weapons_gravity_gun();
static void weapons_repair_gun();
static void vehicle_speedo_meter();
};
}

View File

@ -0,0 +1,44 @@
#include "backend/looped/looped.hpp"
#include "core/enums.hpp"
#include "util/entity.hpp"
#include "util/notify.hpp"
namespace big
{
static const int controls[] = { 14, 15, 24 };
void looped::weapons_repair_gun()
{
bool bRepairGun = g.weapons.custom_weapon == CustomWeapon::REPAIR_GUN;
if (bRepairGun)
{
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 25))
{
PLAYER::DISABLE_PLAYER_FIRING(PLAYER::PLAYER_ID(), true);
for (int control : controls)
PAD::DISABLE_CONTROL_ACTION(0, control, true);
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, 24))
{
Entity entity;
if (entity::raycast(&entity))
{
if (ENTITY::IS_ENTITY_A_VEHICLE(entity))
{
VEHICLE::SET_VEHICLE_FIXED(entity);
VEHICLE::SET_VEHICLE_DEFORMATION_FIXED(entity);
VEHICLE::SET_VEHICLE_DIRT_LEVEL(entity, 0.f);
}
else
{
notify::above_map("Entity is not a vehicle.");
}
}
else notify::above_map("No entity found.");
}
}
}
}
}

View File

@ -8,5 +8,6 @@ struct custom_weapon {
const custom_weapon custom_weapons[] = {
{ big::CustomWeapon::NONE, "No weapon" },
{ big::CustomWeapon::GRAVITY_GUN, "Gravity Gun" }
{ big::CustomWeapon::GRAVITY_GUN, "Gravity Gun" },
{ big::CustomWeapon::REPAIR_GUN, "Repair Gun" }
};

View File

@ -5,7 +5,8 @@ namespace big
enum class CustomWeapon
{
NONE,
GRAVITY_GUN
GRAVITY_GUN,
REPAIR_GUN
};
enum class SpeedoMeter