Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2308,6 +2308,25 @@ bool CStaticFunctionDefinitions::SetPedDoingGangDriveby(CClientEntity& Entity, b
return false;
}

bool CStaticFunctionDefinitions::SetPedFightingStyle(CClientEntity& Entity, unsigned char ucStyle)
{
RUN_CHILDREN(SetPedFightingStyle(**iter, ucStyle))
if (IS_PED(&Entity) && Entity.IsLocalEntity())
{
CClientPed& Ped = static_cast<CClientPed&>(Entity);
if (Ped.GetFightingStyle() != ucStyle)
{
// Is valid style
if (ucStyle >= 4 && ucStyle <= 16)
{
Ped.SetFightingStyle(static_cast<eFightingStyle>(ucStyle));
return true;
}
}
}
return false;
}

bool CStaticFunctionDefinitions::SetPedLookAt(CClientEntity& Entity, CVector& vecPosition, int iTime, int iBlend, CClientEntity* pTarget)
{
RUN_CHILDREN(SetPedLookAt(**iter, vecPosition, iTime, iBlend, pTarget))
Expand Down
1 change: 1 addition & 0 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class CStaticFunctionDefinitions
static bool SetPedControlState(CClientEntity& Entity, const char* szControl, bool bState);
static bool SetPedAnalogControlState(CClientEntity& Entity, const char* szControl, float fState);
static bool SetPedDoingGangDriveby(CClientEntity& Entity, bool bGangDriveby);
static bool SetPedFightingStyle(CClientEntity& Entity, unsigned char ucStyle);
static bool SetPedLookAt(CClientEntity& Entity, CVector& vecPosition, int iTime, int iBlend, CClientEntity* pTarget);
static bool SetPedHeadless(CClientEntity& Entity, bool bHeadless);
static bool SetPedFrozen(CClientEntity& Entity, bool bFrozen);
Expand Down
19 changes: 18 additions & 1 deletion Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ void CLuaPedDefs::LoadFunctions()
{"setPedControlState", SetPedControlState},
{"setPedAnalogControlState", SetPedAnalogControlState},
{"setPedDoingGangDriveby", SetPedDoingGangDriveby},
{"setPedFightingStyle", SetPedFightingStyle},
{"setPedLookAt", SetPedLookAt},
{"setPedHeadless", SetPedHeadless},
{"setPedFrozen", SetPedFrozen},
Expand Down Expand Up @@ -168,6 +169,7 @@ void CLuaPedDefs::AddClass(lua_State* luaVM)
lua_classfunction(luaVM, "setOxygenLevel", "setPedOxygenLevel");
lua_classfunction(luaVM, "setWeaponSlot", "setPedWeaponSlot");
lua_classfunction(luaVM, "setDoingGangDriveby", "setPedDoingGangDriveby");
lua_classfunction(luaVM, "setFightingStyle", "setPedFightingStyle");
lua_classfunction(luaVM, "setHeadless", "setPedHeadless");
lua_classfunction(luaVM, "setOnFire", "setPedOnFire");
lua_classfunction(luaVM, "setTargetingMarkerEnabled", "setPedTargetingMarkerEnabled");
Expand All @@ -186,7 +188,7 @@ void CLuaPedDefs::AddClass(lua_State* luaVM)
lua_classvariable(luaVM, "hasJetPack", NULL, "doesPedHaveJetPack");
lua_classvariable(luaVM, "jetpack", NULL, "isPedWearingJetpack"); // introduced in 1.5.5-9.13846
lua_classvariable(luaVM, "armor", NULL, "getPedArmor");
lua_classvariable(luaVM, "fightingStyle", NULL, "getPedFightingStyle");
lua_classvariable(luaVM, "fightingStyle", "setPedFightingStyle", "getPedFightingStyle");
lua_classvariable(luaVM, "cameraRotation", "setPedCameraRotation", "getPedCameraRotation");
lua_classvariable(luaVM, "contactElement", NULL, "getPedContactElement");
lua_classvariable(luaVM, "moveState", NULL, "getPedMoveState");
Expand Down Expand Up @@ -1700,6 +1702,21 @@ int CLuaPedDefs::SetPedDoingGangDriveby(lua_State* luaVM)
return 1;
}

int CLuaPedDefs::SetPedFightingStyle(lua_State* luaVM)
{
CClientEntity* pEntity;
unsigned char ucStyle;
CScriptArgReader argStream(luaVM);
argStream.ReadUserData(pEntity);
argStream.ReadNumber(ucStyle);

if (argStream.HasErrors())
return luaL_error(luaVM, argStream.GetFullErrorMessage());

lua_pushboolean(luaVM, CStaticFunctionDefinitions::SetPedFightingStyle(*pEntity, ucStyle));
return 1;
}

int CLuaPedDefs::SetPedLookAt(lua_State* luaVM)
{
// Verify the argument
Expand Down
1 change: 1 addition & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class CLuaPedDefs : public CLuaDefs
LUA_DECLARE(SetPedControlState);
LUA_DECLARE(SetPedAnalogControlState);
LUA_DECLARE(SetPedDoingGangDriveby);
LUA_DECLARE(SetPedFightingStyle);
LUA_DECLARE(SetPedLookAt);
LUA_DECLARE(SetPedHeadless);
LUA_DECLARE(SetPedFrozen);
Expand Down