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
Rally Audio ManagerRally Camera Path PlayerRally ClientRally Cut CaptureRally EnumsRally Extension HelperRally GeometryRally ManagerRecce ManagerRecce AppRecce SettingsRally Settings ManagerSnap-to-RoadTraffic Exclusion ZonesRally UtilityRally Vehicle CaptureRally Vehicle Tracker
Rally Loop PenaltiesRally AttemptsRally Event LogRally Loop ManagerRoad Section Penalty KeeperRally Schedule UtilitiesSpeeding DetectorStaged Countdown TestStaged Countdown Utilities

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 Extensionsgameplayrallyloop

Rally Schedule Utilities

Pure utility functions for rally loop scheduling and time calculations. Provides minute-boundary rounding, slot size conversion, and time comparison helpers.

Pure utility functions for rally loop scheduling and time calculations. Provides minute-boundary rounding, slot size conversion, and time comparison helpers.


Public API

FunctionSignatureReturnsDescription
M.roundToNextMinute(timeSecs)numberRounds time up to next 60-second boundary
M.slotMinutesToSeconds(slotSizeMinutes)numberConverts minutes to seconds (default 1 min = 60s)
M.calculateNextSlotTime(currentTime, slotSizeMinutes?, roundToMinute?)numberAdds slot duration and optionally rounds to minute
M.isLaterTime(newTime, currentTime, tolerance?)booleanChecks if newTime > currentTime + tolerance

Internals

roundToNextMinute

math.ceil(timeSecs / 60) * 60

Always rounds up. E.g., 61 → 120, 60 → 60, 59 → 60.

calculateNextSlotTime

Combines slot addition with optional minute rounding:

local newTime = currentTime + (slotSizeMinutes * 60)
if roundToMinute then
  newTime = roundToNextMinute(newTime)
end

Default: slotSizeMinutes = 1, roundToMinute = true.

isLaterTime

Simple comparison with optional tolerance buffer:

return newTime > (currentTime + tolerance)

How It Works

These are stateless helper functions used by rallyLoopManager for schedule calculation:

  • Rounding TC and SS start times to minute boundaries
  • Computing next available time slots
  • Checking whether rescheduled times are actually later than originals

Usage Example

local ScheduleUtils = require('gameplay/rally/loop/scheduleUtils')

-- Round to next minute
local nextMin = ScheduleUtils.roundToNextMinute(125)  -- 180

-- Calculate next 2-minute slot
local nextSlot = ScheduleUtils.calculateNextSlotTime(100, 2)  -- 240 (rounded)

-- Check if rescheduled time is actually later
if ScheduleUtils.isLaterTime(newTime, oldTime, 5) then
  -- apply reschedule
end

See Also

  • Rally Loop Penalties - Related reference
  • Rally Attempts - Related reference
  • Rally Event Log - Related reference
  • Gameplay Systems Guide - Guide

Road Section Penalty Keeper

Class-based tracker for rally liaison route deviation penalties. Monitors route recalculation frequency and applies escalating time penalties when the driver deviates from the prescribed road section

Speeding Detector

Class-based speed monitoring system for rally road sections. Samples vehicle speed into a ring buffer, computes a rolling average, and applies stochastic speeding penalties with configurable probabili

On this page

Public APIInternalsroundToNextMinutecalculateNextSlotTimeisLaterTimeHow It WorksUsage ExampleSee Also