Skip to content

Commit 198f522

Browse files
Synchronize changes from 1.6 master branch [ci skip]
e4a502b add killPedTask function (#3808)
2 parents 63c2e44 + e4a502b commit 198f522

File tree

5 files changed

+35
-0
lines changed

5 files changed

+35
-0
lines changed

Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,12 @@ ADD_ENUM(PreloadAreaOption::COLLISIONS, "collisions")
910910
ADD_ENUM(PreloadAreaOption::ALL, "all")
911911
IMPLEMENT_ENUM_CLASS_END("preload-area-option")
912912

913+
914+
IMPLEMENT_ENUM_CLASS_BEGIN(taskType)
915+
ADD_ENUM(taskType::PRIMARY_TASK, "primary")
916+
ADD_ENUM(taskType::SECONDARY_TASK, "secondary")
917+
IMPLEMENT_ENUM_CLASS_END("tasks-types")
918+
913919
IMPLEMENT_ENUM_BEGIN(eEntityType)
914920
ADD_ENUM(ENTITY_TYPE_NOTHING, "unknown")
915921
ADD_ENUM(ENTITY_TYPE_BUILDING, "building")

Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ DECLARE_ENUM(ePools);
8888
DECLARE_ENUM(eWorldProperty);
8989
DECLARE_ENUM_CLASS(eModelLoadState);
9090
DECLARE_ENUM_CLASS(PreloadAreaOption);
91+
DECLARE_ENUM_CLASS(taskType);
9192
DECLARE_ENUM(eEntityType);
9293

94+
9395
class CRemoteCall;
9496

9597
enum eDXHorizontalAlign

Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ void CLuaPedDefs::LoadFunctions()
115115
{"isPedDucked", IsPedDucked},
116116
{"isPedDead", IsPedDead},
117117
{"isPedReloadingWeapon", IsPedReloadingWeapon},
118+
{"killPedTask", ArgumentParser<killPedTask>},
118119
};
119120

120121
// Add functions
@@ -2493,3 +2494,20 @@ bool CLuaPedDefs::SetPedExitVehicle(CClientPed* pPed)
24932494
{
24942495
return pPed->ExitVehicle();
24952496
}
2497+
2498+
bool CLuaPedDefs::killPedTask(CClientPed* ped, taskType taskType, std::uint8_t taskNumber, std::optional<bool> gracefully) noexcept
2499+
{
2500+
switch (taskType)
2501+
{
2502+
case taskType::PRIMARY_TASK:
2503+
{
2504+
return ped->KillTask(taskNumber, gracefully.value_or(true));
2505+
}
2506+
case taskType::SECONDARY_TASK:
2507+
{
2508+
return ped->KillTaskSecondary(taskNumber, gracefully.value_or(true));
2509+
}
2510+
default:
2511+
return false;
2512+
}
2513+
}

Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,6 @@ class CLuaPedDefs : public CLuaDefs
115115
static bool SetPedExitVehicle(CClientPed* pPed);
116116
static bool IsPedBleeding(CClientPed* ped);
117117
static bool SetPedBleeding(CClientPed* ped, bool bleeding);
118+
119+
static bool killPedTask(CClientPed* ped, taskType taskType, std::uint8_t taskNumber, std::optional<bool> gracefully) noexcept;
118120
};

Client/sdk/game/CTaskManager.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ enum
4141
ABORT_PRIORITY_IMMEDIATE
4242
};
4343

44+
enum taskType
45+
{
46+
PRIMARY_TASK = 0,
47+
SECONDARY_TASK
48+
};
49+
50+
4451
class CTaskManager
4552
{
4653
public:

0 commit comments

Comments
 (0)