Partial revert of changes to Superherofly (#3389)

This commit is contained in:
DayibBaba 2024-07-22 10:18:45 +02:00 committed by GitHub
parent b42af940f6
commit b1e1467738
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,6 @@
#include "backend/looped_command.hpp"
#include "backend/bool_command.hpp"
#include "backend/float_command.hpp"
#include "backend/looped_command.hpp"
#include "gta/enums.hpp"
#include "natives.hpp"
#include "util/entity.hpp"
@ -22,7 +22,7 @@ namespace big
bool m_timer = false;
std::chrono::system_clock::time_point m_time_stamp;
std::chrono::milliseconds m_duration;
std::chrono::duration<double> m_duration;
bool m_charging = false;
double m_charge_intensity = 1;
@ -239,6 +239,14 @@ namespace big
virtual void on_tick() override
{
if (PED::IS_PED_IN_ANY_VEHICLE(self::ped, false))
{
if (m_flying || m_charging || m_landing || m_launching)
reset();
return;
}
//Both anims are required in order to consider the player ped flying.
m_anims_are_playing = ENTITY::IS_ENTITY_PLAYING_ANIM(self::ped, "missfam5_yoga", "c8_to_start", 3) && ENTITY::IS_ENTITY_PLAYING_ANIM(self::ped, "skydive@parachute@first_person", "chute_idle_alt_lookright", 3);
@ -249,7 +257,7 @@ namespace big
PAD::DISABLE_CONTROL_ACTION(0, (int)ControllerInputs::INPUT_COVER, false);
if (m_timer)
m_duration = std::chrono::duration_cast<std::chrono::milliseconds> (std::chrono::system_clock::now() - m_time_stamp);
m_duration = std::chrono::system_clock::now() - m_time_stamp;
//Timer is used for both the reset and the charged launch
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_COVER))
@ -289,7 +297,7 @@ namespace big
}
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_COVER) && !m_flying
&& g.self.super_hero_fly.charge)
&& g.self.super_hero_fly.charge && !PED::IS_PED_IN_ANY_VEHICLE(self::ped, false))
{
charge_launch();
}
@ -401,11 +409,17 @@ namespace big
};
super_hero_fly g_super_hero_fly("superherofly", "SUPER_HERO_FLY", "SUPER_HERO_FLY_DESC", g.self.super_hero_fly.enabled);
bool_command gradual_speed("superheroflygradualspeed", "SUPER_HERO_FLY_GRADUAL_SPEED", "SUPER_HERO_FLY_GRADUAL_SPEED_DESC", g.self.super_hero_fly.gradual);
bool_command explosions("superheroflyexplosions", "SUPER_HERO_FLY_EXPLOSIONS", "SUPER_HERO_FLY_EXPLOSIONS_DESC", g.self.super_hero_fly.explosions);
bool_command auto_land("superheroflyautoland", "SUPER_HERO_FLY_AUTO_LAND", "SUPER_HERO_FLY_AUTO_LAND_DESC", g.self.super_hero_fly.auto_land);
bool_command charge_launch("superheroflychargelaunch", "SUPER_HERO_FLY_CHARGE_LAUNCH", "SUPER_HERO_FLY_CHARGE_LAUNCH_DESC", g.self.super_hero_fly.charge);
bool_command charge_ptfx("superheroflychargeptfx", "SUPER_HERO_FLY_CHARGE_PTFX", "SUPER_HERO_FLY_CHARGE_PTFX_DESC", g.self.super_hero_fly.ptfx);
bool_command gradual_speed("superheroflygradualspeed", "SUPER_HERO_FLY_GRADUAL_SPEED", "SUPER_HERO_FLY_GRADUAL_SPEED_DESC",
g.self.super_hero_fly.gradual);
bool_command explosions("superheroflyexplosions", "SUPER_HERO_FLY_EXPLOSIONS", "SUPER_HERO_FLY_EXPLOSIONS_DESC",
g.self.super_hero_fly.explosions);
bool_command auto_land("superheroflyautoland", "SUPER_HERO_FLY_AUTO_LAND", "SUPER_HERO_FLY_AUTO_LAND_DESC",
g.self.super_hero_fly.auto_land);
bool_command charge_launch("superheroflychargelaunch", "SUPER_HERO_FLY_CHARGE_LAUNCH", "SUPER_HERO_FLY_CHARGE_LAUNCH_DESC",
g.self.super_hero_fly.charge);
bool_command charge_ptfx("superheroflychargeptfx", "SUPER_HERO_FLY_CHARGE_PTFX", "SUPER_HERO_FLY_CHARGE_PTFX_DESC",
g.self.super_hero_fly.ptfx);
float_command speed("superheroflyspeed", "SUPER_HERO_FLY_SPEED", "SUPER_HERO_FLY_SPEED_DESC", g.self.super_hero_fly.fly_speed, 1.f, 50.f);
float_command initial_launch("superheroflyinitiallaunch", "SUPER_HERO_FLY_INITIAL_LAUNCH", "SUPER_HERO_FLY_INITIAL_LAUNCH_DESC", g.self.super_hero_fly.initial_launch, 1.f, 50.f);
float_command initial_launch("superheroflyinitiallaunch", "SUPER_HERO_FLY_INITIAL_LAUNCH", "SUPER_HERO_FLY_INITIAL_LAUNCH_DESC",
g.self.super_hero_fly.initial_launch, 1.f, 50.f);
}