Showroom
Manages a simple showroom prefab for displaying vehicles in a clean environment.
Manages a simple showroom prefab for displaying vehicles in a clean environment.
Overview
util_showroom spawns and manages a garage prefab at a high altitude position (y=1000), providing functions to move vehicles inside and check if the camera/vehicle is within the showroom bounds.
Extension path: lua/ge/extensions/util/showroom.lua
Exports (M)
| Function | Signature | Description |
|---|---|---|
moveInside | (veh) | Teleports a vehicle into the showroom and autoplaces it. |
isInside | (pos?) → bool | Checks if a position (or current player/camera) is within 20m of the showroom. |
getPosRot | () → pos, rot | Returns the showroom center position and identity rotation. |
onClientEndMission | () | Unloads (deletes) the showroom prefab. |
Internals
Prefab
Path: art/prefabs/garage_simple.prefab
Spawned at vec3(0, 0, 1000) - high above the level to avoid collisions with terrain.
Lazy Loading
The prefab is spawned on first use (when localToWorld is called). It persists until the mission ends.
Position Check
isInside(pos) uses a simple distance check (< 20m) from the prefab origin. If no position is provided, it uses the player vehicle position or camera position.
Cleanup
onClientEndMission deletes the prefab and calls be:reloadCollision().
How It Works
- First call to
moveInsideorisInsidetriggers prefab spawning. moveInside(veh)teleports the vehicle to the showroom center.isInside()checks proximity to determine if the camera/vehicle is in the showroom.- Prefab is cleaned up when the mission ends.
Lua Examples
local showroom = extensions.util_showroom
-- Move current vehicle into showroom
local veh = getPlayerVehicle(0)
showroom.moveInside(veh)
-- Check if player is in showroom
if showroom.isInside() then
print("In showroom")
end
-- Get showroom position
local pos, rot = showroom.getPosRot()Additional Exports
M.getPosRot- (undocumented)M.isInside- (undocumented)M.moveInside- (undocumented)M.onClientEndMission- (undocumented)