Skip to content

Allow multiple ignored elements to be passed to processLineOfSight #2032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Apr 7, 2023

Conversation

Lpsd
Copy link
Member

@Lpsd Lpsd commented Jan 20, 2021

This allows multiple ignore elements to be passed to processLineOfSight, via table of elements.

It is backwards compatible. If you pass a single element, or nil as ignoredElements it has the same behaviour as before.

processLineOfSight ( float startX, float startY, float startZ, 
                       float endX, float endY, float endZ, 
                       [ bool checkBuildings = true, 
                       bool checkVehicles = true, 
                       bool checkPlayers = true, 
                       bool checkObjects = true, 
                       bool checkDummies = true, 
                       bool seeThroughStuff = false, 
                       bool ignoreSomeObjectsForCamera = false, 
                       bool shootThroughStuff = false, 
                       table ignoredElements = nil,
                       bool includeWorldModelInformation = false,
                       bool bIncludeCarTyres ] )

Partially resolves #1549

I will submit a separate PR for isLineOfSightClear

@0xHexadecimal
Copy link

Wouldn't it be better to take a table of elements?

elements = {}
processLineOfSight(...,unpack(elements),...) -- can't do this

I suppose you could the put last arguments as the last values in the table.

@Lpsd
Copy link
Member Author

Lpsd commented Jan 20, 2021

I'll add the ability to pass a table, as well as vararg.

Having it at the end would be weird, because we have to keep the original argument order to some extent.

@Lpsd Lpsd added the enhancement New feature or request label Jan 20, 2021
@Lpsd Lpsd requested a review from patrikjuvonen January 21, 2021 19:42
@Lpsd Lpsd requested review from Pirulax and removed request for patrikjuvonen January 22, 2021 16:30
@Pirulax
Copy link
Contributor

Pirulax commented Mar 19, 2021

Other than these comments you're fine imho.

@patrikjuvonen patrikjuvonen self-requested a review August 30, 2021 09:56
@patrikjuvonen patrikjuvonen added this to the Future Release milestone Aug 30, 2021
@Lpsd Lpsd mentioned this pull request Apr 28, 2022
1 task
@Pirulax
Copy link
Contributor

Pirulax commented Apr 30, 2022

Time to merge this.
@Lpsd address the comments, and I'll merge it.
I hope you've tested it (But there's really nothing not to work, so)

@Lpsd
Copy link
Member Author

Lpsd commented Jul 16, 2022

Vararg removed.

Test resource: los.zip

Spawns 50 bin objects in a row. Use command /los <amountToIgnore>

e.g /los 50 should return nil for processLineOfSight in debug output, as you're ignoring all elements
/los 30 will output bin_31, as that's the next object to hit after 30
/los 0 will output bin_1
etc

This resource also tests backwards compatibility by passing nil as ignoredElements if 0 is supplied to the command. It shouldn't raise a warning / error (just like original behaviour).

@Einheit-101
Copy link

Is there anything left to do here or why is it not merged?

@patrikjuvonen
Copy link
Contributor

Is there anything left to do here or why is it not merged?

Nothing left to do here, not merged yet because feature freeze is on (https://discord.com/channels/801330706252038164/801330706252038167/1059094962853130250). Will be merged for 1.6.

@patrikjuvonen patrikjuvonen merged commit 076c7fe into multitheftauto:master Apr 7, 2023
@TFP-dev TFP-dev mentioned this pull request Apr 17, 2023
1 task
patrikjuvonen added a commit that referenced this pull request Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

processLineOfSight/isLineOfSightClear should allow to ignore multiple elements
5 participants