fix: Health decuction while in god mode (#2398)

Closes #2164
Closes #2397
Closes #2399
This commit is contained in:
gir489 2023-11-09 04:34:00 -05:00 committed by GitHub
parent 5c782c941b
commit 700a20d903
5 changed files with 16 additions and 29 deletions

View File

@ -1,25 +0,0 @@
#include "backend/looped_command.hpp"
#include "fiber_pool.hpp"
#include "gta_util.hpp"
#include "script.hpp"
#include "services/tunables/tunables_service.hpp"
namespace big
{
class ground_snow : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
g_tunables_service->set_tunable<bool>(RAGE_JOAAT("TURN_SNOW_ON_OFF"), true);
}
virtual void on_disable() override
{
g_tunables_service->set_tunable<bool>(RAGE_JOAAT("TURN_SNOW_ON_OFF"), false);
}
};
ground_snow g_ground_snow("groundsnow", "BACKEND_LOOPED_WORLD_GROUND_SNOW", "BACKEND_LOOPED_WORLD_GROUND_SNOW_DESC", g.world.ground_snow);
}

View File

@ -146,7 +146,7 @@ namespace big
void SET_ENTITY_HEALTH(rage::scrNativeCallContext* src)
{
Entity entity = src->get_arg<int>(0);
Entity entity = src->get_arg<Entity>(0);
int health = src->get_arg<int>(1);
int p2 = src->get_arg<int>(2);
@ -156,6 +156,19 @@ namespace big
ENTITY::SET_ENTITY_HEALTH(entity, health, p2);
}
void APPLY_DAMAGE_TO_PED(rage::scrNativeCallContext* src)
{
Ped ped = src->get_arg<Ped>(0);
int damage = src->get_arg<int>(1);
BOOL damage_armor_first = src->get_arg<BOOL>(2);
Any p3 = src->get_arg<Any>(3);
if (g.self.god_mode && ped == self::ped)
return;
PED::APPLY_DAMAGE_TO_PED(ped, damage, damage_armor_first, p3);
}
void RETURN_TRUE(rage::scrNativeCallContext* src)
{
src->set_return_value<BOOL>(TRUE);

View File

@ -115,6 +115,7 @@ namespace big
add_native_detour(0x158C16F5E4CF41F8, all_scripts::RETURN_TRUE); // bypass casino country restrictions
add_native_detour(0xE679E3E06E363892, all_scripts::NETWORK_OVERRIDE_CLOCK_TIME);
add_native_detour(0x6B76DC1F3AE6E6A3, all_scripts::SET_ENTITY_HEALTH);
add_native_detour(0x697157CED63F18D4, all_scripts::APPLY_DAMAGE_TO_PED);
add_native_detour(0x40EB1EFD921822BC, all_scripts::DO_NOTHING); // SECURITY::REGISTER_SCRIPT_VARIABLE
add_native_detour(0x340A36A700E99699, all_scripts::DO_NOTHING); // SECURITY::UNREGISTER_SCRIPT_VARIABLE
add_native_detour(0x8E580AB902917360, all_scripts::DO_NOTHING); // SECURITY::FORCE_CHECK_SCRIPT_VARIABLES

View File

@ -40,7 +40,5 @@ namespace big
}
components::command_checkbox<"blackout">();
components::command_checkbox<"groundsnow">();
}
}

View File

@ -46,7 +46,7 @@ namespace big
if (!PED::IS_PED_A_PLAYER(ped))
{
auto relation = PED::GET_RELATIONSHIP_BETWEEN_PEDS(ped, self::ped);
if (relation == 4 || relation == 5)
if (relation == 4 || relation == 5 || relation == 3)
ped::kill_ped(ped);
}
}