diff --git a/free_space.lua b/free_space.lua index a42e3ba..c12254b 100644 --- a/free_space.lua +++ b/free_space.lua @@ -14,8 +14,8 @@ function inotify.render_inv(player, pos, off, align, scaler) end end local space_max = inv:get_size("main") - -- = Form free space percent - local perc = (empty / space_max) * 100 + -- = Form free space percent (Change it so instead of tracking empty track used percent) + local perc = math.abs(((empty / space_max) * 100) - 100) -- 3% used rather than 3% free -- = Check if in the health tracker, check if needing update to HUD local dirty = true -- Assume we do need to update if inotify.free_space[pname] ~= nil then @@ -31,15 +31,15 @@ function inotify.render_inv(player, pos, off, align, scaler) if inotify.free_space_hud[pname] == nil then local color = inotify.colors.white if perc <= 25 then - color = inotify.colors.red + color = inotify.colors.green elseif perc <= 50 and perc > 25 then - color = inotify.colors.orange + color = inotify.colors.dark_green elseif perc <= 75 and perc > 50 then color = inotify.colors.yellow elseif perc <= 95 and perc > 75 then - color = inotify.colors.dark_green + color = inotify.colors.orange elseif perc > 95 then - color = inotify.colors.green + color = inotify.colors.red end inotify.free_space_hud[pname] = player:hud_add({ hud_elem_type = "text", @@ -55,15 +55,15 @@ function inotify.render_inv(player, pos, off, align, scaler) player:hud_change(inotify.free_space_hud[pname], "text", ""..inotify.free_space[pname].."/"..inv:get_size("main").." "..string.format("%.0f", perc).."%") local color = inotify.colors.white if perc <= 25 then - color = inotify.colors.red + color = inotify.colors.green elseif perc <= 50 and perc > 25 then - color = inotify.colors.orange + color = inotify.colors.dark_green elseif perc <= 75 and perc > 50 then color = inotify.colors.yellow elseif perc <= 95 and perc > 75 then - color = inotify.colors.dark_green + color = inotify.colors.orange elseif perc > 95 then - color = inotify.colors.green + color = inotify.colors.red end player:hud_change(inotify.free_space_hud[pname], "number", color) end diff --git a/health.lua b/health.lua index 9277c6d..506c4b3 100644 --- a/health.lua +++ b/health.lua @@ -9,7 +9,7 @@ function inotify.render_health(player, pos, off, align, scaler) local hp = player:get_hp() local hp_max = player:get_properties().hp_max -- = Form HP percent - local hp_perc = (hp / hp_max) * 100 + local hp_perc = ((hp / hp_max) * 100) -- = Check if in the health tracker, check if needing update to HUD local dirty = true -- Assume we do need to update if inotify.health[pname] ~= nil then @@ -46,7 +46,7 @@ function inotify.render_health(player, pos, off, align, scaler) }) else if dirty then - player:hud_change(inotify.health_hud[pname], "text", "HP: "..string.format("%.0f", hp_perc).."%") + --player:hud_change(inotify.health_hud[pname], "text", "HP: "..string.format("%.0f", hp_perc).."%") local color = inotify.colors.white if hp_perc <= 25 then color = inotify.colors.red diff --git a/init.lua b/init.lua index d498a8a..14bc4b6 100644 --- a/init.lua +++ b/init.lua @@ -3,7 +3,7 @@ inotify = {} --inotify.store = minetest.get_mod_storage() -- Settings -inotify.interval_rate = 3 +inotify.interval_rate = 0 inotify.include_day_count = true -- Colors, HEX, and RGB @@ -63,6 +63,7 @@ minetest.register_globalstep(function(dtime) end -- Update time per second for _, player in ipairs(minetest.get_connected_players()) do + inotify.render_worldt( player, {x=0.15, y=0.85}, diff --git a/world_time.lua b/world_time.lua index 3ca956c..eebfa83 100644 --- a/world_time.lua +++ b/world_time.lua @@ -3,8 +3,8 @@ inotify.worldt_hud = {} function inotify.get_mi(hour) hr = tonumber(hour) - if hr >= 0 and hr <= 11 then return 'am' end -- midnight->noon - if hr >= 12 and hr <= 23 then return 'pm' end -- noon->midnight + if hr >= 0 and hr <= 11 then return 'AM' end -- midnight->noon + if hr >= 12 and hr <= 23 then return 'PM' end -- noon->midnight minetest.log("warning", "Could not get mi from "..tostring(hour)) end @@ -28,6 +28,7 @@ function inotify.render_worldt(player, posi, off, align, scaler) --minetest.log("action", time_stamp) if inotify.worldt_hud[pname] == nil then + -- Change the color based on the time (I really want it to "follow" the time of day, if it's bright or dark) local cl = inotify.colors.green -- Daytime == bright if mi == "am" then -- Nighttime == dark cl = inotify.colors.dark_green @@ -43,7 +44,7 @@ function inotify.render_worldt(player, posi, off, align, scaler) }) else local cl = inotify.colors.green - if mi == "am" then + if mi == "AM" then cl = inotify.colors.dark_green end player:hud_change(