many worldgen mods and gonna try technic now
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
Modified Code by Liil/Wilhelmine/Skandarella (c) 2023 under (MIT) License (c) 2023
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
Since there is still no way for Windows users to convert schematics without having the problem of standard param2 = 1 for placed leaves, I made this little mod to have an alternate leafdecay.
|
||||
|
||||
With this mod, all trees in my mods have a working leafdecay function. If you are a windows user and have no option to change param2 =1 to param2 =0 in schematic files, you can modify my mod to create
|
||||
your own lefdecay, or you can contact me on Minetest Forum or github and I can support your mod, if you send me the needed list of leaves and trunks, for example:
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"nameofyourmod:yourbiome_yourtree_trunk"},
|
||||
leaves = {"nameofyourmod:yourbiome_yourtree_leaves", nameofyourmod:yourbiome_yourtree_fruit"},
|
||||
radius = 3
|
||||
})
|
||||
|
||||
To activate the Winuser Leafedecay, you have to add two things to your leaves and other tree objects that are falling down when the trunk is chopped(fruits, nuts) code:
|
||||
|
||||
For leaves that should decay you have to add under groups: winleafdecay = 3
|
||||
For fruits, tree mushrooms or nuts that should fall down: winleafdecay_drop = 1, winleafdecay = 3
|
||||
@@ -0,0 +1,5 @@
|
||||
default
|
||||
livingfloatlands?
|
||||
livingdesert?
|
||||
livingjungle?
|
||||
naturalbiomes?
|
||||
@@ -0,0 +1 @@
|
||||
With this mod, all trees in Wilhelmines mods have a working leafdecay function.
|
||||
@@ -0,0 +1,79 @@
|
||||
winuserleafdecay = {}
|
||||
|
||||
local function winleafdecay_after_destruct(pos, oldnode, def)
|
||||
for _, v in pairs(minetest.find_nodes_in_area(vector.subtract(pos, def.radius),
|
||||
vector.add(pos, def.radius), def.leaves)) do
|
||||
local node = minetest.get_node(v)
|
||||
local timer = minetest.get_node_timer(v)
|
||||
if node.param2 ~= 3 and not timer:is_started() then
|
||||
timer:start(math.random(20, 120) / 10)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local movement_gravity = tonumber(
|
||||
minetest.settings:get("movement_gravity")) or 9.81
|
||||
|
||||
local function winleafdecay_on_timer(pos, def)
|
||||
if minetest.find_node_near(pos, def.radius, def.trunks) then
|
||||
return false
|
||||
end
|
||||
|
||||
local node = minetest.get_node(pos)
|
||||
local drops = minetest.get_node_drops(node.name)
|
||||
for _, item in ipairs(drops) do
|
||||
local is_leaf
|
||||
for _, v in pairs(def.leaves) do
|
||||
if v == item then
|
||||
is_leaf = true
|
||||
end
|
||||
end
|
||||
if minetest.get_item_group(item, "winleafdecay_drop") ~= 0 or
|
||||
not is_leaf then
|
||||
minetest.add_item({
|
||||
x = pos.x - 0.5 + math.random(),
|
||||
y = pos.y - 0.5 + math.random(),
|
||||
z = pos.z - 0.5 + math.random(),
|
||||
}, item)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.remove_node(pos)
|
||||
minetest.check_for_falling(pos)
|
||||
|
||||
-- spawn a few particles for the removed node
|
||||
minetest.add_particlespawner({
|
||||
amount = 8,
|
||||
time = 0.001,
|
||||
minpos = vector.subtract(pos, {x=0.5, y=0.5, z=0.5}),
|
||||
maxpos = vector.add(pos, {x=0.5, y=0.5, z=0.5}),
|
||||
minvel = vector.new(-0.5, -1, -0.5),
|
||||
maxvel = vector.new(0.5, 0, 0.5),
|
||||
minacc = vector.new(0, -movement_gravity, 0),
|
||||
maxacc = vector.new(0, -movement_gravity, 0),
|
||||
minsize = 0,
|
||||
maxsize = 0,
|
||||
node = node,
|
||||
})
|
||||
end
|
||||
|
||||
function winuserleafdecay.register_winleafdecay(def)
|
||||
assert(def.leaves)
|
||||
assert(def.trunks)
|
||||
assert(def.radius)
|
||||
for _, v in pairs(def.trunks) do
|
||||
minetest.override_item(v, {
|
||||
after_destruct = function(pos, oldnode)
|
||||
winleafdecay_after_destruct(pos, oldnode, def)
|
||||
end,
|
||||
})
|
||||
end
|
||||
for _, v in pairs(def.leaves) do
|
||||
minetest.override_item(v, {
|
||||
on_timer = function(pos)
|
||||
winleafdecay_on_timer(pos, def)
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
local modname = "winuserleafdecay"
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||
|
||||
-- Load support for intllib.
|
||||
local path = minetest.get_modpath(minetest.get_current_modname()) .. "/"
|
||||
|
||||
local S = minetest.get_translator and minetest.get_translator("winuserleafdecay") or
|
||||
dofile(path .. "intllib.lua")
|
||||
|
||||
|
||||
|
||||
-- lua
|
||||
dofile(path .. "functions.lua") --
|
||||
dofile(path .. "leafdecay.lua") --
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print (S("[MOD] leafdecay loaded"))
|
||||
@@ -0,0 +1,3 @@
|
||||
-- Support for the old multi-load method
|
||||
dofile(minetest.get_modpath("intllib").."/init.lua")
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
if minetest.get_modpath("livingfloatlands") then
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingfloatlands:giantforest_paleoredwood_trunk"},
|
||||
leaves = {"livingfloatlands:giantforest_paleoredwood_leaves", "livingfloatlands:giantforest_tinderfungus"},
|
||||
radius = 6
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingfloatlands:coldsteppe_pine_trunk"},
|
||||
leaves = {"livingfloatlands:coldsteppe_pine_leaves", "livingfloatlands:coldsteppe_pine_pinecone"},
|
||||
radius = 5
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingfloatlands:coldsteppe_pine2_trunk"},
|
||||
leaves = {"livingfloatlands:coldsteppe_pine2_leaves", "livingfloatlands:coldsteppe_pine2_pinecone"},
|
||||
radius = 6
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingfloatlands:coldsteppe_pine3_trunk"},
|
||||
leaves = {"livingfloatlands:coldsteppe_pine3_leaves", "livingfloatlands:coldsteppe_pine3_pinecone"},
|
||||
radius = 5
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingfloatlands:giantforest_paleooak_trunk"},
|
||||
leaves = {"livingfloatlands:giantforest_paleooak_leaves", "livingfloatlands:giantforest_oaknut"},
|
||||
radius = 6
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingfloatlands:paleodesert_joshua_trunk"},
|
||||
leaves = {"livingfloatlands:paleodesert_joshua_leaves"},
|
||||
radius = 3
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingfloatlands:paleodesert_paleopine_trunk"},
|
||||
leaves = {"livingfloatlands:paleodesert_paleopine_leaves"},
|
||||
radius = 6
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingfloatlands:paleojungle_clubmoss_trunk"},
|
||||
leaves = {"livingfloatlands:paleojungle_clubmoss_leaves", "livingfloatlands:paleojungle_clubmoss_fruit"},
|
||||
radius = 6
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingfloatlands:paleojungle_conifere_trunk"},
|
||||
leaves = {"livingfloatlands:paleojungle_conifere_leaves"},
|
||||
radius = 8
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingfloatlands:paleojungle_paleopalm_trunk"},
|
||||
leaves = {"livingfloatlands:paleojungle_paleopalm_leaves"},
|
||||
radius = 3
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
if minetest.get_modpath("naturalbiomes") then
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:alder_trunk"},
|
||||
leaves = {"naturalbiomes:alder_leaves"},
|
||||
radius = 6
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:alppine1_trunk"},
|
||||
leaves = {"naturalbiomes:alppine1_leaves"},
|
||||
radius = 5
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:alppine2_trunk"},
|
||||
leaves = {"naturalbiomes:alppine2_leaves"},
|
||||
radius = 3
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:bamboo_trunk", "naturalbiomes:smallbamboo"},
|
||||
leaves = {"naturalbiomes:bamboo_leaves"},
|
||||
radius = 4
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:banana_trunk"},
|
||||
leaves = {"naturalbiomes:banana_leaves", "naturalbiomes:banana", "naturalbiomes:banana_bunch"},
|
||||
radius = 4
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:olive_trunk"},
|
||||
leaves = {"naturalbiomes:olive_leaves", "naturalbiomes:olives"},
|
||||
radius = 6
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:pine_trunk"},
|
||||
leaves = {"naturalbiomes:pine_leaves"},
|
||||
radius = 8
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:med_bush_stem"},
|
||||
leaves = {"naturalbiomes:med_bush_leaves"},
|
||||
radius = 6
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:outback_trunk"},
|
||||
leaves = {"naturalbiomes:outback_leaves"},
|
||||
radius = 6
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:outback_bush_stem"},
|
||||
leaves = {"naturalbiomes:outback_bush_leaves"},
|
||||
radius = 6
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:palm_trunk"},
|
||||
leaves = {"naturalbiomes:palm_leaves", "naturalbiomes:coconut"},
|
||||
radius = 6
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:beach_bush_stem"},
|
||||
leaves = {"naturalbiomes:beach_bush_leaves"},
|
||||
radius = 4
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:acacia_trunk"},
|
||||
leaves = {"naturalbiomes:acacia_leaves"},
|
||||
radius = 7
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:heath_willow_trunk"},
|
||||
leaves = {"naturalbiomes:heath_willow_leaves2"},
|
||||
radius = 6
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:heath_juniper_trunk"},
|
||||
leaves = {"naturalbiomes:heath_juniper_leaves"},
|
||||
radius = 6
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:heath_birch_trunk"},
|
||||
leaves = {"naturalbiomes:heath_birch_leaves"},
|
||||
radius = 6
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:bushland_hazelnut_stem"},
|
||||
leaves = {"naturalbiomes:bushland_hazelnut_leaves", "naturalbiomes:bushland_hazelnut_leaves2"},
|
||||
radius = 4
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:bushland_wildrose_stem"},
|
||||
leaves = {"naturalbiomes:bushland_wildrose_leaves2", "naturalbiomes:bushland_wildrose_leaves"},
|
||||
radius = 4
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"naturalbiomes:bushland_blackberry_stem"},
|
||||
leaves = {"naturalbiomes:bushland_blackberry_leaves2", "naturalbiomes:bushland_blackberry_leaves"},
|
||||
radius = 4
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
if minetest.get_modpath("livingjungle") then
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingjungle:samauma_trunk"},
|
||||
leaves = {"livingjungle:samauma_leaves", "livingjungle:lianaleaves", "livingjungle:lianabranch", "livingjungle:lianabranch3"},
|
||||
radius = 9
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingjungle:liana_stem"},
|
||||
leaves = {"livingjungle:lianaleaves", "livingjungle:lianabranch", "livingjungle:lianabranch3"},
|
||||
radius = 6
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingjungle:mangrove_root2", "livingjungle:mangrove_stem"},
|
||||
leaves = {"livingjungle:mangrove_leaves"},
|
||||
radius = 5
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
if minetest.get_modpath("livingdesert") then
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingdesert:date_palm_trunk"},
|
||||
leaves = {"livingdesert:date_palm_leaves", "livingdesert:date_palm_fruits"},
|
||||
radius = 3
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingdesert:euphorbia_trunk"},
|
||||
leaves = {"livingdesert:euphorbia_leaves"},
|
||||
radius = 3
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingdesert:figcactus_trunk"},
|
||||
leaves = {"livingdesert:figcactus_flower", "livingdesert:figcactus_fruit"},
|
||||
radius = 3
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingdesert:saxaul_trunk"},
|
||||
leaves = {"livingdesert:saxaul_leaves"},
|
||||
radius = 3
|
||||
})
|
||||
|
||||
winuserleafdecay.register_winleafdecay({
|
||||
trunks = {"livingdesert:pine_trunk"},
|
||||
leaves = {"livingdesert:pine_leaves", "livingdesert:pine_leaves2", "livingdesert:pine_leaves3"},
|
||||
radius = 3
|
||||
})
|
||||
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
name = winuserleafdecay
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 637 KiB |
Reference in New Issue
Block a user