Minimap Vehicles
Renders player and other vehicles on the minimap with role-based styling.
Renders player and other vehicles on the minimap with role-based styling.
Overview
ui_apps_minimap_vehicles draws all visible vehicles on the minimap as directional triangles or circles. Player vehicle, police, usable, and other vehicles each get distinct colors and layers.
Extension path: lua/ge/extensions/ui/apps/minimap/vehicles.lua
Exports (M)
| Function | Signature | Description |
|---|---|---|
setMinimapState | (w, h, cx, cy, camPos, ...) | Syncs camera/canvas state from main minimap each frame. |
drawPlayer | (dtReal, dtSim) → adjustedScale? | Draws the player vehicle/walking indicator and returns dynamic zoom scale. |
drawOtherVehicles | (dtReal, dtSim) | Draws all non-player vehicles with role-based filtering and styling. |
Internals
Vehicle Shapes
drawVehicle(pos, fwd, color, size, asCircle, layer) renders two shapes:
- Circle mode (
asCircle=true) - For walking/unicycle: circle body + forward triangle - Diamond/arrow mode - For vehicles: two triangles forming an arrow shape pointing forward
Both have a white border (from navBg style color) and colored fill.
Player Drawing
The player vehicle uses velocity-based dynamic zoom:
local dynamicScale = clamp(velSmoother:get(vel > 10 and 3.0 or 1, dtReal), 1, 1.75)
local walkScale = walkSmoother:get(isWalking and 0 or 1, dtReal)- Walking uses
gameplay_walk.getPosXYZ()and walking rotation - Driving uses
map.objects[vehId].posanddirVec - Free camera draws a cone-shaped indicator with lookahead offset
Other Vehicle Filtering
Vehicles are filtered by debug settings and role:
| Setting | Vehicle Type |
|---|---|
drawParkedVehicles | Vehicles in gameplay_parking |
drawTrafficVehicles | Vehicles in gameplay_traffic |
drawActivePoliceVehicles | Police pursuing the player |
drawOtherVehicles | General drivable vehicles |
Additionally:
- Props, Unknown, Utility, PropTraffic, and Traffic types are skipped via
ignoredTypes - Blacklisted vehicles (
gameplay_walk.isVehicleBlacklisted) are colored gray
Color Assignment
| Vehicle Role | Color | Layer |
|---|---|---|
| Player | Orange (clrFocus) | VEHICLE_PLAYER |
| Usable (switchable) | Muted orange (clrFocusMuted) | VEHICLES_USABLE |
| Blacklisted/unusable | Gray (grayMuted) | VEHICLES_OTHER |
| Police (active pursuit) | Flashing red/blue | VEHICLES_POLICE |
Police vehicles flash using math.sin(os.clock()*5) for alternating red/blue.
How It Works
- Main minimap calls
setMinimapState()to sync camera data drawOtherVehicles()iterates all active vehicles, filters by role/settings- Each vehicle is drawn as an arrow or circle with role-based color
drawPlayer()draws the player with dynamic zoom scaling based on velocity- Returns
adjustedScaleso the minimap can zoom out at higher speeds
Additional Exports
The following exports are available but not yet documented in detail:
M.drawOtherVehiclesM.drawPlayerM.setMinimapState