Environment

CLIENT SIDE ONLY

Small selection of environment related functions.

Functions

get_game_time

Retrieves the current game time and a formatted version.

--- Utils object
local time_data = utils.environment.get_game_time()

print('Time:',  time_data.time)
print('Formatted Time:', time_data.formatted)

--- Direct export
local time_data = exports.boii_utils:get_game_time()

get_game_date

Retrieves games current data and a formatted version.

--- Utils object
local date_data = utils.environment.get_game_date()

print('Current Date:',  date_data.time)
print('Formatted Date:', date_data.formatted)

--- Direct export
local date_data = exports.boii_utils:get_game_date()

get_sunrise_sunset_times

Retrieves sunrise and sunset times based on weather type. These are entirely fictional, you can adjust the time values to whatever you like.

--- Define weather type
local weather = 'CLEAR'

--- Utils object
local times = utils.environment.get_sunrise_sunset_times(weather)
print('Sunrise:', times.sunrise, 'Sunset:', times.sunset)

--- Direct export
exports.boii_utils:get_sunrise_sunset_times(weather)

is_daytime

Checks if current time is considered day time.

--- Utils object
local is_daytime = utils.environment.is_daytime()

print('Is Daytime:', tostring(is_daytime))

--- Direct export
local is_daytime = exports.boii_utils:is_daytime()

get_current_season

Retrieves current season.

--- Utils object
local season = utils.environment.get_current_season()

--- Direct export
local season = exports.boii_utils:get_current_season()

get_distance_to_water

Get the distance from the player to the nearest body of water.

--- Utils object
local distance_to_water = utils.environment.get_distance_to_water()

if distance_to_water >= 0 then
    print('Distance to water:', distance_to_water)
else
    print('No water nearby.')
end

--- Direct export
local distance_to_water = exports.boii_utils:get_distance_to_water()

get_water_height_at_coords

Gets water height at specified coordinates.

--- Define coords
local coords = vector3(123.45, 678.90, 21.0)

---  Utils object
local water_height = utils.environment.get_water_height_at_coords(coords)

if water_height >= 0 then
    print('Water height at coordinates:', water_height)
else
    print('No water found at the given coordinates.')
end

--- Direct export
local water_height = exports.boii_utils:get_water_height_at_coords(coords)

get_environment_details

Retrieves comprehensive environment details.

--- Utils object
local env_details = utils.environment.get_environment_details()

print('Weather:', env_details.weather)
print('Time:', env_details.time.formatted)
print('Date:', env_details.date.formatted)
print('Season:', env_details.season)
print('Wind Speed:', env_details.wind_speed)
print('Wind Direction:', env_details.wind_direction)
print('Sunrise:', env_details.sunrise_sunset.sunrise)
print('Sunset:', env_details.sunrise_sunset.sunset)
print('Daytime:', env_details.is_daytime and 'Yes' or 'No')
print('Distance to water:', env_details.distance_to_water)

--- Direct export
local env_details = exports.boii_utils:get_environment_details()

Last updated