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
6 changes: 6 additions & 0 deletions Client/mods/deathmatch/logic/CClientPed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6045,6 +6045,12 @@ bool CClientPed::ReloadWeapon ( void )
}


bool CClientPed::IsReloadingWeapon(void)
{
return GetWeapon()->GetState() == WEAPONSTATE_RELOADING;
}


bool CClientPed::ShouldBeStealthAiming ( void )
{
if ( m_pPlayerPed )
Expand Down
1 change: 1 addition & 0 deletions Client/mods/deathmatch/logic/CClientPed.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ class CClientPed : public CClientStreamElement, public CAntiCheatModule

bool CanReloadWeapon ( void );
bool ReloadWeapon ( void );
bool IsReloadingWeapon ( void );

bool ShouldBeStealthAiming ( void );
inline bool IsStealthAiming ( void ) { return m_bStealthAiming; }
Expand Down
22 changes: 22 additions & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ void CLuaPedDefs::LoadFunctions ( void ) {
CLuaCFunctions::AddFunction ( "removePedFromVehicle", RemovePedFromVehicle );
CLuaCFunctions::AddFunction ( "setPedOxygenLevel", SetPedOxygenLevel );
CLuaCFunctions::AddFunction ( "givePedWeapon", GivePedWeapon );
CLuaCFunctions::AddFunction ( "isPedReloadingWeapon", IsPedReloadingWeapon );
}

void CLuaPedDefs::AddClass ( lua_State* luaVM )
Expand Down Expand Up @@ -162,6 +163,7 @@ void CLuaPedDefs::AddClass ( lua_State* luaVM )
lua_classfunction ( luaVM, "setWalkingStyle", "setPedWalkingStyle" );
lua_classfunction ( luaVM, "setStat", "setPedStat" );
lua_classfunction ( luaVM, "giveWeapon", "givePedWeapon" );
lua_classfunction ( luaVM, "isReloadingWeapon", "isPedReloadingWeapon" );

lua_classvariable ( luaVM, "vehicle", OOP_WarpPedIntoVehicle, GetPedOccupiedVehicle );
lua_classvariable ( luaVM, "vehicleSeat", NULL, "getPedOccupiedVehicleSeat" );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing classvariable reloadingWeapon

Expand Down Expand Up @@ -190,6 +192,7 @@ void CLuaPedDefs::AddClass ( lua_State* luaVM )
// lua_classvariable ( luaVM, "muzzlePosition", NULL, "getPedWeaponMuzzlePosition" ); // TODO: needs to return a vector3 for oop
lua_classvariable ( luaVM, "weaponSlot", "setPedWeaponSlot", "getPedWeaponSlot" );
lua_classvariable ( luaVM, "walkingStyle", "setPedWalkingStyle", "getPedWalkingStyle" );
lua_classvariable ( luaVM, "reloadingWeapon", nullptr, "isPedReloadingWeapon" );

//lua_classvariable ( luaVM, "ammoInClip", NULL, CLuaOOPDefs::GetPedAmmoInClip ); // .ammoInClip["slot"] (readonly)
//lua_classvariable ( luaVM, "analogControlState", CLuaOOPDefs::SetPedAnalogControlState, CLuaOOPDefs::GetPedAnalogControlState ); //TODO: .analogControlState["control"] = value
Expand Down Expand Up @@ -1030,6 +1033,25 @@ int CLuaPedDefs::GivePedWeapon ( lua_State* luaVM )
return 1;
}

int CLuaPedDefs::IsPedReloadingWeapon(lua_State* luaVM)
{
// Verify the argument
CClientPed* pPed = NULL;
CScriptArgReader argStream(luaVM);
argStream.ReadUserData(pPed);

if (!argStream.HasErrors())
{
lua_pushboolean(luaVM, pPed->IsReloadingWeapon());
return 1;
}
else
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());

lua_pushboolean(luaVM, false);
return 1;
}


int CLuaPedDefs::GetPedClothes ( lua_State* luaVM )
{
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 @@ -72,6 +72,7 @@ class CLuaPedDefs : public CLuaDefs
LUA_DECLARE ( SetPedMoveAnim );
LUA_DECLARE ( SetPedWeaponSlot );
LUA_DECLARE ( GivePedWeapon );
LUA_DECLARE ( IsPedReloadingWeapon );
LUA_DECLARE ( AddPedClothes );
LUA_DECLARE ( RemovePedClothes );
LUA_DECLARE ( SetPedControlState );
Expand Down