Skip to content

Conversation

@tederis
Copy link
Member

@tederis tederis commented Mar 21, 2025

This PR is intended to fix the problem with the referring of several elements to one ID. Currently marker colshapes all reside on ID 0 which is erroneous and produces wrong results with functions like getElementsWithinRange.

Code for the reproducing:

addEventHandler( "onClientResourceStart", resourceRoot,
    function()
        local x, y, z = 0, 0, 4

        for i = 1, 2 do
            createMarker( x + i, y, z, "cylinder", 1 )
        end

        iprint( getElementsWithinRange( x, y, z, 10 ) )
    end
, false )

The output before PR:
[2025-03-21 13:30:05] INFO: { elem:colshape0DDD87E0, elem:colshape0DDD87E0, elem:colshape0DDD87E0, false, false, elem:marker[cylinder]0DDD85D8, elem:marker[cylinder]0DDD8600, elem:colshape0DDD87E0 }
Four elem:colshape0DDD87E0 colshapes and falses.

The output after PR:
[2025-03-21 13:33:29] INFO: { elem:marker[cylinder]2C800980, elem:marker[cylinder]2C800CA0, elem:colshape2C800D68, elem:colshape2C800D90 }
Two different colshapes.

NOTE: This bug isn't stable and it may take several runs of the code above to notice the problem.

@tederis tederis added the bugfix Solution to a bug of any kind label Mar 21, 2025
@sbx320 sbx320 merged commit 24708f8 into multitheftauto:master Mar 28, 2025
6 checks passed
MTABot pushed a commit that referenced this pull request Mar 28, 2025
24708f8 Colshape IDs fix (#4115)
c10a283 Update crowdin-translators.json
@multitheftauto multitheftauto deleted a comment from Kipilon Apr 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Solution to a bug of any kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants