ethereal/init.lua

176 lines
4.3 KiB
Lua
Raw Permalink Normal View History

2019-03-14 00:05:35 +03:00
--[[
Minetest Ethereal Mod
Created by ChinChow
Updated by TenPlus1
]]
-- global
2022-04-05 10:27:51 +03:00
2024-10-14 12:06:17 +03:00
ethereal = {version = "20241014"}
2022-04-05 10:27:51 +03:00
-- setting helper
2022-04-05 10:27:51 +03:00
local function setting(stype, name, default)
local value
if stype == "bool" then
value = minetest.settings:get_bool("ethereal." .. name)
elseif stype == "string" then
value = minetest.settings:get("ethereal." .. name)
elseif stype == "number" then
value = tonumber(minetest.settings:get("ethereal." .. name))
end
if value == nil then value = default end
2022-04-05 10:27:51 +03:00
ethereal[name] = value
end
-- DO NOT change settings below, use the settings.conf file instead
setting("number", "leaftype", 0)
setting("bool", "leafwalk", false)
setting("bool", "cavedirt", true)
setting("bool", "torchdrop", true)
setting("bool", "papyruswalk", true)
setting("bool", "lilywalk", true)
setting("bool", "xcraft", true)
setting("bool", "flight", true)
setting("number", "glacier", 1)
setting("number", "bamboo", 1)
setting("number", "mesa", 1)
2024-10-14 12:06:17 +03:00
setting("number", "alpine", 1)--taiga
setting("number", "snowy", 1)--coniferous_forest
2022-04-05 10:27:51 +03:00
setting("number", "frost", 1)
2024-10-14 12:06:17 +03:00
setting("number", "grassy", 1)--deciduous_forest
2022-04-05 10:27:51 +03:00
setting("number", "caves", 1)
setting("number", "grayness", 1)
setting("number", "grassytwo", 1)
setting("number", "prairie", 1)
setting("number", "jumble", 1)
2024-10-14 12:06:17 +03:00
setting("number", "junglee", 1)--rainforest
2022-04-05 10:27:51 +03:00
setting("number", "desert", 1)
setting("number", "grove", 1)
setting("number", "mushroom", 1)
2024-10-14 12:06:17 +03:00
setting("number", "sandstone", 1)--sandstone_desert
2022-04-05 10:27:51 +03:00
setting("number", "plains", 1)
setting("number", "savanna", 1)
setting("number", "fiery", 1)
setting("number", "swamp", 1)
2024-10-14 12:06:17 +03:00
setting("number", "quicksand", 1)--swamp quicksand
2022-04-05 10:27:51 +03:00
setting("number", "tundra", 1)
setting("number", "mediterranean", 1)
2024-10-14 12:06:17 +03:00
setting("number", "cold_desert", 1)
setting("number", "snowy_grassland", 1)
setting("number", "sealife", 1)
setting("number", "reefs", 1)
setting("number", "logs", 1)
setting("bool", "wood_rotate", true)
2022-04-05 10:27:51 +03:00
2019-03-14 00:05:35 +03:00
local path = minetest.get_modpath("ethereal")
2024-10-14 12:06:17 +03:00
-- Load settings.conf file if found [DEPRECATED]
2019-03-14 00:05:35 +03:00
local input = io.open(path.."/settings.conf", "r")
2019-03-14 00:05:35 +03:00
if input then
dofile(path .. "/settings.conf") ; input:close() ; input = nil
2019-03-14 00:05:35 +03:00
end
-- Falling node function
2019-03-14 00:05:35 +03:00
ethereal.check_falling = minetest.check_for_falling or nodeupdate
-- creative check
2019-03-14 00:05:35 +03:00
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
2019-03-14 00:05:35 +03:00
function ethereal.check_creative(name)
return creative_mode_cache or minetest.check_player_privs(name, {creative = true})
end
2024-07-26 18:54:52 +03:00
-- helper function to add {eatable} group to food items
2024-07-26 18:54:52 +03:00
function ethereal.add_eatable(item, hp)
local def = minetest.registered_items[item]
if def then
2024-07-27 20:27:41 +03:00
local groups = table.copy(def.groups) or {}
2024-07-26 18:54:52 +03:00
2024-07-27 20:27:41 +03:00
groups.eatable = hp ; groups.flammable = 2
2024-07-26 18:54:52 +03:00
2024-08-04 01:56:53 +03:00
minetest.override_item(item, {groups = groups})
2024-07-26 18:54:52 +03:00
end
end
-- strawberry check and load
if minetest.get_modpath("farming") and farming.mod and farming.mod == "redo" then
-- farming redo already has strawberry included
else
dofile(path .. "/strawberry.lua")
end
-- load mod sections
2019-03-14 00:05:35 +03:00
dofile(path .. "/plantlife.lua")
dofile(path .. "/onion.lua")
dofile(path .. "/crystal.lua")
dofile(path .. "/water.lua")
dofile(path .. "/dirt.lua")
dofile(path .. "/food.lua")
dofile(path .. "/wood.lua")
dofile(path .. "/leaves.lua")
dofile(path .. "/sapling.lua")
dofile(path .. "/fishing.lua")
dofile(path .. "/extra.lua")
dofile(path .. "/sealife.lua")
dofile(path .. "/fences.lua")
if minetest.settings:get_bool("ethereal.clear_default_biomes", true) then
dofile(path .. "/biomes_init.lua")
end
2020-05-28 16:20:31 +03:00
dofile(path .. "/biomes.lua")
dofile(path .. "/ores.lua")
dofile(path .. "/schems.lua")
2020-05-28 16:20:31 +03:00
dofile(path .. "/decor.lua")
2019-03-14 00:05:35 +03:00
dofile(path .. "/compatibility.lua")
dofile(path .. "/stairs.lua")
-- add flight if enabled
2021-02-10 15:08:46 +03:00
if ethereal.flight then
dofile(path .. "/flight.lua")
end
-- add lucky blocks if mod active
if minetest.get_modpath("lucky_block") then
dofile(path .. "/lucky_block.lua")
end
2019-03-14 00:05:35 +03:00
-- Set bonemeal aliases
2019-03-14 00:05:35 +03:00
if minetest.get_modpath("bonemeal") then
minetest.register_alias("ethereal:bone", "bonemeal:bone")
minetest.register_alias("ethereal:bonemeal", "bonemeal:bonemeal")
else -- or return to where it came from
minetest.register_alias("ethereal:bone", "default:dirt")
minetest.register_alias("ethereal:bonemeal", "default:dirt")
end
2024-09-09 14:08:56 +03:00
-- ambience lite
if minetest.get_modpath("ambience") then
dofile(path .. "/ambience.lua")
end
2021-10-29 09:41:32 +03:00
print ("[MOD] Ethereal loaded")