feat(Features): Added no ragdoll looped feature

This commit is contained in:
Yimura 2020-12-26 18:24:08 +01:00
parent cefbf16488
commit 2d7db48b53
No known key found for this signature in database
GPG Key ID: 54EFAD29393A6E78
4 changed files with 27 additions and 2 deletions

View File

@ -1,4 +1,3 @@
#include "common.hpp"
#include "features.hpp" #include "features.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "natives.hpp" #include "natives.hpp"
@ -9,6 +8,7 @@ namespace big
void features::run_tick() void features::run_tick()
{ {
god_mode(); god_mode();
no_ragdoll();
} }
void features::script_func() void features::script_func()

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include "common.hpp" #include "common.hpp"
#include "fiber_pool.hpp"
#include "structs/player.hpp" #include "structs/player.hpp"
#include "structs/temp.hpp" #include "structs/temp.hpp"
#include "features/notify.hpp" #include "features/notify.hpp"
@ -23,5 +24,6 @@ namespace big
void script_func(); void script_func();
void god_mode(); void god_mode();
void no_ragdoll();
} }
} }

View File

@ -1,5 +1,4 @@
#include "features.hpp" #include "features.hpp"
#include "fiber_pool.hpp"
namespace big namespace big
{ {

View File

@ -0,0 +1,24 @@
#include "features.hpp"
namespace big
{
static bool bLastNoRagdoll = false;
void features::no_ragdoll()
{
bool bNoRagdoll = g_settings.options["ragdoll"].get<bool>();
if (bNoRagdoll || (!bNoRagdoll && bNoRagdoll != bLastNoRagdoll))
{
QUEUE_JOB_BEGIN_CLAUSE(= )
{
Ped player = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_playerId);
PED::SET_PED_CAN_RAGDOLL(player, !bNoRagdoll);
PED::SET_PED_CAN_RAGDOLL_FROM_PLAYER_IMPACT(player, !bNoRagdoll);
}QUEUE_JOB_END_CLAUSE
bLastNoRagdoll = bNoRagdoll;
}
}
}