Skip to content

Commit

Permalink
[Lua API] Fixed crash.
Browse files Browse the repository at this point in the history
  • Loading branch information
Unarelith committed Apr 23, 2023
1 parent 2f973ab commit 5057e27
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 0 additions & 3 deletions mods/default/blocks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ mod:block {
hardness = 0,
draw_type = "leaves",
-- is_opaque = false, -- FIXME

item_drop = {},
}

mod:block {
Expand Down Expand Up @@ -181,7 +179,6 @@ mod:block {
color_multiplier = {129, 191, 91, 255},
hardness = 0,
draw_type = "xshape",
item_drop = {},
}

mod:block {
Expand Down
9 changes: 6 additions & 3 deletions source/server/lua/loader/LuaSkyLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ void LuaSkyLoader::loadSky(const sol::table &table) const {
sky.setFogColor(gk::Color::fromRGBA32(r, g, b, a));
}

if (sol::object obj = table["daylight_cycle"].get<sol::table>() ; obj.valid()) {
sol::table daylightCycleTable = obj.as<sol::table>();
sky.setDaylightCycleSpeed(daylightCycleTable["speed"].get_or(0.f));
if (table["daylight_cycle"].valid()) {
sol::object obj = table["daylight_cycle"].get<sol::table>();
if (obj.valid()) {
sol::table daylightCycleTable = obj.as<sol::table>();
sky.setDaylightCycleSpeed(daylightCycleTable["speed"].get_or(0.f));
}
}

loadObjects(sky, table);
Expand Down

0 comments on commit 5057e27

Please sign in to comment.