Compare commits

...

5 Commits

Author SHA1 Message Date
Paramat e5a37543cc
Framed glasslike: Don't use cuboids to draw glass faces (#7828)
Previously, each glass face used drawAutoLightedCuboid() to draw a
flat cuboid. This also disallowed backface culling, making the
backface culling inconsistent with 'glasslike'.

Use code from 'glasslike' to draw glass faces using drawQuad().

Remove long-unknown top/bottom textures feature:
Makes the code simpler and cleaner.
Never documented, long-unknown and not of much use.
2018-11-15 18:45:44 +00:00
Ezhh 6b102ce51f Rename hasprivs command to haspriv (#7860) 2018-11-13 20:24:20 +01:00
ClobberXD 657a3d1e05 dlg_contentstore.lua: Various fixes and improvements (#7612)
Add missing 'core.formspec_escape' to 'get_screenshot'.
Add warning label when no packages fetched.
Internal name of the "Update" button was the same as "Install". Rename to 'update_'.
2018-11-13 02:26:59 +00:00
Paramat 85b01eacd2
Night sky: Fix brightness threshold for applying night colours (#7859)
Previously, 'time_brightness' never fell below the threshold so
night sky colours were not applied.

Increase the threshold value. But now also set it to a value less
sensitive to possible future small changes in 'time_brightness',
by setting it halfway between the 'time_brightness' values for
darkest night and first stage of dawn.
2018-11-12 22:25:35 +00:00
HybridDog 98ee08904b Enable subtle fall bobbing (#7856)
Set the default value of fall_bobbing_amount to 0.03
2018-11-12 19:34:47 +01:00
6 changed files with 69 additions and 51 deletions

View File

@ -106,28 +106,28 @@ core.register_chatcommand("privs", {
end,
})
core.register_chatcommand("hasprivs", {
core.register_chatcommand("haspriv", {
params = "<privilege>",
description = "Return list of all online players with privilege.",
privs = {basic_privs = true},
func = function(caller, param)
param = param:trim()
if param == "" then
return false, "Invalid parameters (see /help hasprivs)"
return false, "Invalid parameters (see /help haspriv)"
end
if not core.registered_privileges[param] then
return false, "Unknown privilege!"
end
local privs = core.string_to_privs(param)
local players_with_privs = {}
local players_with_priv = {}
for _, player in pairs(core.get_connected_players()) do
local player_name = player:get_player_name()
if core.check_player_privs(player_name, privs) then
table.insert(players_with_privs, player_name)
table.insert(players_with_priv, player_name)
end
end
return true, "Players online with the \"" .. param .. "\" priv: " ..
table.concat(players_with_privs, ", ")
return true, "Players online with the \"" .. param .. "\" privilege: " ..
table.concat(players_with_priv, ", ")
end
})

View File

@ -356,21 +356,29 @@ function store.get_formspec()
cur_page = 1
end
local formspec = {
"size[12,7;true]",
"position[0.5,0.55]",
"field[0.2,0.1;7.8,1;search_string;;", core.formspec_escape(search_string), "]",
"field_close_on_enter[search_string;false]",
"button[7.7,-0.2;2,1;search;", fgettext("Search"), "]",
"dropdown[9.7,-0.1;2.4;type;",
table.concat(filter_types_titles, ","),
";",
filter_type,
"]",
-- "textlist[0,1;2.4,5.6;a;",
-- table.concat(taglist, ","),
-- "]"
}
local formspec
if #store.packages ~= 0 then
formspec = {
"size[12,7;true]",
"position[0.5,0.55]",
"field[0.2,0.1;7.8,1;search_string;;",
core.formspec_escape(search_string), "]",
"field_close_on_enter[search_string;false]",
"button[7.7,-0.2;2,1;search;",
fgettext("Search"), "]",
"dropdown[9.7,-0.1;2.4;type;",
table.concat(filter_types_titles, ","),
";", filter_type, "]",
-- "textlist[0,1;2.4,5.6;a;",
-- table.concat(taglist, ","), "]",
}
else
formspec = {
"size[12,7;true]",
"position[0.5,0.55]",
"label[4,3;No packages could be retrieved]",
}
end
local start_idx = (cur_page - 1) * num_per_page + 1
for i=start_idx, math.min(#store.packages, start_idx+num_per_page-1) do
@ -381,7 +389,7 @@ function store.get_formspec()
-- image
formspec[#formspec + 1] = "image[-0.4,0;1.5,1;"
formspec[#formspec + 1] = get_screenshot(package)
formspec[#formspec + 1] = core.formspec_escape(get_screenshot(package))
formspec[#formspec + 1] = "]"
-- title
@ -404,7 +412,7 @@ function store.get_formspec()
formspec[#formspec + 1] = fgettext("Install")
formspec[#formspec + 1] = "]"
elseif package.installed_release < package.release then
formspec[#formspec + 1] = "button[8.4,0;1.5,1;install_"
formspec[#formspec + 1] = "button[8.4,0;1.5,1;update_"
formspec[#formspec + 1] = tostring(i)
formspec[#formspec + 1] = ";"
formspec[#formspec + 1] = fgettext("Update")

View File

@ -629,7 +629,7 @@ view_bobbing_amount (View bobbing factor) float 1.0
# Multiplier for fall bobbing.
# For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double.
fall_bobbing_amount (Fall bobbing factor) float 0.0
fall_bobbing_amount (Fall bobbing factor) float 0.03
# 3D support.
# Currently supported:

View File

@ -697,20 +697,12 @@ void MapblockMeshGenerator::drawGlasslikeFramedNode()
for (int face = 0; face < 6; face++)
getTile(g_6dirs[face], &tiles[face]);
if (!data->m_smooth_lighting)
color = encode_light(light, f->light_source);
TileSpec glass_tiles[6];
if (tiles[1].layers[0].texture &&
tiles[2].layers[0].texture &&
tiles[3].layers[0].texture) {
glass_tiles[0] = tiles[4];
glass_tiles[1] = tiles[2];
glass_tiles[2] = tiles[4];
glass_tiles[3] = tiles[4];
glass_tiles[4] = tiles[3];
glass_tiles[5] = tiles[4];
} else {
for (auto &glass_tile : glass_tiles)
glass_tile = tiles[4];
}
for (auto &glass_tile : glass_tiles)
glass_tile = tiles[4];
u8 param2 = n.getParam2();
bool H_merge = !(param2 & 128);
@ -735,14 +727,6 @@ void MapblockMeshGenerator::drawGlasslikeFramedNode()
aabb3f(-a, -a, -a, a, -b, -b), // z-
aabb3f(-a, b, -a, a, a, -b), // z-
};
static const aabb3f glass_faces[6] = {
aabb3f(-g, -g, g, g, g, g), // z+
aabb3f(-g, g, -g, g, g, g), // y+
aabb3f( g, -g, -g, g, g, g), // x+
aabb3f(-g, -g, -g, g, g, -g), // z-
aabb3f(-g, -g, -g, g, -g, g), // y-
aabb3f(-g, -g, -g, -g, g, g), // x-
};
// tables of neighbour (connect if same type and merge allowed),
// checked with g_26dirs
@ -800,8 +784,34 @@ void MapblockMeshGenerator::drawGlasslikeFramedNode()
for (int face = 0; face < 6; face++) {
if (nb[face])
continue;
tile = glass_tiles[face];
drawAutoLightedCuboid(glass_faces[face]);
// Face at Z-
v3f vertices[4] = {
v3f(-a, a, -g),
v3f( a, a, -g),
v3f( a, -a, -g),
v3f(-a, -a, -g),
};
for (v3f &vertex : vertices) {
switch (face) {
case D6D_ZP:
vertex.rotateXZBy(180); break;
case D6D_YP:
vertex.rotateYZBy( 90); break;
case D6D_XP:
vertex.rotateXZBy( 90); break;
case D6D_ZN:
vertex.rotateXZBy( 0); break;
case D6D_YN:
vertex.rotateYZBy(-90); break;
case D6D_XN:
vertex.rotateXZBy(-90); break;
}
}
v3s16 dir = g_6dirs[face];
drawQuad(vertices, dir);
}
// Optionally render internal liquid level defined by param2

View File

@ -176,7 +176,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("cinematic_camera_smoothing", "0.7");
settings->setDefault("enable_clouds", "true");
settings->setDefault("view_bobbing_amount", "1.0");
settings->setDefault("fall_bobbing_amount", "0.0");
settings->setDefault("fall_bobbing_amount", "0.03");
settings->setDefault("enable_3d_clouds", "true");
settings->setDefault("cloud_radius", "12");
settings->setDefault("menu_clouds", "true");

View File

@ -610,9 +610,9 @@ void Sky::update(float time_of_day, float time_brightness,
}
m_clouds_visible = true;
float color_change_fraction = 0.98;
float color_change_fraction = 0.98f;
if (sunlight_seen) {
if (is_dawn) { // Dawn
if (is_dawn) { // Dawn
m_bgcolor_bright_f = m_bgcolor_bright_f.getInterpolated(
bgcolor_bright_dawn_f, color_change_fraction);
m_skycolor_bright_f = m_skycolor_bright_f.getInterpolated(
@ -620,12 +620,12 @@ void Sky::update(float time_of_day, float time_brightness,
m_cloudcolor_bright_f = m_cloudcolor_bright_f.getInterpolated(
cloudcolor_bright_dawn_f, color_change_fraction);
} else {
if (time_brightness < 0.07) { // Night
if (time_brightness < 0.13f) { // Night
m_bgcolor_bright_f = m_bgcolor_bright_f.getInterpolated(
bgcolor_bright_night_f, color_change_fraction);
m_skycolor_bright_f = m_skycolor_bright_f.getInterpolated(
skycolor_bright_night_f, color_change_fraction);
} else { // Day
} else { // Day
m_bgcolor_bright_f = m_bgcolor_bright_f.getInterpolated(
bgcolor_bright_normal_f, color_change_fraction);
m_skycolor_bright_f = m_skycolor_bright_f.getInterpolated(