Merge branch 'master' into mcl_bamboo_new

This commit is contained in:
Michieal 2022-12-16 04:09:56 +00:00
commit da4e359df0
21 changed files with 218 additions and 139 deletions

12
.editorconfig Normal file
View file

@ -0,0 +1,12 @@
root = true
[*]
end_of_line = lf
[*.lua]
charset = utf8
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
keep_one_space_between_table_and_bracket = false
spaces_around_operators = true

View file

@ -8,12 +8,13 @@
## Maintainers ## Maintainers
* AncientMariner
* Nicu * Nicu
* cora
## Previous Maintainers ## Previous Maintainers
* Fleckenstein * Fleckenstein
* jordan4ibanez * jordan4ibanez
* cora
## Developers ## Developers
* bzoss * bzoss
@ -35,7 +36,6 @@
* MrRar * MrRar
* talamh * talamh
* Faerraven * Faerraven
* AncientMariner
## Contributors ## Contributors
* Laurent Rocher * Laurent Rocher

View file

@ -74,6 +74,8 @@ Please read <http://minecraft.gamepedia.com/Breaking> to learn how digging times
* `coral_species=X`: Specifies the species of a coral; equal X means equal species * `coral_species=X`: Specifies the species of a coral; equal X means equal species
* `set_on_fire=X`: Sets any (not fire-resistant) mob or player on fire for X seconds when touching * `set_on_fire=X`: Sets any (not fire-resistant) mob or player on fire for X seconds when touching
* `compostability=X`: Item can be used on a composter block; X (1-100) is the % chance of adding a level of compost * `compostability=X`: Item can be used on a composter block; X (1-100) is the % chance of adding a level of compost
* `leaves=X`: Node will spotaneously decay if no tree trunk nodes remain within 6 blocks distance.
* `leaves_orphan`: See above, these nodes are in the process of decayed.
#### Footnotes #### Footnotes

19
RELEASE.md Normal file
View file

@ -0,0 +1,19 @@
#File to document release steps with a view to evolving into a script
#Update CREDITS.md
#Update version in README.md (soon to be game.conf from of 0.82.0)
lua tools/generate_ingame_credits.lua
git add CREDITS.md
git add mods/HUD/mcl_credits/people.lua
git add README.md
# To uncomment when applicable
#git add game.conf
git commit -m "Pre-release update credits and set version 0.81.1"
git tag 0.81.1
git push origin 0.81.1

View file

@ -102,6 +102,7 @@ function check_events(dtime)
for _,e in pairs(mcl_events.registered_events) do for _,e in pairs(mcl_events.registered_events) do
local pp = e.cond_start() local pp = e.cond_start()
if pp then if pp then
--minetest.log("It's gonna start the raid maybe")
for _,p in pairs(pp) do for _,p in pairs(pp) do
local start = true local start = true
if e.exclusive_to_area then if e.exclusive_to_area then
@ -110,11 +111,14 @@ function check_events(dtime)
end end
end end
if start then if start then
--minetest.log("It's gonna start the raid definitely")
start_event(p,e) start_event(p,e)
elseif DBG then elseif DBG then
mcl_log("[mcl_events] Event "..e.readable_name.." already active at "..minetest.pos_to_string(vector.round(p.pos))) mcl_log("[mcl_events] Event "..e.readable_name.." already active at "..minetest.pos_to_string(vector.round(p.pos)))
end end
end end
else
--minetest.log("Do not start this raid")
end end
end end
for idx,ae in pairs(active_events) do for idx,ae in pairs(active_events) do

View file

@ -1397,7 +1397,7 @@ function mob_class:check_smooth_rotation(dtime)
yaw = yaw + (math.random() * 2 - 1) * 5 * dtime yaw = yaw + (math.random() * 2 - 1) * 5 * dtime
end end
self.object:set_yaw(yaw) self.object:set_yaw(yaw)
self:update_roll() --self:update_roll()
end end
-- end rotation -- end rotation
end end

View file

@ -354,7 +354,7 @@ function mob_class:set_yaw(yaw, delay, dtime)
if self.shaking and dtime then if self.shaking and dtime then
yaw = yaw + (math.random() * 2 - 1) * 5 * dtime yaw = yaw + (math.random() * 2 - 1) * 5 * dtime
end end
self:update_roll() --self:update_roll()
return yaw return yaw
end end

View file

@ -218,7 +218,7 @@ function mcl_raids.find_villager(pos)
end end
function mcl_raids.find_bed(pos) function mcl_raids.find_bed(pos)
return minetest.find_node_near(pos,128,{"mcl_beds:bed_red_bottom"}) return minetest.find_node_near(pos,32,{"mcl_beds:bed_red_bottom"})
end end
function mcl_raids.find_village(pos) function mcl_raids.find_village(pos)
@ -293,11 +293,13 @@ mcl_events.register_event("raid",{
exclusive_to_area = 128, exclusive_to_area = 128,
enable_bossbar = true, enable_bossbar = true,
cond_start = function(self) cond_start = function(self)
--minetest.log("Cond start raid")
local r = {} local r = {}
for _,p in pairs(minetest.get_connected_players()) do for _,p in pairs(minetest.get_connected_players()) do
if mcl_potions.player_has_effect(p,"bad_omen") then if mcl_potions.player_has_effect(p,"bad_omen") then
local raid_pos = mcl_raids.find_village(p:get_pos()) local raid_pos = mcl_raids.find_village(p:get_pos())
if raid_pos then if raid_pos then
--minetest.log("We have a raid position. Start raid")
table.insert(r,{ player = p:get_player_name(), pos = raid_pos }) table.insert(r,{ player = p:get_player_name(), pos = raid_pos })
end end
end end

View file

@ -10,10 +10,14 @@ local function spawn_zombies(self)
local p = vector.offset(nn[i%#nn],0,1,0) local p = vector.offset(nn[i%#nn],0,1,0)
if check_spawn_pos(p) then if check_spawn_pos(p) then
local m = mcl_mobs.spawn(p,"mobs_mc:zombie") local m = mcl_mobs.spawn(p,"mobs_mc:zombie")
if m then
local l = m:get_luaentity() local l = m:get_luaentity()
l:gopath(self.pos) l:gopath(self.pos)
table.insert(self.mobs,m) table.insert(self.mobs, m)
self.health_max = self.health_max + l.health self.health_max = self.health_max + l.health
else
--minetest.log("Failed to spawn zombie at location: " .. minetest.pos_to_string(p))
end
end end
end end
end end
@ -26,16 +30,25 @@ mcl_events.register_event("zombie_siege",{
exclusive_to_area = 128, exclusive_to_area = 128,
enable_bossbar = false, enable_bossbar = false,
cond_start = function(self) cond_start = function(self)
--minetest.log("Cond start zs")
local r = {}
local t = minetest.get_timeofday()
local pr = PseudoRandom(minetest.get_day_count()) local pr = PseudoRandom(minetest.get_day_count())
local rnd = pr:next(1,10) local rnd = pr:next(1,10)
local t = minetest.get_timeofday()
local r = {} if t < 0.04 and rnd == 1 then
--minetest.log("Well, it's siege time")
for _,p in pairs(minetest.get_connected_players()) do for _,p in pairs(minetest.get_connected_players()) do
local village = mcl_raids.find_village(p:get_pos()) local village = mcl_raids.find_village(p:get_pos())
if t < 0.04 and village and rnd == 1 then if village then
--minetest.log("Found village")
table.insert(r,{ player = p:get_player_name(), pos = village}) table.insert(r,{ player = p:get_player_name(), pos = village})
end end
end end
else
--minetest.log("Not night for a siege, or not success")
end
if #r > 0 then return r end if #r > 0 then return r end
end, end,
on_start = function(self) on_start = function(self)

View file

@ -9,12 +9,13 @@ return {
"Wuzzy", "Wuzzy",
}}, }},
{S("Maintainers"), 0xFF51D5, { {S("Maintainers"), 0xFF51D5, {
"AncientMariner",
"Nicu", "Nicu",
"cora",
}}, }},
{S("Previous Maintainers"), 0xFFFFFF, { {S("Previous Maintainers"), 0xFFFFFF, {
"Fleckenstein", "Fleckenstein",
"jordan4ibanez", "jordan4ibanez",
"cora",
}}, }},
{S("Developers"), 0xF84355, { {S("Developers"), 0xF84355, {
"bzoss", "bzoss",
@ -36,7 +37,6 @@ return {
"MrRar", "MrRar",
"talamh", "talamh",
"Faerraven", "Faerraven",
"AncientMariner",
}}, }},
{S("Contributors"), 0x52FF00, { {S("Contributors"), 0x52FF00, {
"Laurent Rocher", "Laurent Rocher",

View file

@ -1367,90 +1367,29 @@ function mcl_core.supports_vines(nodename)
end end
-- Leaf Decay -- Leaf Decay
-- To enable leaf decay for a node, add it to the "leafdecay" group.
-- --
-- The rating of the group determines how far from a node in the group "tree" -- Whenever a tree trunk node is removed, all `group:leaves` nodes in a radius
-- the node can be without decaying. -- of 6 blocks are checked from the trunk node's `after_destruct` handler.
-- Any such nodes within that radius that has no trunk node present within a
-- distance of 6 blocks is replaced with a `group:orphan_leaves` node.
-- --
-- If param2 of the node is ~= 0, the node will always be preserved. Thus, if -- The `group:orphan_leaves` nodes are gradually decayed in this ABM.
-- the player places a node of that kind, you will want to set param2=1 or so.
--
mcl_core.leafdecay_trunk_cache = {}
mcl_core.leafdecay_enable_cache = true
-- Spread the load of finding trunks
mcl_core.leafdecay_trunk_find_allow_accumulator = 0
minetest.register_globalstep(function(dtime)
--local finds_per_second = 5000
mcl_core.leafdecay_trunk_find_allow_accumulator = math.floor(dtime * 5000)
end)
minetest.register_abm({ minetest.register_abm({
label = "Leaf decay", label = "Leaf decay",
nodenames = {"group:leafdecay"}, nodenames = {"group:orphan_leaves"},
neighbors = {"air", "group:liquid"}, interval = 5,
-- A low interval and a high inverse chance spreads the load chance = 10,
interval = 2, action = function(pos, node)
chance = 5, -- Spawn item entities for any of the leaf's drops
local itemstacks = minetest.get_node_drops(node.name)
action = function(p0, node, _, _)
local do_preserve = false
local d = minetest.registered_nodes[node.name].groups.leafdecay
if not d or d == 0 then
return
end
local n0 = minetest.get_node(p0)
if n0.param2 ~= 0 then
-- Prevent leafdecay for player-placed leaves.
-- param2 is set to 1 after it was placed by the player
return
end
local p0_hash = nil
if mcl_core.leafdecay_enable_cache then
p0_hash = minetest.hash_node_position(p0)
local trunkp = mcl_core.leafdecay_trunk_cache[p0_hash]
if trunkp then
local n = minetest.get_node(trunkp)
local reg = minetest.registered_nodes[n.name]
-- Assume ignore is a trunk, to make the thing work at the border of the active area
if n.name == "ignore" or (reg and reg.groups.tree and reg.groups.tree ~= 0) then
return
end
-- Cache is invalid
table.remove(mcl_core.leafdecay_trunk_cache, p0_hash)
end
end
if mcl_core.leafdecay_trunk_find_allow_accumulator <= 0 then
return
end
mcl_core.leafdecay_trunk_find_allow_accumulator =
mcl_core.leafdecay_trunk_find_allow_accumulator - 1
-- Assume ignore is a trunk, to make the thing work at the border of the active area
local p1 = minetest.find_node_near(p0, d, {"ignore", "group:tree"})
if p1 then
do_preserve = true
if mcl_core.leafdecay_enable_cache then
-- Cache the trunk
mcl_core.leafdecay_trunk_cache[p0_hash] = p1
end
end
if not do_preserve then
-- Drop stuff other than the node itself
local itemstacks = minetest.get_node_drops(n0.name)
for _, itemname in pairs(itemstacks) do for _, itemname in pairs(itemstacks) do
local p_drop = { local p_drop = vector.offset(pos, math.random() - 0.5, math.random() - 0.5, math.random() - 0.5)
x = p0.x - 0.5 + math.random(),
y = p0.y - 0.5 + math.random(),
z = p0.z - 0.5 + math.random(),
}
minetest.add_item(p_drop, itemname) minetest.add_item(p_drop, itemname)
end end
-- Remove node -- Remove the decayed node
minetest.remove_node(p0) minetest.remove_node(pos)
leafdecay_particles(p0, n0) leafdecay_particles(pos, node)
minetest.check_for_falling(p0) minetest.check_for_falling(pos)
-- Kill depending vines immediately to skip the vines decay delay -- Kill depending vines immediately to skip the vines decay delay
local surround = { local surround = {
@ -1461,7 +1400,7 @@ minetest.register_abm({
{ x = 0, y = -1, z = -1 }, { x = 0, y = -1, z = -1 },
} }
for s=1, #surround do for s=1, #surround do
local spos = vector.add(p0, surround[s]) local spos = vector.add(pos, surround[s])
local maybe_vine = minetest.get_node(spos) local maybe_vine = minetest.get_node(spos)
--local surround_inverse = vector.multiply(surround[s], -1) --local surround_inverse = vector.multiply(surround[s], -1)
if maybe_vine.name == "mcl_core:vine" and (not mcl_core.check_vines_supported(spos, maybe_vine)) then if maybe_vine.name == "mcl_core:vine" and (not mcl_core.check_vines_supported(spos, maybe_vine)) then
@ -1471,7 +1410,6 @@ minetest.register_abm({
end end
end end
end end
end
}) })
-- Remove vines which are not supported by anything, similar to leaf decay. -- Remove vines which are not supported by anything, similar to leaf decay.

View file

@ -8,6 +8,40 @@ if mod_screwdriver then
on_rotate = screwdriver.rotate_3way on_rotate = screwdriver.rotate_3way
end end
-- Check dug/destroyed tree trunks for orphaned leaves.
--
-- This function is meant to be called by the `after_destruct` handler of
-- treetrunk nodes.
--
-- Whenever a trunk node is removed, all `group:leaves` nodes in a sphere
-- with radius 6 are checked. Every such node that does not have a trunk
-- node within a distance of 6 blocks is converted into a orphan leaf node.
-- An ABM will gradually decay these nodes.
--
-- If param2 of the node is set to a nonzero value, the node will always
-- be preserved. This is set automatically when leaves are placed manually.
--
-- @param pos the position of the removed trunk node.
-- @param oldnode the node table of the removed trunk node.
function mcl_core.update_leaves(pos, oldnode)
local pos1, pos2 = vector.offset(pos, -6, -6, -6), vector.offset(pos, 6, 6, 6)
local lnode
local leaves = minetest.find_nodes_in_area(pos1, pos2, "group:leaves")
for _, lpos in pairs(leaves) do
lnode = minetest.get_node(lpos)
-- skip already decaying leaf nodes
if minetest.get_item_group(lnode.name, "orphan_leaves") ~= 1 then
if not minetest.find_node_near(lpos, 6, "group:tree") then
-- manually placed leaf nodes have param2
-- set and will never decay automatically
if lnode.param2 == 0 then
minetest.swap_node(lpos, {name = lnode.name .. "_orphan"})
end
end
end
end
end
-- Register tree trunk (wood) and bark -- Register tree trunk (wood) and bark
local function register_tree_trunk(subname, description_trunk, description_bark, longdesc, tile_inner, tile_bark, stripped_variant) local function register_tree_trunk(subname, description_trunk, description_bark, longdesc, tile_inner, tile_bark, stripped_variant)
minetest.register_node("mcl_core:"..subname, { minetest.register_node("mcl_core:"..subname, {
@ -17,6 +51,7 @@ local function register_tree_trunk(subname, description_trunk, description_bark,
tiles = {tile_inner, tile_inner, tile_bark}, tiles = {tile_inner, tile_inner, tile_bark},
paramtype2 = "facedir", paramtype2 = "facedir",
on_place = mcl_util.rotate_axis, on_place = mcl_util.rotate_axis,
after_destruct = mcl_core.update_leaves,
stack_max = 64, stack_max = 64,
groups = {handy=1,axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, groups = {handy=1,axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
@ -107,10 +142,7 @@ local function register_wooden_planks(subname, description, tiles)
}) })
end end
local function register_leaves(subname, description, longdesc, tiles, sapling, drop_apples, sapling_chances, leafdecay_distance) local function register_leaves(subname, description, longdesc, tiles, sapling, drop_apples, sapling_chances)
if leafdecay_distance == nil then
leafdecay_distance = 4
end
local apple_chances = {200, 180, 160, 120, 40} local apple_chances = {200, 180, 160, 120, 40}
local stick_chances = {50, 45, 30, 35, 10} local stick_chances = {50, 45, 30, 35, 10}
@ -141,7 +173,7 @@ local function register_leaves(subname, description, longdesc, tiles, sapling, d
return drop return drop
end end
minetest.register_node("mcl_core:"..subname, { local l_def = {
description = description, description = description,
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
_doc_items_hidden = false, _doc_items_hidden = false,
@ -153,9 +185,8 @@ local function register_leaves(subname, description, longdesc, tiles, sapling, d
stack_max = 64, stack_max = 64,
groups = { groups = {
handy = 1, hoey = 1, shearsy = 1, swordy = 1, dig_by_piston = 1, handy = 1, hoey = 1, shearsy = 1, swordy = 1, dig_by_piston = 1,
leaves = 1, leafdecay = leafdecay_distance, deco_block = 1,
flammable = 2, fire_encouragement = 30, fire_flammability = 60, flammable = 2, fire_encouragement = 30, fire_flammability = 60,
compostability = 30 leaves = 1, deco_block = 1, compostability = 30
}, },
drop = get_drops(0), drop = get_drops(0),
_mcl_shears_drop = true, _mcl_shears_drop = true,
@ -164,7 +195,19 @@ local function register_leaves(subname, description, longdesc, tiles, sapling, d
_mcl_hardness = 0.2, _mcl_hardness = 0.2,
_mcl_silk_touch_drop = true, _mcl_silk_touch_drop = true,
_mcl_fortune_drop = { get_drops(1), get_drops(2), get_drops(3), get_drops(4) }, _mcl_fortune_drop = { get_drops(1), get_drops(2), get_drops(3), get_drops(4) },
}) }
minetest.register_node("mcl_core:" .. subname, l_def)
local o_def = table.copy(l_def)
o_def._doc_items_create_entry = false
o_def.place_param2 = nil
o_def.groups.not_in_creative_inventory = 1
o_def.groups.orphan_leaves = 1
o_def._mcl_shears_drop = {"mcl_core:" .. subname}
o_def._mcl_silk_touch_drop = {"mcl_core:" .. subname}
minetest.register_node("mcl_core:" .. subname .. "_orphan", o_def)
end end
local function register_sapling(subname, description, longdesc, tt_help, texture, selbox) local function register_sapling(subname, description, longdesc, tt_help, texture, selbox)

View file

@ -52,9 +52,9 @@ minetest.register_node("mcl_mangrove:mangrove_tree", {
tiles = {"mcl_mangrove_log_top.png", "mcl_mangrove_log_top.png", "mcl_mangrove_log.png"}, tiles = {"mcl_mangrove_log_top.png", "mcl_mangrove_log_top.png", "mcl_mangrove_log.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
on_place = mcl_util.rotate_axis, on_place = mcl_util.rotate_axis,
after_destruct = mcl_core.update_leaves,
groups = {handy=1,axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5}, groups = {handy=1,axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
on_place = mcl_util.rotate_axis,
_mcl_blast_resistance = 2, _mcl_blast_resistance = 2,
_mcl_hardness = 2, _mcl_hardness = 2,
_mcl_stripped_variant = "mcl_mangrove:mangrove_stripped_trunk", _mcl_stripped_variant = "mcl_mangrove:mangrove_stripped_trunk",
@ -86,7 +86,7 @@ minetest.register_node("mcl_mangrove:mangrove_wood", {
_mcl_hardness = 2, _mcl_hardness = 2,
}) })
minetest.register_node("mcl_mangrove:mangroveleaves", { local l_def = {
description = S("Mangrove Leaves"), description = S("Mangrove Leaves"),
_doc_items_longdesc = S("mangrove leaves are grown from mangrove trees."), _doc_items_longdesc = S("mangrove leaves are grown from mangrove trees."),
_doc_items_hidden = false, _doc_items_hidden = false,
@ -95,7 +95,11 @@ minetest.register_node("mcl_mangrove:mangroveleaves", {
place_param2 = 1, -- Prevent leafdecay for placed nodes place_param2 = 1, -- Prevent leafdecay for placed nodes
tiles = {"mcl_mangrove_leaves.png"}, tiles = {"mcl_mangrove_leaves.png"},
paramtype = "light", paramtype = "light",
groups = {handy=1,shearsy=1,swordy=1, leafdecay=10, flammable=2, leaves=1, deco_block=1, dig_by_piston=1, fire_encouragement=30, fire_flammability=60}, groups = {
handy = 1, hoey = 1, shearsy = 1, swordy = 1, dig_by_piston = 1,
flammable = 2, fire_encouragement = 30, fire_flammability = 60,
leaves = 1, deco_block = 1, compostability = 30
},
drop = get_drops(0), drop = get_drops(0),
_mcl_shears_drop = true, _mcl_shears_drop = true,
sounds = mcl_sounds.node_sound_leaves_defaults(), sounds = mcl_sounds.node_sound_leaves_defaults(),
@ -103,7 +107,19 @@ minetest.register_node("mcl_mangrove:mangroveleaves", {
_mcl_hardness = 0.2, _mcl_hardness = 0.2,
_mcl_silk_touch_drop = true, _mcl_silk_touch_drop = true,
_mcl_fortune_drop = { get_drops(1), get_drops(2), get_drops(3), get_drops(4) }, _mcl_fortune_drop = { get_drops(1), get_drops(2), get_drops(3), get_drops(4) },
}) }
minetest.register_node("mcl_mangrove:mangroveleaves", l_def)
local o_def = table.copy(l_def)
o_def._doc_items_create_entry = false
o_def.place_param2 = nil
o_def.groups.not_in_creative_inventory = 1
o_def.groups.orphan_leaves = 1
o_def._mcl_shears_drop = {"mcl_mangrove:mangroveleaves"}
o_def._mcl_silk_touch_drop = {"mcl_mangrove:mangroveleaves"}
minetest.register_node("mcl_mangrove:mangroveleaves_orphan", o_def)
minetest.register_node("mcl_mangrove:mangrove_stripped_trunk", { minetest.register_node("mcl_mangrove:mangrove_stripped_trunk", {
description = S("Stripped Mangrove Wood"), description = S("Stripped Mangrove Wood"),
@ -147,11 +163,13 @@ minetest.register_node("mcl_mangrove:mangrove_roots", {
drawtype = "allfaces_optional", drawtype = "allfaces_optional",
groups = { groups = {
handy = 1, hoey = 1, shearsy = 1, axey = 1, swordy = 1, dig_by_piston = 0, handy = 1, hoey = 1, shearsy = 1, axey = 1, swordy = 1, dig_by_piston = 0,
leaves = 1, deco_block = 1,flammable = 10, fire_encouragement = 30, fire_flammability = 60, compostability = 30 flammable = 10, fire_encouragement = 30, fire_flammability = 60,
deco_block = 1, compostability = 30
}, },
drop = "mcl_mangrove:mangrove_roots", drop = "mcl_mangrove:mangrove_roots",
_mcl_shears_drop = true, _mcl_shears_drop = true,
sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0.7, sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0.7,
_mcl_hardness = 0.7, _mcl_hardness = 0.7,
_mcl_silk_touch_drop = true, _mcl_silk_touch_drop = true,
_mcl_fortune_drop = { "mcl_mangrove:mangrove_roots 1", "mcl_mangrove:mangrove_roots 2", "mcl_mangrove:mangrove_roots 3", "mcl_mangrove:mangrove_roots 4" }, _mcl_fortune_drop = { "mcl_mangrove:mangrove_roots 1", "mcl_mangrove:mangrove_roots 2", "mcl_mangrove:mangrove_roots 3", "mcl_mangrove:mangrove_roots 4" },
@ -329,6 +347,9 @@ local wlroots = {
end, end,
} }
local rwlroots = table.copy(wlroots) local rwlroots = table.copy(wlroots)
-- FIXME luacheck complains that this is a repeated definition of water_tex.
-- Maybe the tiles definition below should be replaced with the animated tile
-- definition as per above?
water_tex = "default_river_water_source_animated.png^[verticalframe:16:0" water_tex = "default_river_water_source_animated.png^[verticalframe:16:0"
rwlroots.tiles = { rwlroots.tiles = {
"("..water_tex..")^mcl_mangrove_roots_top.png", "("..water_tex..")^mcl_mangrove_roots_top.png",

View file

@ -52,16 +52,16 @@ schem_path = settlements.modpath.."/schematics/"
local basic_pseudobiome_villages = minetest.settings:get_bool("basic_pseudobiome_villages", true) local basic_pseudobiome_villages = minetest.settings:get_bool("basic_pseudobiome_villages", true)
settlements.schematic_table = { settlements.schematic_table = {
{name = "large_house", mts = schem_path.."large_house.mts", hwidth = 11, hdepth = 12, hheight = 9, hsize = 14, max_num = 0.08 , rplc = basic_pseudobiome_villages }, {name = "large_house", mts = schem_path.."large_house.mts", hwidth = 12, hdepth = 12, hheight = 9, hsize = 14, max_num = 0.08 , rplc = basic_pseudobiome_villages },
{name = "blacksmith", mts = schem_path.."blacksmith.mts", hwidth = 7, hdepth = 7, hheight = 13, hsize = 13, max_num = 0.055, rplc = basic_pseudobiome_villages }, {name = "blacksmith", mts = schem_path.."blacksmith.mts", hwidth = 8, hdepth = 11, hheight = 13, hsize = 13, max_num = 0.055, rplc = basic_pseudobiome_villages },
{name = "butcher", mts = schem_path.."butcher.mts", hwidth = 11, hdepth = 8, hheight = 10, hsize = 14, max_num = 0.03 , rplc = basic_pseudobiome_villages }, {name = "butcher", mts = schem_path.."butcher.mts", hwidth = 12, hdepth = 8, hheight = 10, hsize = 14, max_num = 0.03 , rplc = basic_pseudobiome_villages },
{name = "church", mts = schem_path.."church.mts", hwidth = 13, hdepth = 13, hheight = 14, hsize = 15, max_num = 0.04 , rplc = basic_pseudobiome_villages }, {name = "church", mts = schem_path.."church.mts", hwidth = 13, hdepth = 13, hheight = 14, hsize = 15, max_num = 0.04 , rplc = basic_pseudobiome_villages },
{name = "farm", mts = schem_path.."farm.mts", hwidth = 7, hdepth = 7, hheight = 13, hsize = 13, max_num = 0.1 , rplc = basic_pseudobiome_villages }, {name = "farm", mts = schem_path.."farm.mts", hwidth = 9, hdepth = 7, hheight = 13, hsize = 13, max_num = 0.1 , rplc = basic_pseudobiome_villages },
{name = "lamp", mts = schem_path.."lamp.mts", hwidth = 3, hdepth = 3, hheight = 13, hsize = 10, max_num = 0.1 , rplc = false }, {name = "lamp", mts = schem_path.."lamp.mts", hwidth = 3, hdepth = 4, hheight = 13, hsize = 10, max_num = 0.1 , rplc = false },
{name = "library", mts = schem_path.."library.mts", hwidth = 12, hdepth = 12, hheight = 8, hsize = 13, max_num = 0.04 , rplc = basic_pseudobiome_villages }, {name = "library", mts = schem_path.."library.mts", hwidth = 12, hdepth = 12, hheight = 8, hsize = 13, max_num = 0.04 , rplc = basic_pseudobiome_villages },
{name = "medium_house", mts = schem_path.."medium_house.mts", hwidth = 8, hdepth = 12, hheight = 8, hsize = 14, max_num = 0.08 , rplc = basic_pseudobiome_villages }, {name = "medium_house", mts = schem_path.."medium_house.mts", hwidth = 9, hdepth = 12, hheight = 8, hsize = 14, max_num = 0.08 , rplc = basic_pseudobiome_villages },
{name = "small_house", mts = schem_path.."small_house.mts", hwidth = 9, hdepth = 7, hheight = 8, hsize = 13, max_num = 0.7 , rplc = basic_pseudobiome_villages }, {name = "small_house", mts = schem_path.."small_house.mts", hwidth = 9, hdepth = 8, hheight = 8, hsize = 13, max_num = 0.7 , rplc = basic_pseudobiome_villages },
{name = "tavern", mts = schem_path.."tavern.mts", hwidth = 11, hdepth = 10, hheight = 10, hsize = 13, max_num = 0.050, rplc = basic_pseudobiome_villages }, {name = "tavern", mts = schem_path.."tavern.mts", hwidth = 12, hdepth = 10, hheight = 10, hsize = 13, max_num = 0.050, rplc = basic_pseudobiome_villages },
{name = "well", mts = schem_path.."well.mts", hwidth = 6, hdepth = 8, hheight = 6, hsize = 10, max_num = 0.045, rplc = basic_pseudobiome_villages }, {name = "well", mts = schem_path.."well.mts", hwidth = 6, hdepth = 8, hheight = 6, hsize = 10, max_num = 0.045, rplc = basic_pseudobiome_villages },
} }

View file

@ -1,17 +1,35 @@
local function mcl_log (message)
mcl_util.mcl_log (message, "[Village - Foundation]")
end
local foundation_materials = {}
foundation_materials["mcl_core:sand"] = "mcl_core:sandstone"
--"mcl_core:sandstonecarved"
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- function to fill empty space below baseplate when building on a hill -- function to fill empty space below baseplate when building on a hill
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
function settlements.ground(pos, pr) -- role model: Wendelsteinkircherl, Brannenburg function settlements.ground(pos, pr, platform_material) -- role model: Wendelsteinkircherl, Brannenburg
local p2 = vector.new(pos) local p2 = vector.new(pos)
local cnt = 0 local cnt = 0
local mat = "mcl_core:dirt" local mat = "mcl_core:dirt"
if not platform_material then
mat = "mcl_core:dirt"
else
mat = platform_material
end
p2.y = p2.y-1 p2.y = p2.y-1
while true do while true do
cnt = cnt+1 cnt = cnt+1
if cnt > 20 then break end if cnt > 20 then break end
if cnt>pr:next(2,4) then if cnt>pr:next(2,4) then
if not platform_material then
mat = "mcl_core:stone" mat = "mcl_core:stone"
end end
end
minetest.swap_node(p2, {name=mat}) minetest.swap_node(p2, {name=mat})
p2.y = p2.y-1 p2.y = p2.y-1
end end
@ -40,6 +58,12 @@ function settlements.terraform(settlement_info, pr)
end end
--fheight = schematic_data["hheight"] * 3 -- remove trees and leaves above --fheight = schematic_data["hheight"] * 3 -- remove trees and leaves above
fheight = schematic_data["hheight"] -- remove trees and leaves above fheight = schematic_data["hheight"] -- remove trees and leaves above
local surface_mat = settlement_info[i]["surface_mat"]
mcl_log("Surface material: " .. tostring(surface_mat))
local platform_mat = foundation_materials[surface_mat]
mcl_log("Foundation material: " .. tostring(platform_mat))
-- --
-- now that every info is available -> create platform and clear space above -- now that every info is available -> create platform and clear space above
-- --
@ -48,7 +72,8 @@ function settlements.terraform(settlement_info, pr)
for yi = 0,fheight *3 do for yi = 0,fheight *3 do
if yi == 0 then if yi == 0 then
local p = {x=pos.x+xi, y=pos.y, z=pos.z+zi} local p = {x=pos.x+xi, y=pos.y, z=pos.z+zi}
settlements.ground(p, pr) -- Pass in biome info and make foundations of same material (seed: apple for desert)
settlements.ground(p, pr, platform_mat)
else else
-- write ground -- write ground
-- local p = {x=pos.x+xi, y=pos.y+yi, z=pos.z+zi} -- local p = {x=pos.x+xi, y=pos.y+yi, z=pos.z+zi}