From b1e14677386f74bcfbe21966b94eb97556c17acb Mon Sep 17 00:00:00 2001 From: DayibBaba <79384354+DayibBaba@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:18:45 +0200 Subject: [PATCH] Partial revert of changes to Superherofly (#3389) --- src/backend/looped/self/super_hero_fly.cpp | 34 +++++++++++++++------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/backend/looped/self/super_hero_fly.cpp b/src/backend/looped/self/super_hero_fly.cpp index 5ae2ed57..a9bb419e 100644 --- a/src/backend/looped/self/super_hero_fly.cpp +++ b/src/backend/looped/self/super_hero_fly.cpp @@ -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 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::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); }