Recovery Prompt
Recovery and towing system for career mode. Provides context-sensitive buttons for flipping, towing, repairing, and teleporting vehicles, with cost calculations, conditions, and fade-screen transition
Recovery and towing system for career mode. Provides context-sensitive buttons for flipping, towing, repairing, and teleporting vehicles, with cost calculations, conditions, and fade-screen transitions.
Key Public Functions
| Function | Signature | Description |
|---|---|---|
M.isActive | () → boolean | Whether the recovery system is active |
M.setActive | (active) | Enables/disables the recovery system |
M.setDefaultsForCareer | () | Activates career-appropriate buttons |
M.setDefaultsForFreeroam | () | Deactivates all buttons |
M.setDefaultsForTutorial | () | Activates tutorial-appropriate buttons |
M.setEverythingActive | () | Activates all buttons |
M.deactivateAllButtons | () | Deactivates all buttons |
M.addButton | (id, label, fadeFn, order, msg, active, enabled, fade, icon) | Adds a custom recovery button |
M.removeButtonById | (id) | Removes a custom button |
M.setButtonActiveById | (id, active) | Sets a button's active state |
M.getButtonActiveById | (id) → boolean | Gets a button's active state |
M.setButtonEnabledById | (id, enabled) | Sets a button's enabled state |
M.setButtonLimits | (limits) | Sets use-count limits per button |
M.resetButtonLimitCounters | (onlyFor) | Resets usage counters |
M.getButtonLimitsAndCounts | () → table | Returns limits and current counts |
M.buttonPressed | (buttonId, target) | Triggers a recovery action with fade |
M.handleCurrRecoveryOption | () | Executes the pending recovery action |
M.serializeState | () → table | Serializes button active states |
M.deserializeState | (data) | Restores button active states |
M.getCustomRecoveryOptionsActiveState | () → table | Returns sanitized button states |
M.onResetGameplay | (playerID) | Opens radial menu on gameplay reset |
Built-in Button Options
| ID | Label | Type | Cost | Description |
|---|---|---|---|---|
towToRoad | Tow to Nearest Road | vehicle | $75 | Teleports to nearest road |
flipUpright | Flip Upright | vehicle | $50 | Flips vehicle to wheels-down |
getFavoriteVehicle | Retrieve Favorite | walk | free | Spawns favorite vehicle at player |
repairHere | Repair | vehicle | free | Repairs vehicle in place |
flipMission | Flip Upright (Mission) | vehicle | free | Mission-context flip |
recoverMission | Recover (Mission) | vehicle | free | Mission-context recovery |
submitMission | Submit Score | none | - | Submit mission attempt |
restartMission | Restart Mission | none | - | Restart current mission |
stopTestdrive | Stop Test Drive | none | - | End dealership test drive |
giveBackDeliveryVehicle | Discard Delivery Vehicle | vehicle | free | Return a delivery task vehicle |
returnLoanedVehicle | Return Loaned Vehicle | vehicle | free | Return a loaned vehicle |
Conditions System
| Condition | Description |
|---|---|
outOfPursuit | Not in police chase |
vehicleSlow | Vehicle speed < 10 m/s |
vehicleStopped | Vehicle speed < 0.5 m/s |
vehicleInInventory | Vehicle exists in career inventory |
vehicleOwned | Player owns the vehicle |
favouriteSet | Favorite vehicle is set and available |
notTestdriving | Not in a test drive |
towToRoadAllowedByPermission | Permission system allows towing |
duringTestdrive | Currently in a test drive |
vehicleIsDeliveryVehicle | Vehicle is a delivery task vehicle |
Dynamic Garage Buttons
On level load, tow-to-garage and taxi-to-garage buttons are auto-generated for each garage facility that doesn't have noQuickTravel set. Prices are calculated via career_modules_quickTravel.
Integration with Radial Menu
Recovery buttons are injected into the quick access radial menu under /root/sandbox/career/ and /root/sandbox/mission/ paths via onBeforeRadialOpened.
Hooks
| Hook | Purpose |
|---|---|
M.onPopupClosed | Called on PopupClosed event |
M.onResetGameplay | Opens radial menu with appropriate root on gameplay reset |
M.onScreenFadeState | Handles fade completion to execute recovery action |
M.onCareerModulesActivated | Adds towing/taxi buttons when career modules activate |
M.onClientStartMission | Sets career defaults and adds towing/taxi buttons on mission start |
M.onBeforeRadialOpened | Initializes recovery buttons in radial menu paths |
M.onHideRadialMenu | Clears popup data when radial menu hides |
M.onQuickAccessLoaded | Resets initialization flag for lazy button registration |
M.uiPopupButtonPressed(buttonId) | Handles UI popup button press. |
M.uiPopupCancelPressed() | Handles UI popup cancel press. |
Module State
| Variable | Type | Default |
|---|---|---|
uiPopupButtonPressed | varies | uiPopupButtonPressed |
uiPopupCancelPressed | varies | uiPopupCancelPressed |
Notes
- Actions use
ui_fadeScreenfor smooth transitions (0.3s fade). - Roadside assistance can waive costs if insurance covers it.
- The
onResetGameplayhook opens the radial menu with the appropriate root. - Custom buttons must have
customButton = trueto be removable.
See Also
- quickAccess - Radial menu that hosts recovery buttons
- globals -
spawn.safeTeleport,career_modules_*
Quick Access (Radial Menu)
Radial quick-access menu system. Provides the in-game radial menu for vehicle actions, sandbox tools, AI control, traffic, repair/recovery, and dynamic configurable slots.
Remote Controller
Mobile phone remote controller support. Listens for UDP connections from the BeamNG Remote Control app, creates virtual input devices, and bridges accelerometer/button data to vehicle controls.