forked from MineClone5/MineClone5
Add ice spikes for v6
This commit is contained in:
parent
6ac682fdcf
commit
4a3f1032ca
|
@ -168,7 +168,6 @@ mcl_structures.register_structure({
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local pr = PseudoRandom(vm_context.chunkseed)
|
|
||||||
place(pos, nil, pr)
|
place(pos, nil, pr)
|
||||||
end,
|
end,
|
||||||
place_function = place,
|
place_function = place,
|
||||||
|
|
|
@ -87,7 +87,6 @@ mcl_structures.register_structure({
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local pr = PseudoRandom(vm_context.chunkseed)
|
|
||||||
place(pos, nil, pr)
|
place(pos, nil, pr)
|
||||||
end,
|
end,
|
||||||
place_function = place,
|
place_function = place,
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
local modname = minetest.get_current_modname()
|
||||||
|
local modpath = minetest.get_modpath(modname)
|
||||||
|
|
||||||
|
local chance_per_chunk = 5
|
||||||
|
local random_offset = 24435
|
||||||
|
local struct_threshold = chance_per_chunk - 1
|
||||||
|
local noise_params = {
|
||||||
|
offset = 0,
|
||||||
|
scale = 1,
|
||||||
|
spread = {
|
||||||
|
x = 1000,
|
||||||
|
y = 1000,
|
||||||
|
z = 1000,
|
||||||
|
},
|
||||||
|
scale = 0.01,
|
||||||
|
seed = 29313,
|
||||||
|
octaves = 2,
|
||||||
|
persistence = 0.7,
|
||||||
|
}
|
||||||
|
|
||||||
|
local node_list = {"mcl_core:snowblock", "mcl_core:dirt_with_grass_snow"}
|
||||||
|
local schematic = modpath.."/schematics/mcl_structures_ice_spike_large.mts"
|
||||||
|
|
||||||
|
minetest_find_nodes_in_area = minetest.find_nodes_in_area
|
||||||
|
|
||||||
|
local function place(pos, rotation, pr)
|
||||||
|
mcl_structures.place_schematic({pos = pos, schematic = schematic, rotation = rotation, pr = pr})
|
||||||
|
end
|
||||||
|
|
||||||
|
local function is_place_ok(p)
|
||||||
|
-- Check surface
|
||||||
|
local floor = {x=p.x+4, y=p.y-1, z=p.z+4}
|
||||||
|
local surface = #minetest_find_nodes_in_area({x=p.x+1,y=p.y-1,z=p.z+1}, floor, node_list, false)
|
||||||
|
if surface < 9 then return end
|
||||||
|
|
||||||
|
-- Check for collision with spruce
|
||||||
|
local spruce_collisions = #minetest_find_nodes_in_area({x=p.x+1,y=p.y+2,z=p.z+1}, {x=p.x+4, y=p.y+6, z=p.z+4}, {"group:tree"}, false)
|
||||||
|
if spruce_collisions > 0 then return end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local def = mcl_mapgen.v6 and {
|
||||||
|
decoration = {
|
||||||
|
deco_type = "simple",
|
||||||
|
place_on = node_list,
|
||||||
|
noise_params = noise_params,
|
||||||
|
y_min = mcl_mapgen.overworld.min,
|
||||||
|
y_max = mcl_mapgen.overworld.max,
|
||||||
|
height = 1,
|
||||||
|
},
|
||||||
|
on_finished_chunk = mcl_mapgen.v6 and function(minp, maxp, seed, vm_context, pos_list)
|
||||||
|
local pr = PseudoRandom(seed + random_offset)
|
||||||
|
local random_number = pr:next(1, chance_per_chunk)
|
||||||
|
if random_number < struct_threshold then return end
|
||||||
|
for i = 1, #pos_list do
|
||||||
|
local pos = pos_list[i]
|
||||||
|
if is_place_ok(pos) then
|
||||||
|
place(pos, nil, pr)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
} or {}
|
||||||
|
def.name = "ice_spike_large"
|
||||||
|
def.place_function = place
|
||||||
|
mcl_structures.register_structure(def)
|
|
@ -0,0 +1,65 @@
|
||||||
|
local modname = minetest.get_current_modname()
|
||||||
|
local modpath = minetest.get_modpath(modname)
|
||||||
|
|
||||||
|
local chance_per_chunk = 3
|
||||||
|
local random_offset = 1264
|
||||||
|
local struct_threshold = chance_per_chunk - 1
|
||||||
|
local noise_params = {
|
||||||
|
offset = 0,
|
||||||
|
scale = 1,
|
||||||
|
spread = {
|
||||||
|
x = mcl_mapgen.CS,
|
||||||
|
y = mcl_mapgen.CS,
|
||||||
|
z = mcl_mapgen.CS,
|
||||||
|
},
|
||||||
|
scale = 0.3,
|
||||||
|
seed = 32931,
|
||||||
|
octaves = 2,
|
||||||
|
persistence = 0.7,
|
||||||
|
}
|
||||||
|
|
||||||
|
local node_list = {"mcl_core:snowblock", "mcl_core:dirt_with_grass_snow"}
|
||||||
|
local schematic = modpath.."/schematics/mcl_structures_ice_spike_small.mts"
|
||||||
|
|
||||||
|
minetest_find_nodes_in_area = minetest.find_nodes_in_area
|
||||||
|
|
||||||
|
local function place(pos, rotation, pr)
|
||||||
|
mcl_structures.place_schematic({pos = pos, schematic = schematic, rotation = rotation, pr = pr})
|
||||||
|
end
|
||||||
|
|
||||||
|
local function is_place_ok(p)
|
||||||
|
local floor = {x=p.x+6, y=p.y-1, z=p.z+6}
|
||||||
|
local surface = #minetest_find_nodes_in_area({x=p.x+1,y=p.y-1,z=p.z+1}, floor, node_list, false)
|
||||||
|
if surface < 25 then return end
|
||||||
|
|
||||||
|
-- Check for collision with spruce
|
||||||
|
local spruce_collisions = #minetest_find_nodes_in_area({x=p.x+1,y=p.y+1,z=p.z+1}, {x=p.x+6, y=p.y+6, z=p.z+6}, {"group:tree"}, false)
|
||||||
|
if spruce_collisions > 0 then return end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local def = mcl_mapgen.v6 and {
|
||||||
|
decoration = {
|
||||||
|
deco_type = "simple",
|
||||||
|
place_on = node_list,
|
||||||
|
noise_params = noise_params,
|
||||||
|
y_min = mcl_mapgen.overworld.min,
|
||||||
|
y_max = mcl_mapgen.overworld.max,
|
||||||
|
height = 1,
|
||||||
|
},
|
||||||
|
on_finished_chunk = mcl_mapgen.v6 and function(minp, maxp, seed, vm_context, pos_list)
|
||||||
|
local pr = PseudoRandom(seed + random_offset)
|
||||||
|
local random_number = pr:next(1, chance_per_chunk)
|
||||||
|
if random_number < struct_threshold then return end
|
||||||
|
for i = 1, #pos_list do
|
||||||
|
local pos = pos_list[i]
|
||||||
|
if is_place_ok(pos) then
|
||||||
|
place(pos, nil, pr)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
} or {}
|
||||||
|
def.name = "ice_spike_small"
|
||||||
|
def.place_function = place
|
||||||
|
mcl_structures.register_structure(def)
|
|
@ -189,7 +189,6 @@ mcl_structures.register_structure({
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if count < 0 then return end
|
if count < 0 then return end
|
||||||
local pr = PseudoRandom(vm_context.chunkseed)
|
|
||||||
place(pos, nil, pr)
|
place(pos, nil, pr)
|
||||||
end,
|
end,
|
||||||
place_function = place,
|
place_function = place,
|
||||||
|
|
|
@ -339,10 +339,6 @@ function mcl_structures.call_struct(pos, struct_style, rotation, pr, callback)
|
||||||
end
|
end
|
||||||
if struct_style == "witch_hut" then
|
if struct_style == "witch_hut" then
|
||||||
return mcl_structures.generate_witch_hut(pos, rotation)
|
return mcl_structures.generate_witch_hut(pos, rotation)
|
||||||
elseif struct_style == "ice_spike_small" then
|
|
||||||
return mcl_structures.generate_ice_spike_small(pos, rotation)
|
|
||||||
elseif struct_style == "ice_spike_large" then
|
|
||||||
return mcl_structures.generate_ice_spike_large(pos, rotation)
|
|
||||||
elseif struct_style == "boulder" then
|
elseif struct_style == "boulder" then
|
||||||
return mcl_structures.generate_boulder(pos, rotation, pr)
|
return mcl_structures.generate_boulder(pos, rotation, pr)
|
||||||
elseif struct_style == "end_exit_portal" then
|
elseif struct_style == "end_exit_portal" then
|
||||||
|
@ -405,11 +401,6 @@ function mcl_structures.generate_witch_hut(pos, rotation, pr)
|
||||||
mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, hut_placement_callback, pr)
|
mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, hut_placement_callback, pr)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_structures.generate_ice_spike_small(pos, rotation)
|
|
||||||
local path = modpath.."/schematics/mcl_structures_ice_spike_small.mts"
|
|
||||||
return minetest.place_schematic(pos, path, rotation or "random", nil, false) -- don't serialize schematics for registered biome decorations, for MT 5.4.0
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_structures.generate_ice_spike_large(pos, rotation)
|
function mcl_structures.generate_ice_spike_large(pos, rotation)
|
||||||
local path = modpath.."/schematics/mcl_structures_ice_spike_large.mts"
|
local path = modpath.."/schematics/mcl_structures_ice_spike_large.mts"
|
||||||
return minetest.place_schematic(pos, path, rotation or "random", nil, false) -- don't serialize schematics for registered biome decorations, for MT 5.4.0
|
return minetest.place_schematic(pos, path, rotation or "random", nil, false) -- don't serialize schematics for registered biome decorations, for MT 5.4.0
|
||||||
|
|
|
@ -197,7 +197,6 @@ mcl_structures.register_structure({
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if count < 0 then return end
|
if count < 0 then return end
|
||||||
local pr = PseudoRandom(vm_context.chunkseed)
|
|
||||||
place(pos, nil, pr)
|
place(pos, nil, pr)
|
||||||
end,
|
end,
|
||||||
place_function = place,
|
place_function = place,
|
||||||
|
|
|
@ -203,7 +203,6 @@ mcl_structures.register_structure({
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if count < 0 then return end
|
if count < 0 then return end
|
||||||
local pr = PseudoRandom(vm_context.chunkseed)
|
|
||||||
place(pos, nil, pr)
|
place(pos, nil, pr)
|
||||||
end,
|
end,
|
||||||
place_function = place,
|
place_function = place,
|
||||||
|
|
|
@ -6,6 +6,8 @@ if not mcl_mapgen.singlenode then
|
||||||
dofile(modpath .. "/desert_well.lua")
|
dofile(modpath .. "/desert_well.lua")
|
||||||
dofile(modpath .. "/fossil.lua")
|
dofile(modpath .. "/fossil.lua")
|
||||||
dofile(modpath .. "/igloo.lua")
|
dofile(modpath .. "/igloo.lua")
|
||||||
|
dofile(modpath .. "/ice_spike_small.lua")
|
||||||
|
dofile(modpath .. "/ice_spike_large.lua")
|
||||||
dofile(modpath .. "/jungle_temple.lua")
|
dofile(modpath .. "/jungle_temple.lua")
|
||||||
dofile(modpath .. "/nice_jungle_temple.lua")
|
dofile(modpath .. "/nice_jungle_temple.lua")
|
||||||
dofile(modpath .. "/noise_indicator.lua")
|
dofile(modpath .. "/noise_indicator.lua")
|
||||||
|
|
|
@ -130,7 +130,6 @@ mcl_structures.register_structure({
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local pr = PseudoRandom(vm_context.chunkseed)
|
|
||||||
place(pos, nil, pr)
|
place(pos, nil, pr)
|
||||||
end,
|
end,
|
||||||
place_function = place,
|
place_function = place,
|
||||||
|
|
Loading…
Reference in New Issue