diff --git a/mods/nc_player_yctiwy/init.lua b/mods/nc_player_yctiwy/init.lua index 31efc194..f977a8c5 100644 --- a/mods/nc_player_yctiwy/init.lua +++ b/mods/nc_player_yctiwy/init.lua @@ -3,8 +3,8 @@ local ItemStack, math, minetest, next, nodecore, pairs, string, table, vector = ItemStack, math, minetest, next, nodecore, pairs, string, table, vector -local math_pi, math_random, string_format, table_concat - = math.pi, math.random, string.format, table.concat +local math_floor, math_pi, math_random, string_format, table_concat + = math.floor, math.pi, math.random, string.format, table.concat -- LUALOCALS > --------------------------------------------------------- nodecore.amcoremod() @@ -34,6 +34,16 @@ local hidden = nodecore.setting_bool( case the entities are later reenabled.]] ) or disabled +local halflife = nodecore.setting_float( + "nc_yctiwy_halflife", + 30, + "Half-life of marker decay", + [[YCTIWY markers show visible "decay" as players are + continuously offline for long periods of time. This is + the number of days that it takes for half of the + remaining color to bleed out of the marker.]] +) * 86400 + ------------------------------------------------------------------------ -- DATABASE @@ -290,7 +300,12 @@ local function markertexture(pname) colors[i] = string_format("(%s_marker_%d.png^[multiply:%s)", modname, i, colors[i]) end - return table_concat(colors, "^") + local age = minetest.get_gametime() - (db[pname] or {seen = 0}).seen + local decay = math_floor(240 * (1 - 0.5 ^ (age / halflife))) + print(string_format("%s age=%d decay=%d", pname, age, decay)) + return string_format("%s^(%s_marker_1.png^%s_marker_2.png^%s_marker_3.png" + .. "^[multiply:#a0a0a0^[opacity:%d)", + table_concat(colors, "^"), modname, modname, modname, decay) end minetest.register_entity(modname .. ":marker", { diff --git a/mods/nc_player_yctiwy/textures/nc_player_yctiwy_marker_1.png b/mods/nc_player_yctiwy/textures/nc_player_yctiwy_marker_1.png index 18757849..cb8ba3e1 100644 Binary files a/mods/nc_player_yctiwy/textures/nc_player_yctiwy_marker_1.png and b/mods/nc_player_yctiwy/textures/nc_player_yctiwy_marker_1.png differ diff --git a/mods/nc_player_yctiwy/textures/nc_player_yctiwy_marker_2.png b/mods/nc_player_yctiwy/textures/nc_player_yctiwy_marker_2.png index 5ed248ce..2a232a9b 100644 Binary files a/mods/nc_player_yctiwy/textures/nc_player_yctiwy_marker_2.png and b/mods/nc_player_yctiwy/textures/nc_player_yctiwy_marker_2.png differ diff --git a/mods/nc_player_yctiwy/textures/nc_player_yctiwy_marker_3.png b/mods/nc_player_yctiwy/textures/nc_player_yctiwy_marker_3.png index ffbadc61..e90a7aa3 100644 Binary files a/mods/nc_player_yctiwy/textures/nc_player_yctiwy_marker_3.png and b/mods/nc_player_yctiwy/textures/nc_player_yctiwy_marker_3.png differ