Skip to main content
Version: latest - a1.19.x βš–οΈ

🌍 World

Interaction with World and Environment elements.

πŸ’‚Authority
This static class can be accessed only on 🟧 Client.
πŸ—ΏStatic Class
This is a Static Class. You can access it's methods directly with .. It is not possible to initialize or create new instances.

πŸŽ’ Examples​

Client/Index.lua
-- Overrides default Sun
World.SpawnDefaultSun()

-- Sets time
World.SetTime(9, 30)

-- Sets static speed
World.SetSunSpeed(0)

More related examples:

Interacting with the Suncore-concepts/scripting/interacting-with-the-sun

πŸ—Ώ Static Functions​

ReturnsNameDescription
LoadStreamLevelLoads a Level in runtime
UnloadStreamLevelUnloads a Level in runtime
SetStreamLevelVisibilitySets a Stream Level visibility
SetFogDensity
SetFogHeightFalloff
SetFogHeightOffset
SetSunLightColor
SetSkyLightIntensity
SetskyRayleighScattering
SetSunLightIntensity
SetSunTemperatureMultiplier
SetPPBloomSet Post Process Bloom Settings
SetPPChromaticAberrationSet Post Process Chromatic Abberation Settings
SetPPImageEffectsSet Post Process Image Effect Settings
SetPPFilmSet Post Process Film Settings
SetPPGlobalSaturationSet Post Process Saturation Colors. Use Alpha for everall Saturation intensity
SetPPMaterialSets a Post Process Material
RemovePPMaterialRemoves the current Post Process Material
SetSunAngleSets the sun's angle (0-360)
SetSunSpeedSets the sun's time speed(default: '60', which means 60 seconds in game = 1 second in real world)
SetTimeSets the Global time of the day
SetWeatherSets the global Predefined Weather (Clear, Rain, Cloudy, Thunderstorm)
SpawnDefaultSunDestroys all Light/Sun Actors and spawns the nanos world's official one, to be able to use the functions from this page
DestroySunDestroys all Directional Lights, Sky Lights and Actors with the **Sun** Actor Tag
SetWindSets the global Wind intensity
number GetSunAngle
number GetSunSpeed
table GetTime
WeatherTypeGetWeather
number GetWind

LoadStreamLevel​

Loads a Level in runtime
World.LoadStreamLevel(level_name, should_block_on_load?, make_visible_after_load?)
TypeParameterDefaultDescription
string level_name
boolean should_block_on_load?falseIf this should be a blocking operation - the game will freeze
boolean make_visible_after_load?trueIf this should be visible automatically after loaded

UnloadStreamLevel​

Unloads a Level in runtime
World.UnloadStreamLevel(level_name, should_block_on_unload?)
TypeParameterDefaultDescription
string level_name
boolean should_block_on_unload?falseIf this should be a blocking operation - the game will freeze

SetStreamLevelVisibility​

Sets a Stream Level visibility
World.SetStreamLevelVisibility(level_name, visibility)
TypeParameterDefaultDescription
string level_name
boolean visibilityIf this level should be visible

SetFogDensity​

World.SetFogDensity(density, second_density?)
TypeParameterDefaultDescription
number density
number second_density?0

SetFogHeightFalloff​

World.SetFogHeightFalloff(falloff)
TypeParameterDefaultDescription
number falloff

SetFogHeightOffset​

World.SetFogHeightOffset(offset)
TypeParameterDefaultDescription
number offset

SetSunLightColor​

World.SetSunLightColor(color)
TypeParameterDefaultDescription
Color color

SetSkyLightIntensity​

World.SetSkyLightIntensity(intensity)
TypeParameterDefaultDescription
number intensity

SetskyRayleighScattering​

World.SetskyRayleighScattering(color)
TypeParameterDefaultDescription
Color color

SetSunLightIntensity​

World.SetSunLightIntensity(intensity)
TypeParameterDefaultDescription
number intensity

SetSunTemperatureMultiplier​

World.SetSunTemperatureMultiplier(multiplier)
TypeParameterDefaultDescription
number multiplier

SetPPBloom​

Set Post Process Bloom Settings
World.SetPPBloom(intensity?, threshold?)
TypeParameterDefaultDescription
number intensity?0.675
number threshold?-1

SetPPChromaticAberration​

Set Post Process Chromatic Abberation Settings
World.SetPPChromaticAberration(intensity?, start_offset?)
TypeParameterDefaultDescription
number intensity?0
number start_offset?0

SetPPImageEffects​

Set Post Process Image Effect Settings
World.SetPPImageEffects(vignette_intensity?, grain_jitter?, grain_intensity?)
TypeParameterDefaultDescription
number vignette_intensity?0.6
number grain_jitter?0
number grain_intensity?0

SetPPFilm​

Set Post Process Film Settings
World.SetPPFilm(slope?, toe?, shoulder?, black_clip?, white_clip?)
TypeParameterDefaultDescription
number slope?0.8
number toe?0.55
number shoulder?0.26
number black_clip?0
number white_clip?0.3

SetPPGlobalSaturation​

Set Post Process Saturation Colors. Use Alpha for everall Saturation intensity
World.SetPPGlobalSaturation(color)
TypeParameterDefaultDescription
Color color

SetPPMaterial​

Sets a Post Process Material
World.SetPPMaterial(material_path)
TypeParameterDefaultDescription
Material Reference material_pathThe Material Asset to set as Post Process

RemovePPMaterial​

Removes the current Post Process Material
World.RemovePPMaterial()

SetSunAngle​

Sets the sun's angle (0-360)
World.SetSunAngle(angle)
TypeParameterDefaultDescription
number angle

SetSunSpeed​

Sets the sun's time speed(default: '60', which means 60 seconds in game = 1 second in real world)
World.SetSunSpeed(speed)
TypeParameterDefaultDescription
number speed

SetTime​

Sets the Global time of the day
World.SetTime(hours, minutes)
TypeParameterDefaultDescription
number hours
number minutes

SetWeather​

Sets the global Predefined Weather (Clear, Rain, Cloudy, Thunderstorm)
World.SetWeather(weather)
TypeParameterDefaultDescription
WeatherTypeweather

SpawnDefaultSun​

Destroys all Directional Lights, Sky Lights and Actors with the **Sun** Actor Tag, and spawns nanos world's official Sun Blueprint, to be able to use the functions from this page
World.SpawnDefaultSun()

DestroySun​

Destroys all Directional Lights, Sky Lights and Actors with the **Sun** Actor Tag
World.DestroySun()

SetWind​

Sets the global Wind intensity
World.SetWind(intensity)
TypeParameterDefaultDescription
number intensity

GetSunAngle​



Returns number ()
local ret = World.GetSunAngle()

GetSunSpeed​



Returns number ()
local ret = World.GetSunSpeed()

GetTime​



Returns table (in the format { Hours: number, Minutes: number })
local ret = World.GetTime()

GetWeather​



Returns WeatherType ()
local ret = World.GetWeather()

GetWind​



Returns number ()
local ret = World.GetWind()

πŸš€ Events​

NameDescription
StreamLevelLoadedCalled when a Stream Level is loaded
StreamLevelUnloadedCalled when a Stream Level is unloaded

StreamLevelLoaded​

Called when a Stream Level is loaded
World.Subscribe("StreamLevelLoaded", function(level_name)

end)
TypeArgumentDescription
string level_name

StreamLevelUnloaded​

Called when a Stream Level is unloaded
World.Subscribe("StreamLevelUnloaded", function(level_name)

end)
TypeArgumentDescription
string level_name