RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Gameplay AchievementGameplay CityDiscoverForce FieldGarage ModeMarker InteractionParking SystemGameplay Playmode MarkersGameplay PoliceGameplay RallyGameplay Rally LoopGameplay Raw POIsGameplay Skidpad TestSpeed Trap LeaderboardsSpeed Traps and CamerasGameplay StatisticsTaxi Ride SystemTraffic SystemVehicle PerformanceWalking
Locations DetectorMission ManagerMissionsMission Screen UIPOI TestProgressMission Start TriggerUnlocks

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE Extensionsgameplaymissions

Locations Detector

Reference for `gameplay_missions_locationsDetector`, which detects missions near the player by checking clustered POI locations.

Reference for gameplay_missions_locationsDetector, which detects missions near the player by checking clustered POI locations.


Module Exports (M)

FunctionSignatureDescription
getNearbyLocationsgetNearbyLocations(level, playerPosition) → tableReturns nearby missions at the player's position
onPoiTriggered(hook)Forward-declared but not implemented in-file
isEnabled(hook)Forward-declared but not implemented in-file
M.getNearbyLocations(level, playerPosition)-
M.isEnabledvalue-
M.onPoiTriggeredvalue-

Internals

getNearbyLocations

Clears and repopulates a cached nearbyLocations table each call:

local nearbyLocations = { missions = {} }
local function getNearbyLocations(level, playerPosition)
  table.clear(nearbyLocations.missions)
  -- Calls getMissionsAtLocation internally
  return nearbyLocations
end

getMissionsAtLocation

Iterates over all POI clusters from gameplay_missions_clustering and checks proximity using defaultLocationCheck:

local function defaultLocationCheck(location, level, playerPosition, mission)
  return location.pos and location.radius
    and playerPosition:distance(location.pos) <= location.radius
end

For each cluster within range, all contained mission elements are added to nearbyLocations.missions with:

  • type - cluster element type
  • mission - mission object from gameplay_missions_missions.getMissionById()
  • location - the cluster itself
  • id - the contained ID

How It Works

-- Flow:
-- 1. Get all clusters (optionally merged by bigMap merge radius)
-- 2. For each cluster, check if playerPosition is within radius
-- 3. For matching clusters, look up each contained mission by ID
-- 4. Return { missions = { {type, mission, location, id}, ... } }

-- The accessible flag is currently hardcoded to true:
accessible = true -- keeping this for later, when we have bg activities again

Key Behaviors

  • Uses gameplay_missions_clustering.getAllClusters() for cluster data
  • When the big map is active, uses freeroam_bigMapMode.clusterMergeRadius for wider clustering
  • Contains commented-out legacy code for checking mission visibility and ongoing status
  • The missionsChanged flag tracks if the nearby set changed (currently always false since legacy path is commented out)

See Also

  • missions/missionManager - Mission Lifecycle Manager - Related reference
  • missions/missionScreen - Mission UI Screen & Starting Options - Related reference
  • missions/missions - Mission Registry & Data Management - Related reference
  • Gameplay Systems Guide - Guide

Zone Marker

Reference for the zone marker class that checks if a driven vehicle is inside a 2D polygon zone for POI interactions.

Mission Manager

Reference for `gameplay_missions_missionManager`, the central orchestrator for starting and stopping missions with multi-step task pipelines.

On this page

Module Exports (M)InternalsgetNearbyLocationsgetMissionsAtLocationHow It WorksKey BehaviorsSee Also