Skip to content
12 changes: 11 additions & 1 deletion Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ void CLuaPedDefs::LoadFunctions()
{"setPedExitVehicle", ArgumentParser<SetPedExitVehicle>},
{"setPedBleeding", ArgumentParser<SetPedBleeding>},
{"playPedVoiceLine", ArgumentParser<PlayPedVoiceLine>},
{"setPedWearingJetpack", ArgumentParser<SetPedWearingJetpack>},

{"getPedVoice", GetPedVoice},
{"getElementBonePosition", ArgumentParserWarn<false, GetElementBonePosition>},
Expand Down Expand Up @@ -213,12 +214,13 @@ void CLuaPedDefs::AddClass(lua_State* luaVM)
lua_classfunction(luaVM, "setExitVehicle", "setPedExitVehicle");
lua_classfunction(luaVM, "setBleeding", "setPedBleeding");
lua_classfunction(luaVM, "playVoiceLine", "playPedVoiceLine");
lua_classfunction(luaVM, "setWearingJetpack", "setPedWearingJetpack");

lua_classvariable(luaVM, "vehicle", OOP_WarpPedIntoVehicle, GetPedOccupiedVehicle);
lua_classvariable(luaVM, "vehicleSeat", NULL, "getPedOccupiedVehicleSeat");
lua_classvariable(luaVM, "canBeKnockedOffBike", "setPedCanBeKnockedOffBike", "canPedBeKnockedOffBike");
lua_classvariable(luaVM, "hasJetPack", NULL, "doesPedHaveJetPack");
lua_classvariable(luaVM, "jetpack", NULL, "isPedWearingJetpack"); // introduced in 1.5.5-9.13846
lua_classvariable(luaVM, "jetpack", "setPedWearingJetpack", "isPedWearingJetpack"); // introduced in 1.5.5-9.13846
lua_classvariable(luaVM, "armor", "setPedArmor", "getPedArmor");
lua_classvariable(luaVM, "fightingStyle", "setPedFightingStyle", "getPedFightingStyle");
lua_classvariable(luaVM, "cameraRotation", "setPedCameraRotation", "getPedCameraRotation");
Expand Down Expand Up @@ -2585,3 +2587,11 @@ void CLuaPedDefs::PlayPedVoiceLine(CClientPed* ped, int speechId, std::optional<

ped->Say(speechContextId, probability.value_or(1.0f));
}

bool CLuaPedDefs::SetPedWearingJetpack(CClientPed* ped, bool state)
{
if (!ped->IsLocalEntity())
return false;

return ped->SetHasJetPack(state);
}
2 changes: 2 additions & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,6 @@ class CLuaPedDefs : public CLuaDefs
static bool killPedTask(CClientPed* ped, taskType taskType, std::uint8_t taskNumber, std::optional<bool> gracefully);

static void PlayPedVoiceLine(CClientPed* ped, int speechId, std::optional<float> probability);

static bool SetPedWearingJetpack(CClientPed* ped, bool state);
};
Loading