items now drop from liquids and water cant push
This commit is contained in:
parent
be4825fc2e
commit
12d1bc6fe0
@ -95,52 +95,6 @@ minetest.register_entity(":__builtin:item", {
|
||||
return
|
||||
end
|
||||
|
||||
if minetest.registered_nodes[name].liquidtype == "flowing" then
|
||||
get_flowing_dir = function(self)
|
||||
local pos = self.object:getpos()
|
||||
local param2 = minetest.env:get_node(pos).param2
|
||||
for i,d in ipairs({-1, 1, -1, 1}) do
|
||||
if i<3 then
|
||||
pos.x = pos.x+d
|
||||
else
|
||||
pos.z = pos.z+d
|
||||
end
|
||||
|
||||
local name = minetest.env:get_node(pos).name
|
||||
local par2 = minetest.env:get_node(pos).param2
|
||||
if name == "mapgen:water_flowing" and par2 < param2 then
|
||||
return pos
|
||||
end
|
||||
|
||||
if i<3 then
|
||||
pos.x = pos.x-d
|
||||
else
|
||||
pos.z = pos.z-d
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local vec = get_flowing_dir(self)
|
||||
if vec then
|
||||
local v = self.object:getvelocity()
|
||||
if vec and vec.x-p.x > 0 then
|
||||
self.object:setvelocity({x=0.5,y=v.y,z=0})
|
||||
elseif vec and vec.x-p.x < 0 then
|
||||
self.object:setvelocity({x=-0.5,y=v.y,z=0})
|
||||
elseif vec and vec.z-p.z > 0 then
|
||||
self.object:setvelocity({x=0,y=v.y,z=0.5})
|
||||
elseif vec and vec.z-p.z < 0 then
|
||||
self.object:setvelocity({x=0,y=v.y,z=-0.5})
|
||||
end
|
||||
self.object:setacceleration({x=0, y=-10, z=0})
|
||||
self.physical_state = true
|
||||
self.object:set_properties({
|
||||
physical = true
|
||||
})
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
p.y = p.y - 0.3
|
||||
local nn = minetest.env:get_node(p).name
|
||||
-- If node is not registered or node is walkably solid
|
||||
|
@ -188,32 +188,32 @@ minetest.register_abm({
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:papyrus"},
|
||||
neighbors = {"default:dirt", "default:dirt_with_grass"},
|
||||
interval = 50,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y-1
|
||||
local name = minetest.get_node(pos).name
|
||||
if name == "default:dirt" or name == "default:dirt_with_grass" then
|
||||
if minetest.find_node_near(pos, 3, {"group:water"}) == nil then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
local height = 0
|
||||
while minetest.get_node(pos).name == "default:papyrus" and height < 4 do
|
||||
height = height+1
|
||||
pos.y = pos.y+1
|
||||
end
|
||||
if height < 4 then
|
||||
if minetest.get_node(pos).name == "air" then
|
||||
minetest.set_node(pos, {name="default:papyrus"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
-- minetest.register_abm({
|
||||
-- nodenames = {"default:papyrus"},
|
||||
-- neighbors = {"default:dirt", "default:dirt_with_grass"},
|
||||
-- interval = 50,
|
||||
-- chance = 20,
|
||||
-- action = function(pos, node)
|
||||
-- pos.y = pos.y-1
|
||||
-- local name = minetest.get_node(pos).name
|
||||
-- if name == "default:dirt" or name == "default:dirt_with_grass" then
|
||||
-- if minetest.find_node_near(pos, 3, {"group:water"}) == nil then
|
||||
-- return
|
||||
-- end
|
||||
-- pos.y = pos.y+1
|
||||
-- local height = 0
|
||||
-- while minetest.get_node(pos).name == "default:papyrus" and height < 4 do
|
||||
-- height = height+1
|
||||
-- pos.y = pos.y+1
|
||||
-- end
|
||||
-- if height < 4 then
|
||||
-- if minetest.get_node(pos).name == "air" then
|
||||
-- minetest.set_node(pos, {name="default:papyrus"})
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
--
|
||||
-- Leafdecay
|
||||
|
79
mods/misc/init.lua
Normal file
79
mods/misc/init.lua
Normal file
@ -0,0 +1,79 @@
|
||||
-- init.lua part of the misc mod.
|
||||
|
||||
function attached_node(p)
|
||||
local nn = core.get_node(p).name
|
||||
core.remove_node(p)
|
||||
for _,item in ipairs(core.get_node_drops(nn, "")) do
|
||||
local pos = {
|
||||
x = p.x + math.random()/2 - 0.25,
|
||||
y = p.y + math.random()/2 - 0.25,
|
||||
z = p.z + math.random()/2 - 0.25,
|
||||
}
|
||||
core.add_item(pos, item)
|
||||
end
|
||||
end
|
||||
|
||||
liquids = {
|
||||
"mapgen:water_flowing",
|
||||
"mapgen:water_source",
|
||||
"mapgen:lava_flowing",
|
||||
"mapgen:lava_source",
|
||||
"ores:oil_source",
|
||||
"ores:oil_flowing"
|
||||
}
|
||||
|
||||
node_list = {
|
||||
"flowers:dandelion_white",
|
||||
"flowers:dandelion_yellow",
|
||||
"flowers:geranium",
|
||||
"flowers:rose",
|
||||
"flowers:tulip",
|
||||
"flowers:viola",
|
||||
"mapgen:long_grass_1",
|
||||
"mapgen:long_grass_2",
|
||||
"mapgen:long_grass_3",
|
||||
"mapgen:long_grass_4",
|
||||
"mapgen:long_grass_5",
|
||||
"deco:torch",
|
||||
"mapgen:dead_bush",
|
||||
"mapgen:oak_sapling",
|
||||
"mapgen:cherry_sapling",
|
||||
"mapgen:birch_sapling",
|
||||
"mapgen:evergreen_sapling",
|
||||
"mapgen:deathly_sapling",
|
||||
"mapgen:snow",
|
||||
"mapgen:wheat_grass_1",
|
||||
"mapgen:wheat_grass_2",
|
||||
"mapgen:wheat_grass_3",
|
||||
"mapgen:wheat_grass_4",
|
||||
"mapgen:wheat_grass_5",
|
||||
"mapgen:deathly_long_grass_1",
|
||||
"mapgen:deathly_long_grass_2",
|
||||
"mapgen:deathly_long_grass_3",
|
||||
"farming:wheat_1",
|
||||
"farming:wheat_2",
|
||||
"farming:wheat_3",
|
||||
"farming:wheat_4",
|
||||
"farming:wheat_5",
|
||||
"farming:wheat_6",
|
||||
"farming:wheat_7",
|
||||
"farming:wheat_8",
|
||||
"farming:cotton_1",
|
||||
"farming:cotton_2",
|
||||
"farming:cotton_3",
|
||||
"farming:cotton_4",
|
||||
"farming:cotton_5",
|
||||
"farming:cotton_6",
|
||||
"farming:cotton_7",
|
||||
"farming:cotton_8"
|
||||
}
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = node_list,
|
||||
neighbors = liquids,
|
||||
interval = 1,
|
||||
chance = 2,
|
||||
action = function(pos)
|
||||
attached_node(pos)
|
||||
end,
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user