1
0
Fork 0

adding mapgen spring clay. Mineclone2 and Mineclone5 both need to accept pull requests fixing bugs before this will work

mineclone_compatibility
FaceDeer 2022-08-29 01:06:53 -06:00
parent afa69ca58b
commit 4f5b6f907c
5 changed files with 61 additions and 21 deletions

View File

@ -53,33 +53,18 @@ end
-- Springs
-----------------------------------------------------------------------------------------------------------------------
local function deep_copy(table_in)
local table_out = {}
for index, value in pairs(table_in) do
if type(value) == "table" then
table_out[index] = deep_copy(value)
else
table_out[index] = value
end
end
return table_out
end
local duplicate_def = function (name)
local old_def = minetest.registered_nodes[name]
return deep_copy(old_def)
end
-- register damp clay whether we're going to set the ABM or not, if the user disables this feature we don't want existing
-- spring clay to turn into unknown nodes.
local clay_def = duplicate_def("default:clay")
local clay_def = dynamic_liquid.duplicate_def("default:clay")
clay_def.description = S("Damp Clay")
if not springs then
clay_def.groups.not_in_creative_inventory = 1 -- take it out of creative inventory though
end
minetest.register_node("dynamic_liquid:clay", clay_def)
local data = {}
local data = dynamic_liquid.mapgen_data
if springs then
local c_clay = minetest.get_content_id("default:clay")

View File

@ -21,6 +21,26 @@ dynamic_liquid.config.falling_obsidian = minetest.settings:get_bool("dynamic_liq
dynamic_liquid.registered_liquids = {} -- used by the flow-through node abm
dynamic_liquid.registered_liquid_neighbors = {}
dynamic_liquid.mapgen_data = {} -- shared by various mapgens
local function deep_copy(table_in)
local table_out = {}
for index, value in pairs(table_in) do
if type(value) == "table" then
table_out[index] = deep_copy(value)
else
table_out[index] = value
end
end
return table_out
end
-- utility function used when making clay into springs
dynamic_liquid.duplicate_def = function (name)
local old_def = minetest.registered_nodes[name]
return deep_copy(old_def)
end
local modpath = minetest.get_modpath(minetest.get_current_modname())
dofile(modpath.."/cooling_lava.lua")

View File

@ -1,4 +1,4 @@
local data = {}
local data = dynamic_liquid.mapgen_data
dynamic_liquid.mapgen_prefill = function(def)

View File

@ -6,7 +6,8 @@ local lava_probability = dynamic_liquid.config.lava_probability
local water_level = dynamic_liquid.config.water_level
local springs = dynamic_liquid.config.springs
-- Since lava cooling behaviour can't be overridden in Mineclone, disabling dynamic liquid behaviour for lava
-- otherwise you get lava nodes wandering around on top of oceans covering the whole thing in stone.
--if dynamic_liquid.config.lava then
-- dynamic_liquid.liquid_abm("mcl_core:lava_source", "mcl_core:lava_flowing", lava_probability)
--end
@ -25,7 +26,41 @@ if dynamic_liquid.config.river_water then
end
if dynamic_liquid.config.springs then
--TODO: mapgen clay, this is a temporary measure for testing purposes
local clay_def = dynamic_liquid.duplicate_def("mcl_core:clay")
clay_def.description = S("Damp Clay")
minetest.register_node("dynamic_liquid:clay", clay_def)
local c_clay = minetest.get_content_id("mcl_core:clay")
local c_spring_clay = minetest.get_content_id("dynamic_liquid:clay")
local spring_placement = function(minp, maxp, data)
if minp.y >= water_level or maxp.y <= -15 then
return false
end
local placed_spring = false
for voxelpos, voxeldata in pairs(data) do
if voxeldata == c_clay then
data[voxelpos] = c_spring_clay
placed_spring = true
end
end
return placed_spring
end
-- mineclone 5
if minetest.get_modpath("mcl_mapgen") and mcl_mapgen.register_on_generated then
mcl_mapgen.register_on_generated(function(vm_context)
if spring_placement(vm_context.minp, vm_context.maxp, vm_context.data) then
vm_context.write = true
end
end, 999999999+1)
end
--mineclone 2
if minetest.get_modpath("mcl_mapgen_core") and mcl_mapgen_core.register_generator then
mcl_mapgen_core.register_generator("dynamic_liquid_damp_clay", function(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
return spring_placement(minp, maxp, data)
end, nil, 999999+1)
end
dynamic_liquid.spring({
nodenames = {"mcl_core:clay"},

View File

@ -1,3 +1,3 @@
name = dynamic_liquid
optional_depends = default, doc, xpanes, carts, mcl_core, mclx_core
optional_depends = default, doc, xpanes, carts, mcl_core, mclx_core, mcl_mapgen_core, mcl_mapgen
description = Flowing dynamic liquids and ocean-maintenance springs.