@@ -232,23 +232,13 @@ 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 [,
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;
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;
252
242
253
243
CScriptArgReader argStream (luaVM);
254
244
argStream.ReadVector3D (vecStart);
@@ -261,32 +251,18 @@ int CLuaWorldDefs::ProcessLineOfSight(lua_State* luaVM)
261
251
argStream.ReadBool (flags.bSeeThroughStuff , false );
262
252
argStream.ReadBool (flags.bIgnoreSomeObjectsForCamera , false );
263
253
argStream.ReadBool (flags.bShootThroughStuff , false );
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
- {
271
- CClientEntity* pIgnoredElement;
272
- argStream.ReadUserData (pIgnoredElement, NULL );
273
-
274
- if (pIgnoredElement != NULL )
275
- {
276
- vecIgnoredElements.push_back (pIgnoredElement);
277
- }
278
- }
279
-
254
+ argStream.ReadUserData (pIgnoredElement, NULL );
280
255
argStream.ReadBool (bIncludeBuildingInfo, false );
281
256
argStream.ReadBool (flags.bCheckCarTires , false );
282
257
283
258
if (!argStream.HasErrors ())
284
259
{
260
+ CEntity* pIgnoredEntity = pIgnoredElement ? pIgnoredElement->GetGameEntity () : NULL ;
285
261
CColPoint* pColPoint = NULL ;
286
262
CClientEntity* pColEntity = NULL ;
287
263
bool bCollision;
288
264
SLineOfSightBuildingResult buildingResult;
289
- if (CStaticFunctionDefinitions::ProcessLineOfSight (vecStart, vecEnd, bCollision, &pColPoint, &pColEntity, flags, vecIgnoredElements ,
265
+ if (CStaticFunctionDefinitions::ProcessLineOfSight (vecStart, vecEnd, bCollision, &pColPoint, &pColEntity, flags, pIgnoredEntity ,
290
266
bIncludeBuildingInfo ? &buildingResult : NULL ))
291
267
{
292
268
// Got a collision?
0 commit comments