@@ -30,7 +30,7 @@ void CLuaPedDefs::LoadFunctions(void)
3030 CLuaCFunctions::AddFunction (" getPedTotalAmmo" , GetPedTotalAmmo);
3131 CLuaCFunctions::AddFunction (" getPedWeapon" , GetPedWeapon);
3232 CLuaCFunctions::AddFunction (" getPedClothes" , GetPedClothes);
33- CLuaCFunctions::AddFunction (" doesPedHaveJetPack " , DoesPedHaveJetPack);
33+ CLuaCFunctions::AddFunction (" isPedWearingJetpack " , DoesPedHaveJetPack); // introduced in 1.5.5-9.13176
3434 CLuaCFunctions::AddFunction (" isPedOnGround" , IsPedOnGround);
3535 CLuaCFunctions::AddFunction (" getPedFightingStyle" , GetPedFightingStyle);
3636 CLuaCFunctions::AddFunction (" getPedWalkingStyle" , GetPedMoveAnim);
@@ -52,8 +52,7 @@ void CLuaPedDefs::LoadFunctions(void)
5252 CLuaCFunctions::AddFunction (" setPedStat" , SetPedStat);
5353 CLuaCFunctions::AddFunction (" addPedClothes" , AddPedClothes);
5454 CLuaCFunctions::AddFunction (" removePedClothes" , RemovePedClothes);
55- CLuaCFunctions::AddFunction (" givePedJetPack" , GivePedJetPack);
56- CLuaCFunctions::AddFunction (" removePedJetPack" , RemovePedJetPack);
55+ CLuaCFunctions::AddFunction (" setPedWearingJetpack" , SetPedWearingJetpack); // introduced in 1.5.5-9.13176
5756 CLuaCFunctions::AddFunction (" setPedFightingStyle" , SetPedFightingStyle);
5857 CLuaCFunctions::AddFunction (" setPedWalkingStyle" , SetPedMoveAnim);
5958 CLuaCFunctions::AddFunction (" setPedGravity" , SetPedGravity);
@@ -95,27 +94,26 @@ void CLuaPedDefs::AddClass(lua_State* luaVM)
9594 lua_classfunction (luaVM, " removeClothes" , " removePedClothes" );
9695 lua_classfunction (luaVM, " removeFromVehicle" , " removePedFromVehicle" );
9796 lua_classfunction (luaVM, " removeJetPack" , " removePedJetPack" );
98- lua_classfunction (luaVM, " doesHaveJetpack" , " doesPedHaveJetPack" );
97+ lua_classfunction (luaVM, " doesHaveJetpack" , " doesPedHaveJetPack" ); // deprecated in 1.5.5-9.13176
9998
10099 lua_classfunction (luaVM, " isDead" , " isPedDead" );
101100 lua_classfunction (luaVM, " isDucked" , " isPedDucked" );
102101 lua_classfunction (luaVM, " isInWater" , " isPedInWater" );
103102 lua_classfunction (luaVM, " isOnGround" , " isPedOnGround" );
104103 lua_classfunction (luaVM, " isInVehicle" , " isPedInVehicle" );
105-
106104 lua_classfunction (luaVM, " isOnFire" , " isPedOnFire" );
107105 lua_classfunction (luaVM, " isChoking" , " isPedChoking" );
108106 lua_classfunction (luaVM, " isDoingGangDriveby" , " isPedDoingGangDriveby" );
109107 lua_classfunction (luaVM, " isFrozen" , " isPedFrozen" );
110108 lua_classfunction (luaVM, " isHeadless" , " isPedHeadless" );
109+ lua_classfunction (luaVM, " isWearingJetpack" , " isPedWearingJetpack" ); // introduced in 1.5.5-9.13176
111110
112111 lua_classfunction (luaVM, " getArmor" , " getPedArmor" );
113112 lua_classfunction (luaVM, " getFightingStyle" , " getPedFightingStyle" );
114113 lua_classfunction (luaVM, " getGravity" , " getPedGravity" );
115114 lua_classfunction (luaVM, " getStat" , " getPedStat" );
116115 lua_classfunction (luaVM, " getWeaponSlot" , " getPedWeaponSlot" );
117116 lua_classfunction (luaVM, " getWalkingStyle" , " getPedWalkingStyle" );
118-
119117 lua_classfunction (luaVM, " getAmmoInClip" , " getPedAmmoInClip" );
120118 lua_classfunction (luaVM, " getOccupiedVehicle" , " getPedOccupiedVehicle" );
121119 lua_classfunction (luaVM, " getWeapon" , " getPedWeapon" );
@@ -136,9 +134,9 @@ void CLuaPedDefs::AddClass(lua_State* luaVM)
136134 lua_classfunction (luaVM, " setStat" , " setPedStat" );
137135 lua_classfunction (luaVM, " setWeaponSlot" , " setPedWeaponSlot" );
138136 lua_classfunction (luaVM, " setWalkingStyle" , " setPedWalkingStyle" );
139-
140137 lua_classfunction (luaVM, " setAnimation" , " setPedAnimation" );
141138 lua_classfunction (luaVM, " setAnimationProgress" , " setPedAnimationProgress" );
139+ lua_classfunction (luaVM, " setWearingJetpack" , " setPedWearingJetpack" ); // introduced in 1.5.5-9.13176
142140
143141 lua_classvariable (luaVM, " inVehicle" , NULL , " isPedInVehicle" );
144142 lua_classvariable (luaVM, " ducked" , NULL , " isPedDucked" );
@@ -160,12 +158,10 @@ void CLuaPedDefs::AddClass(lua_State* luaVM)
160158 GetPedOccupiedVehicle); // what about removePedFromVehicle?
161159 lua_classvariable (luaVM, " dead" , " killPed" , " isPedDead" ); // Setting this to any value will still kill the ped. Should we special case this?
162160 lua_classvariable (luaVM, " walkingStyle" , " setPedWalkingStyle" , " getPedWalkingStyle" );
161+ lua_classvariable (luaVM, " jetpack" , " setPedWearingJetpack" , " isPedWearingJetpack" ); // introduced in 1.5.5-9.13176
163162 // lua_classvariable ( luaVM, "stats", "setPedStat", "getPedStat", CLuaOOPDefs::SetPedStat, CLuaOOPDefs::GetPedStat ); // table
164163 // lua_classvariable ( luaVM, "controlState", "setPedControlState", "getPedControlState", CLuaOOPDefs::SetPedControlState, CLuaOOPDefs::GetPedControlState
165164 // ); // TODO: .controlState["control"] = value
166- // This commented code will syntax error, a new method has to be implemented to support this
167- // lua_classvariable ( luaVM, "jetpack", {"removePedJetPack","givePedJetPack}, "doesPedHaveJetPack", CLuaOOPDefs::SetJetpackActive, "doesPedHaveJetPack" );
168- // // very specialised!
169165
170166 lua_registerclass (luaVM, " Ped" , " Element" );
171167}
@@ -1238,6 +1234,32 @@ int CLuaPedDefs::RemovePedJetPack(lua_State* luaVM)
12381234 return 1 ;
12391235}
12401236
1237+ int CLuaPedDefs::SetPedWearingJetpack (lua_State* luaVM)
1238+ {
1239+ CElement* pElement;
1240+ bool bJetPack;
1241+
1242+ CScriptArgReader argStream (luaVM);
1243+ argStream.ReadUserData (pElement);
1244+ argStream.ReadBool (bJetPack);
1245+
1246+ if (!argStream.HasErrors ())
1247+ {
1248+ LogWarningIfPlayerHasNotJoinedYet (luaVM, pElement);
1249+
1250+ if (CStaticFunctionDefinitions::SetPedWearingJetpack (pElement, bJetPack))
1251+ {
1252+ lua_pushboolean (luaVM, true );
1253+ return 1 ;
1254+ }
1255+ }
1256+ else
1257+ m_pScriptDebugging->LogCustom (luaVM, argStream.GetFullErrorMessage ());
1258+
1259+ lua_pushboolean (luaVM, false );
1260+ return 1 ;
1261+ }
1262+
12411263int CLuaPedDefs::SetPedFightingStyle (lua_State* luaVM)
12421264{
12431265 CElement* pElement;
0 commit comments