World
constWorld:object
Defined in: server/api.d.ts:738
Controls replicated world state and exposes collections of connected players and spawned vehicles.
Type Declaration
Section titled “Type Declaration”players
Section titled “players”
readonlyplayers:EntityCollection<Player>
Connected players visible to scripts, indexed by network entity ID.
vehicles
Section titled “vehicles”
readonlyvehicles:EntityCollection<Vehicle>
Spawned vehicles visible to scripts, indexed by network entity ID.
cycleTrafficLights()
Section titled “cycleTrafficLights()”cycleTrafficLights():
number
Advances the replicated traffic-light cycle by one epoch.
Returns
Section titled “Returns”number
The new monotonically increasing traffic epoch.
getDrivingCoeff()
Section titled “getDrivingCoeff()”getDrivingCoeff():
number
Returns the replicated arcade driving coefficient.
Returns
Section titled “Returns”number
A value from 0 for simulation handling to 1 for arcade handling.
getDrivingMode()
Section titled “getDrivingMode()”getDrivingMode():
"arcade"|"simulation"|"custom"
Returns the named driving-mode category for the current coefficient.
Returns
Section titled “Returns”"arcade" | "simulation" | "custom"
Arcade at coefficient 1, simulation at 0, or custom for an intermediate value.
getRainIntensity()
Section titled “getRainIntensity()”getRainIntensity():
number
Returns the replicated rain-intensity override.
Returns
Section titled “Returns”number
A value from 0 to 100, or -1 when no override is active.
getTime()
Section titled “getTime()”getTime():
WorldTime
Returns the current replicated game time as clock components.
Returns
Section titled “Returns”The current hour and minute.
getTimeNormalized()
Section titled “getTimeNormalized()”getTimeNormalized():
number
Returns the current game time in the engine’s normalized representation.
Returns
Section titled “Returns”number
A value from 0 inclusive to 1 exclusive, where 0 is midnight and 0.5 is noon.
getTimeScale()
Section titled “getTimeScale()”getTimeScale():
number
Returns the current game-clock speed multiplier.
Returns
Section titled “Returns”number
The non-negative replicated time scale.
getTrafficEpoch()
Section titled “getTrafficEpoch()”getTrafficEpoch():
number
Returns the current replicated traffic-light epoch.
Returns
Section titled “Returns”number
The current traffic cycle counter.
getWeather()
Section titled “getWeather()”getWeather():
string
Returns the active replicated weather template.
Returns
Section titled “Returns”string
The configured template name, or an empty string when world state is unavailable.
policeDispatch()
Section titled “policeDispatch()”policeDispatch(
event,x?,y?,z?,range?):void
Broadcasts a police radio event globally or around a world-space position.
Parameters
Section titled “Parameters”string | number
Police radio event name or numeric event identifier.
number
Optional world-space X coordinate; all four location arguments must be supplied together.
number
Optional world-space Y coordinate.
number
Optional world-space Z coordinate.
range?
Section titled “range?”number
Optional dispatch radius around the supplied position.
Returns
Section titled “Returns”void
setDrivingMode()
Section titled “setDrivingMode()”setDrivingMode(
mode):void
Sets the replicated vehicle driving model.
Parameters
Section titled “Parameters”number | "arcade" | "simulation"
Arcade, simulation (or sim), or a custom arcade coefficient from 0 to 1; numeric values are clamped.
Returns
Section titled “Returns”void
setRainIntensity()
Section titled “setRainIntensity()”setRainIntensity(
value):void
Sets or disables the replicated rain-intensity override.
Parameters
Section titled “Parameters”number
Rain override from 0 to 100; a negative value disables the override.
Returns
Section titled “Returns”void
setTime()
Section titled “setTime()”setTime(
hour,minute?):void
Sets the replicated game time.
Parameters
Section titled “Parameters”number
Hour of day; the combined time is clamped to the valid 24-hour range.
minute?
Section titled “minute?”number
Minute of the hour; defaults to zero.
Returns
Section titled “Returns”void
setTimeScale()
Section titled “setTimeScale()”setTimeScale(
scale):void
Sets how quickly replicated game time advances.
Parameters
Section titled “Parameters”number
Game-clock speed multiplier; negative values are clamped to zero.
Returns
Section titled “Returns”void
setWeather()
Section titled “setWeather()”setWeather(
templateName):void
Sets the active replicated weather template.
Parameters
Section titled “Parameters”templateName
Section titled “templateName”string
Mafia II weather template name to replicate to clients.
Returns
Section titled “Returns”void
