init.lua 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. --[[
  2. Minetest Ethereal Mod
  3. Created by ChinChow
  4. Updated by TenPlus1
  5. ]]
  6. ethereal = {version = "20221230"}
  7. local function setting(stype, name, default)
  8. local value
  9. if stype == "bool" then
  10. value = minetest.settings:get_bool("ethereal." .. name)
  11. elseif stype == "string" then
  12. value = minetest.settings:get("ethereal." .. name)
  13. elseif stype == "number" then
  14. value = tonumber(minetest.settings:get("ethereal." .. name))
  15. end
  16. if value == nil then
  17. value = default
  18. end
  19. ethereal[name] = value
  20. end
  21. -- DO NOT change settings below, use the settings.conf file instead
  22. setting("number", "leaftype", 0)
  23. setting("bool", "leafwalk", false)
  24. setting("bool", "cavedirt", true)
  25. setting("bool", "torchdrop", true)
  26. setting("bool", "papyruswalk", true)
  27. setting("bool", "lilywalk", true)
  28. setting("bool", "xcraft", true)
  29. setting("bool", "flight", true)
  30. setting("number", "glacier", 1)
  31. setting("number", "bamboo", 1)
  32. setting("number", "mesa", 1)
  33. setting("number", "alpine", 1)
  34. setting("number", "healing", 1)
  35. setting("number", "snowy", 1)
  36. setting("number", "frost", 1)
  37. setting("number", "grassy", 1)
  38. setting("number", "caves", 1)
  39. setting("number", "grayness", 1)
  40. setting("number", "grassytwo", 1)
  41. setting("number", "prairie", 1)
  42. setting("number", "jumble", 1)
  43. setting("number", "junglee", 1)
  44. setting("number", "desert", 1)
  45. setting("number", "grove", 1)
  46. setting("number", "mushroom", 1)
  47. setting("number", "sandstone", 1)
  48. setting("number", "quicksand", 1)
  49. setting("number", "plains", 1)
  50. setting("number", "savanna", 1)
  51. setting("number", "fiery", 1)
  52. setting("number", "sandclay", 1)
  53. setting("number", "swamp", 1)
  54. setting("number", "sealife", 1)
  55. setting("number", "reefs", 1)
  56. setting("number", "sakura", 1)
  57. setting("number", "tundra", 1)
  58. setting("number", "mediterranean", 1)
  59. local path = minetest.get_modpath("ethereal")
  60. -- Load settings.conf file if found
  61. local input = io.open(path.."/settings.conf", "r")
  62. if input then
  63. dofile(path .. "/settings.conf")
  64. input:close()
  65. input = nil
  66. end
  67. -- Intllib
  68. local S
  69. if minetest.get_translator then
  70. S = minetest.get_translator("ethereal")
  71. elseif minetest.global_exists("intllib") then
  72. if intllib.make_gettext_pair then
  73. S = intllib.make_gettext_pair()
  74. else
  75. S = intllib.Getter()
  76. end
  77. else
  78. S = function(s) return s end
  79. end
  80. ethereal.intllib = S
  81. -- Falling node function
  82. ethereal.check_falling = minetest.check_for_falling or nodeupdate
  83. -- creative check
  84. local creative_mode_cache = minetest.settings:get_bool("creative_mode")
  85. function ethereal.check_creative(name)
  86. return creative_mode_cache or minetest.check_player_privs(name, {creative = true})
  87. end
  88. dofile(path .. "/plantlife.lua")
  89. dofile(path .. "/onion.lua")
  90. dofile(path .. "/crystal.lua")
  91. dofile(path .. "/water.lua")
  92. dofile(path .. "/dirt.lua")
  93. dofile(path .. "/food.lua")
  94. dofile(path .. "/wood.lua")
  95. dofile(path .. "/leaves.lua")
  96. dofile(path .. "/sapling.lua")
  97. dofile(path .. "/strawberry.lua")
  98. dofile(path .. "/fishing.lua")
  99. dofile(path .. "/extra.lua")
  100. dofile(path .. "/sealife.lua")
  101. dofile(path .. "/fences.lua")
  102. if minetest.settings:get_bool("ethereal.clear_default_biomes", true) then
  103. dofile(path .. "/biomes_init.lua")
  104. end
  105. dofile(path .. "/biomes.lua")
  106. dofile(path .. "/ores.lua")
  107. dofile(path .. "/schems.lua")
  108. dofile(path .. "/decor.lua")
  109. dofile(path .. "/compatibility.lua")
  110. dofile(path .. "/stairs.lua")
  111. -- add flight if enabled
  112. if ethereal.flight then
  113. dofile(path .. "/flight.lua")
  114. end
  115. -- add lucky blocks if mod active
  116. if minetest.get_modpath("lucky_block") then
  117. dofile(path .. "/lucky_block.lua")
  118. end
  119. -- Set bonemeal aliases
  120. if minetest.get_modpath("bonemeal") then
  121. minetest.register_alias("ethereal:bone", "bonemeal:bone")
  122. minetest.register_alias("ethereal:bonemeal", "bonemeal:bonemeal")
  123. else -- or return to where it came from
  124. minetest.register_alias("ethereal:bone", "default:dirt")
  125. minetest.register_alias("ethereal:bonemeal", "default:dirt")
  126. end
  127. if minetest.get_modpath("xanadu") then
  128. dofile(path .. "/plantpack.lua")
  129. end
  130. print ("[MOD] Ethereal loaded")