default_settings.lua 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. -- (Hardcoded) default settings
  2. hb.settings.max_bar_length = 160
  3. hb.settings.statbar_length = 20
  4. -- Statbar positions
  5. hb.settings.pos_left = {}
  6. hb.settings.pos_right = {}
  7. hb.settings.start_offset_left = {}
  8. hb.settings.start_offset_right= {}
  9. hb.settings.pos_left.x = hb.load_setting("hudbars_pos_left_x", "number", 0.5)
  10. hb.settings.pos_left.y = hb.load_setting("hudbars_pos_left_y", "number", 1)
  11. hb.settings.pos_right.x = hb.load_setting("hudbars_pos_right_x", "number", 0.5)
  12. hb.settings.pos_right.y = hb.load_setting("hudbars_pos_right_y", "number", 1)
  13. hb.settings.bar_type = hb.load_setting("hudbars_bar_type", "string", "progress_bar", {"progress_bar", "statbar_classic", "statbar_modern"})
  14. if hb.settings.bar_type == "progress_bar" then
  15. hb.settings.start_offset_left.x = hb.load_setting("hudbars_start_offset_left_x", "number", -175)
  16. hb.settings.start_offset_left.y = hb.load_setting("hudbars_start_offset_left_y", "number", -86)
  17. hb.settings.start_offset_right.x = hb.load_setting("hudbars_start_offset_right_x", "number", 15)
  18. hb.settings.start_offset_right.y = hb.load_setting("hudbars_start_offset_right_y", "number", -86)
  19. else
  20. hb.settings.start_offset_left.x = hb.load_setting("hudbars_start_statbar_offset_left_x", "number", -265)
  21. hb.settings.start_offset_left.y = hb.load_setting("hudbars_start_statbar_offset_left_y", "number", -90)
  22. hb.settings.start_offset_right.x = hb.load_setting("hudbars_start_statbar_offset_right_x", "number", 25)
  23. hb.settings.start_offset_right.y = hb.load_setting("hudbars_start_statbar_offset_right_y", "number", -90)
  24. end
  25. hb.settings.vmargin = hb.load_setting("hudbars_vmargin", "number", 24)
  26. hb.settings.tick = hb.load_setting("hudbars_tick", "number", 0.1)
  27. -- Experimental setting: Changing this setting is not officially supported, do NOT rely on it!
  28. hb.settings.forceload_default_hudbars = hb.load_setting("hudbars_forceload_default_hudbars", "bool", true)
  29. -- Misc. settings
  30. hb.settings.alignment_pattern = hb.load_setting("hudbars_alignment_pattern", "string", "zigzag", {"zigzag", "stack_up", "stack_down"})
  31. hb.settings.autohide_breath = hb.load_setting("hudbars_autohide_breath", "bool", true)
  32. local sorting = minetest.settings:get("hudbars_sorting")
  33. if sorting ~= nil then
  34. hb.settings.sorting = {}
  35. hb.settings.sorting_reverse = {}
  36. for k,v in string.gmatch(sorting, "(%w+)=(%w+)") do
  37. hb.settings.sorting[k] = tonumber(v)
  38. hb.settings.sorting_reverse[tonumber(v)] = k
  39. end
  40. else
  41. hb.settings.sorting = { ["health"] = 0, ["breath"] = 1 }
  42. hb.settings.sorting_reverse = { [0] = "health", [1] = "breath" }
  43. end