Skip to content

Function GetGarageSize returns wrong values #2680

@Lord-Henry

Description

@Lord-Henry

Describe the bug

How this actually works:

local sizeZ, sizeX, sizeY = getGarageSize (ID)

Yes, sizeZ is being returned first than sizeX and sizeY.

Also, sizeZ considers the garage Z position to 0 instead of its floor Z position. So if you try to create a colShape using
getGaragePosition and getGarageSize, the colshape height will become higher than the garage.

How this should work:

local sizeX, sizeY, sizeZ = getGarageSize (ID)

Also:
sizeZ = (current sizeZ) - posZ

Steps to reproduce

  1. Enable development mode with this (client-side):
setDevelopmentMode (true)
  1. Run this script (client-side):
function getGarageColShape (id, fromZero)
    local sizeZ, sizeX, sizeY = getGarageSize (id) -- This function sucks and its first value is Z size. The Z size starts from 0 to the garage ceil.
    local posX, posY, posZ = getGaragePosition (id) -- This function uses the garage's floor Z position. When using getGarageSize() to create a colShape, set Z position to 0.
    if (fromZero) then
        return createColCuboid (posX, posY, 0, sizeX, sizeY, sizeZ) -- If you want to set colShape Z position to 0.
    else
        return createColCuboid (posX, posY, posZ, sizeX, sizeY, sizeZ - posZ) -- If you want to set colShape on garage's floor.
    end
end

setGarageOpen (9, true) -- Open CJ House Garage
getGarageColShape (9, true) -- Change to false if you wan't the colshape to start from the garage floor.
  1. As you can see, the colshape is created perfectly with the code above. Now try with this code below (client-side):
local sizeX, sizeY, sizeZ = getGarageSize (9) -- How this function is supposed to be used.
local posX, posY, posZ = getGaragePosition (9)

setGarageOpen (9, true) -- Open CJ House Garage
createColCuboid (posX, posY, posZ, sizeX, sizeY, sizeZ) -- What's going on here? This should work well...

HOW TO FIX:

  • Change the returned values order. The first value should be the third value.
  • Change how the Z size value is calculated. Just get the current value and subtract the garage Z position from it. (sizeZ - posZ)

Version

Client: v1.5.9-release-21261 (Windows 10 Home, 64-bit)
Server: v1.5.9-release-21261 (Windows 10 Home, 64-bit)

Additional context

No response

Relevant log output

No response

Security Policy

  • I have read and understood the Security Policy and this issue is not security related.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions