@@ -232,13 +232,23 @@ int CLuaWorldDefs::ProcessLineOfSight(lua_State* luaVM)
232
232
// bool float float float element float float float int int int processLineOfSight ( float startX, float startY, float startZ, float endX, float endY,
233
233
// float endZ,
234
234
// [ bool checkBuildings = true, bool checkVehicles = true, bool checkPlayers = true, bool checkObjects = true, bool checkDummies = true,
235
- // bool seeThroughStuff = false, bool ignoreSomeObjectsForCamera = false, bool shootThroughStuff = false, element ignoredElement = nil, bool
236
- // returnBuildingInfo = false, bCheckCarTires = false ] )
237
- CVector vecStart;
238
- CVector vecEnd;
239
- SLineOfSightFlags flags;
240
- CClientEntity* pIgnoredElement;
241
- bool bIncludeBuildingInfo;
235
+ // bool seeThroughStuff = false, bool ignoreSomeObjectsForCamera = false, bool shootThroughStuff = false, element ignoredElement = nil [,
236
+ // element ignoredElement2,
237
+ // element ignoredElement3,
238
+ // ... etc
239
+ // ], bool returnBuildingInfo = false, bCheckCarTires = false ] )
240
+
241
+ // bool float float float element float float float int int int processLineOfSight ( float startX, float startY, float startZ, float endX, float endY,
242
+ // float endZ,
243
+ // [ bool checkBuildings = true, bool checkVehicles = true, bool checkPlayers = true, bool checkObjects = true, bool checkDummies = true,
244
+ // bool seeThroughStuff = false, bool ignoreSomeObjectsForCamera = false, bool shootThroughStuff = false, table ignoredElements = nil,
245
+ // bool returnBuildingInfo = false, bCheckCarTires = false ] )
246
+
247
+ CVector vecStart;
248
+ CVector vecEnd;
249
+ SLineOfSightFlags flags;
250
+ std::vector<CClientEntity*> vecIgnoredElements;
251
+ bool bIncludeBuildingInfo;
242
252
243
253
CScriptArgReader argStream (luaVM);
244
254
argStream.ReadVector3D (vecStart);
@@ -251,18 +261,31 @@ int CLuaWorldDefs::ProcessLineOfSight(lua_State* luaVM)
251
261
argStream.ReadBool (flags.bSeeThroughStuff , false );
252
262
argStream.ReadBool (flags.bIgnoreSomeObjectsForCamera , false );
253
263
argStream.ReadBool (flags.bShootThroughStuff , false );
254
- argStream.ReadUserData (pIgnoredElement, NULL );
264
+
265
+ if (argStream.NextIsTable ()) // Is the next value a table? Read it as a user data table (will error if table contains invalid type)
266
+ {
267
+ argStream.ReadUserDataTable (vecIgnoredElements);
268
+ }
269
+ else {
270
+ CClientEntity* pIgnoredElement;
271
+ argStream.ReadUserData (pIgnoredElement, NULL );
272
+
273
+ if (pIgnoredElement != NULL )
274
+ {
275
+ vecIgnoredElements.push_back (pIgnoredElement);
276
+ }
277
+ }
278
+
255
279
argStream.ReadBool (bIncludeBuildingInfo, false );
256
280
argStream.ReadBool (flags.bCheckCarTires , false );
257
281
258
282
if (!argStream.HasErrors ())
259
283
{
260
- CEntity* pIgnoredEntity = pIgnoredElement ? pIgnoredElement->GetGameEntity () : NULL ;
261
284
CColPoint* pColPoint = NULL ;
262
285
CClientEntity* pColEntity = NULL ;
263
286
bool bCollision;
264
287
SLineOfSightBuildingResult buildingResult;
265
- if (CStaticFunctionDefinitions::ProcessLineOfSight (vecStart, vecEnd, bCollision, &pColPoint, &pColEntity, flags, pIgnoredEntity ,
288
+ if (CStaticFunctionDefinitions::ProcessLineOfSight (vecStart, vecEnd, bCollision, &pColPoint, &pColEntity, flags, vecIgnoredElements ,
266
289
bIncludeBuildingInfo ? &buildingResult : NULL ))
267
290
{
268
291
// Got a collision?
0 commit comments