mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 03:21:49 +00:00
libworld: expose WorldInfo::fog value to lua
This commit is contained in:
parent
76fc7b5fb4
commit
803981e2a8
3 changed files with 23 additions and 0 deletions
|
|
@ -16,6 +16,12 @@ world.get_day_time() -> number
|
|||
-- Set day time value.
|
||||
world.set_day_time(time: number)
|
||||
|
||||
-- Returns current fog value.
|
||||
world.get_fog() -> number
|
||||
|
||||
-- Set fog value.
|
||||
world.set_fog(value: number)
|
||||
|
||||
-- Sets the specified day time cycle speed.
|
||||
world.set_day_time_speed(value: number)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,12 @@ world.get_day_time() -> number
|
|||
-- Устанавливает указанное игровое время.
|
||||
world.set_day_time(time: number)
|
||||
|
||||
-- Возвращает текущее значение тумана.
|
||||
world.get_fog() -> number
|
||||
|
||||
-- Устанавливает указанное значение тумана.
|
||||
world.set_fog(value: number)
|
||||
|
||||
-- Устанавливает указанную скорость смены времени суток.
|
||||
world.set_day_time_speed(value: number)
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,15 @@ static int l_set_day_time(lua::State* L) {
|
|||
require_world_info().daytime = std::fmod(value, 1.0);
|
||||
return 0;
|
||||
}
|
||||
static int l_get_fog(lua::State* L) {
|
||||
return lua::pushnumber(L, require_world_info().fog);
|
||||
}
|
||||
|
||||
static int l_set_fog(lua::State* L) {
|
||||
auto value = lua::tonumber(L, 1);
|
||||
require_world_info().fog = std::fmod(value, 1.0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_set_day_time_speed(lua::State* L) {
|
||||
auto value = lua::tonumber(L, 1);
|
||||
|
|
@ -102,6 +111,8 @@ const luaL_Reg worldlib[] = {
|
|||
{"get_total_time", lua::wrap<l_get_total_time>},
|
||||
{"get_day_time", lua::wrap<l_get_day_time>},
|
||||
{"set_day_time", lua::wrap<l_set_day_time>},
|
||||
{"get_fog", lua::wrap<l_get_fog>},
|
||||
{"set_fog", lua::wrap<l_set_fog>},
|
||||
{"set_day_time_speed", lua::wrap<l_set_day_time_speed>},
|
||||
{"get_day_time_speed", lua::wrap<l_get_day_time_speed>},
|
||||
{"get_seed", lua::wrap<l_get_seed>},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue