Fix a couple minor bugs
This commit is contained in:
parent
af33315061
commit
14c51b153f
@ -32,11 +32,42 @@ end
|
||||
function default.grow_tree(pos, variety)
|
||||
local function grow()
|
||||
if variety == "apple" then
|
||||
minetest.place_schematic({x = pos.x-2, y = pos.y-1, z = pos.z-2}, minetest.get_modpath("default").."/schematics/default_tree.mts", "0", {}, false)
|
||||
minetest.place_schematic(
|
||||
{
|
||||
x = pos.x-2,
|
||||
y = pos.y-1,
|
||||
z = pos.z-2
|
||||
},
|
||||
minetest.get_modpath("default")
|
||||
.. "/schematics/default_tree.mts", "0", {}, false)
|
||||
elseif variety == "oak" then
|
||||
minetest.place_schematic({x = pos.x-2, y = pos.y-1, z = pos.z-2}, minetest.get_modpath("default").."/schematics/default_tree.mts", "0", {["default:leaves"] = "default:leaves_oak", ["default:tree"] = "default:tree_oak", ["default:apple"] = "air"}, false)
|
||||
minetest.place_schematic(
|
||||
{
|
||||
x = pos.x-2,
|
||||
y = pos.y-1,
|
||||
z = pos.z-2
|
||||
},
|
||||
minetest.get_modpath("default")
|
||||
.. "/schematics/default_tree.mts", "0",
|
||||
{
|
||||
["default:leaves"] = "default:leaves_oak",
|
||||
["default:tree"] = "default:tree_oak",
|
||||
["default:apple"] = "air"
|
||||
}, false)
|
||||
elseif variety == "birch" then
|
||||
minetest.place_schematic({x = pos.x-1, y = pos.y-1, z = pos.z-1}, minetest.get_modpath("default").."/schematics/default_squaretree.mts", "0", {["default:leaves"] = "default:leaves_birch", ["default:tree"] = "default:tree_birch", ["default:apple"] = "air"}, false)
|
||||
minetest.place_schematic(
|
||||
{
|
||||
x = pos.x-1,
|
||||
y = pos.y-1,
|
||||
z = pos.z-1
|
||||
},
|
||||
minetest.get_modpath("default")
|
||||
.. "/schematics/default_squaretree.mts", "0",
|
||||
{
|
||||
["default:leaves"] = "default:leaves_birch",
|
||||
["default:tree"] = "default:tree_birch",
|
||||
["default:apple"] = "air"
|
||||
}, false)
|
||||
end
|
||||
end
|
||||
|
||||
@ -49,13 +80,16 @@ end
|
||||
|
||||
minetest.register_abm( -- apple trees or default trees
|
||||
{
|
||||
label = "Grow apple saplings",
|
||||
nodenames = {"default:sapling"},
|
||||
interval = 10,
|
||||
chance = 40,
|
||||
action = function(pos, node)
|
||||
local is_soil = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name].groups.soil
|
||||
|
||||
if is_soil == nil or is_soil == 0 then return end
|
||||
if is_soil == nil or is_soil == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
default.grow_tree(pos, "apple")
|
||||
end
|
||||
@ -63,24 +97,34 @@ minetest.register_abm( -- apple trees or default trees
|
||||
|
||||
minetest.register_abm( -- oak trees
|
||||
{
|
||||
label = "Grow oak saplings",
|
||||
nodenames = {"default:sapling_oak"},
|
||||
interval = 10,
|
||||
chance = 60,
|
||||
action = function(pos, node)
|
||||
local is_soil = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name].groups.soil
|
||||
if is_soil == nil or is_soil == 0 then return end
|
||||
|
||||
if is_soil == nil or is_soil == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
default.grow_tree(pos, "oak")
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm( -- birch trees
|
||||
{
|
||||
label = "Grow birch saplings",
|
||||
nodenames = {"default:sapling_birch"},
|
||||
interval = 10,
|
||||
chance = 50,
|
||||
action = function(pos, node)
|
||||
local is_soil = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name].groups.soil
|
||||
if is_soil == nil or is_soil == 0 then return end
|
||||
|
||||
if is_soil == nil or is_soil == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
default.grow_tree(pos, "birch")
|
||||
end
|
||||
})
|
||||
@ -97,7 +141,6 @@ function default.dig_up(pos, node, digger)
|
||||
end
|
||||
|
||||
function default.dig_down(pos, node, digger)
|
||||
-- if digger == nil then return end
|
||||
local np = {x = pos.x, y = pos.y - 1, z = pos.z}
|
||||
local nn = minetest.get_node(np)
|
||||
if nn.name == node.name then
|
||||
@ -126,6 +169,8 @@ default.after_place_leaves = function(pos, placer, itemstack, pointed_thing)
|
||||
|
||||
minetest.register_abm( -- leaf decay
|
||||
{
|
||||
|
||||
label = "Leaf decay",
|
||||
nodenames = {"group:leafdecay"},
|
||||
neighbors = {"air", "group:liquid"},
|
||||
-- A low interval and a high inverse chance spreads the load
|
||||
@ -199,6 +244,7 @@ minetest.register_abm( -- leaf decay
|
||||
|
||||
minetest.register_abm( -- dirt and grass footsteps becomes dirt with grass if uncovered
|
||||
{
|
||||
label = "Grow dirt",
|
||||
nodenames = {"default:dirt", "default:dirt_with_grass_footsteps"},
|
||||
interval = 2,
|
||||
chance = 40,
|
||||
@ -214,6 +260,7 @@ minetest.register_abm( -- dirt and grass footsteps becomes dirt with grass if un
|
||||
|
||||
minetest.register_abm( -- dirt with grass becomes dirt if covered
|
||||
{
|
||||
label = "Remove grass on covered dirt",
|
||||
nodenames = {"default:dirt_with_grass"},
|
||||
interval = 2,
|
||||
chance = 10,
|
||||
@ -229,6 +276,7 @@ minetest.register_abm( -- dirt with grass becomes dirt if covered
|
||||
|
||||
minetest.register_abm( -- grass expands
|
||||
{
|
||||
label = "Grass expansion",
|
||||
nodenames = {"default:grass"},
|
||||
interval = 20,
|
||||
chance = 160,
|
||||
@ -249,6 +297,7 @@ minetest.register_abm( -- grass expands
|
||||
|
||||
minetest.register_abm( -- clams grow
|
||||
{
|
||||
label = "Growing clams",
|
||||
nodenames = {"default:clam"},
|
||||
interval = 20,
|
||||
chance = 160,
|
||||
@ -269,6 +318,7 @@ minetest.register_abm( -- clams grow
|
||||
|
||||
minetest.register_abm( -- cactus grows
|
||||
{
|
||||
label = "Growing cacti",
|
||||
nodenames = {"default:cactus"},
|
||||
neighbors = {"group:sand"},
|
||||
interval = 20,
|
||||
@ -294,6 +344,7 @@ minetest.register_abm( -- cactus grows
|
||||
|
||||
minetest.register_abm( -- papyrus grows
|
||||
{
|
||||
label = "Growing papyrus",
|
||||
nodenames = {"default:papyrus"},
|
||||
neighbors = {"group:plantable_sandy", "group:plantable_soil"},
|
||||
interval = 20,
|
||||
@ -319,55 +370,9 @@ minetest.register_abm( -- papyrus grows
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm( -- papyrus grows
|
||||
{
|
||||
nodenames = {"default:thistle"},
|
||||
neighbors = {"group:plantable_soil"},
|
||||
interval = 20,
|
||||
chance = 30,
|
||||
action = function(pos, node)
|
||||
local height = 0
|
||||
while minetest.get_node(pos).name == "default:thistle" and height < 3 do
|
||||
height = height+1
|
||||
pos.y = pos.y+1
|
||||
end
|
||||
if height < 3 then
|
||||
if minetest.get_node(pos).name == "air" then
|
||||
minetest.set_node(pos, {name="default:thistle"})
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
--[[ TORCH FLAME IS VERY, VERY SLOW, THERE ARE NOW ANIMATIONS INSTEAD
|
||||
minetest.register_abm( -- torch flame
|
||||
{
|
||||
nodenames = {"default:torch", "default:torch_weak"},
|
||||
interval = 5,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
minetest.add_particlespawner(
|
||||
{
|
||||
amount = 10,
|
||||
time = 5,
|
||||
minpos = {x = pos.x-0.1, y = pos.y-0.4, z = pos.z-0.1},
|
||||
maxpos = {x = pos.x+0.1, y = pos.y, z = pos.z+0.1},
|
||||
minvel = {x = -0.3, y = 0.3, z = -0.3},
|
||||
maxvel = {x = 0.3, y = 1, z = 0.3},
|
||||
minacc = {x = 0, y = 0.5, z = -0},
|
||||
maxacc = {x = 0, y = 2, z = 0},
|
||||
minexptime = 0.3,
|
||||
maxexptime = 0.6,
|
||||
minsize = 4,
|
||||
maxsize = 6,
|
||||
texture = "spark.png"
|
||||
})
|
||||
end
|
||||
})
|
||||
--]]
|
||||
|
||||
minetest.register_abm( -- weak torchs burn out and die after ~3 minutes
|
||||
{
|
||||
label = "Burning out weak torches",
|
||||
nodenames = {"default:torch_weak"},
|
||||
interval = 3,
|
||||
chance = 60,
|
||||
|
@ -131,6 +131,7 @@ end
|
||||
|
||||
minetest.register_abm(
|
||||
{
|
||||
label = "Furnace",
|
||||
nodenames = {"default:furnace", "default:furnace_active"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- Tool definitions
|
||||
--
|
||||
|
||||
local creative_digtime=0.5
|
||||
local creative_digtime = 0.15
|
||||
|
||||
local tool_levels = nil
|
||||
|
||||
|
@ -41,6 +41,7 @@ function farming.register_plant(name, plant)
|
||||
|
||||
minetest.register_abm(
|
||||
{
|
||||
label = "Farming growing (" .. name .. ")",
|
||||
nodenames = {
|
||||
"farming:"..name.."_1",
|
||||
"farming:"..name.."_2",
|
||||
|
@ -336,7 +336,7 @@ local function fake_on_item_eat(hpdata, replace_with_item, itemstack,
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if minetest.setting_getbool("hunger_enable") then
|
||||
if minetest.setting_getbool("enable_damage") and minetest.setting_getbool("hunger_enable") then
|
||||
|
||||
minetest.after(0, on_load)
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
--
|
||||
-- Item drop mod
|
||||
-- By PilzAdam
|
||||
@ -15,41 +16,70 @@ minetest.register_globalstep(
|
||||
local pos = player:getpos()
|
||||
local inv = player:get_inventory()
|
||||
|
||||
for _,object in ipairs(minetest.get_objects_inside_radius(pos, 1.35)) do
|
||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" and valid(object) then
|
||||
if inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
|
||||
local in_radius = minetest.get_objects_inside_radius(pos, 6.0)
|
||||
|
||||
for _,object in ipairs(in_radius) do
|
||||
if not object:is_player() and object:get_luaentity()
|
||||
and object:get_luaentity().name == "__builtin:item" and valid(object) then
|
||||
local pos1 = pos
|
||||
|
||||
pos1.y = pos1.y + 0.2
|
||||
|
||||
local pos2 = object:getpos()
|
||||
local vec = {x=pos1.x-pos2.x, y=pos1.y-pos2.y, z=pos1.z-pos2.z}
|
||||
|
||||
local vec = {
|
||||
x = pos1.x - pos2.x,
|
||||
y = pos1.y - pos2.y,
|
||||
z = pos1.z - pos2.z
|
||||
}
|
||||
|
||||
local len = vector.length(vec)
|
||||
|
||||
if len < 1.35 then
|
||||
if inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
|
||||
if len > 0.5 then
|
||||
vec = vector.divide(vec, len) -- it's a normalize but we have len yet (vector.normalize(vec))
|
||||
vec = vector.divide(vec, len) -- It's a normalize but we have len yet (vector.normalize(vec))
|
||||
|
||||
vec.x = vec.x*3
|
||||
vec.y = vec.y*3
|
||||
vec.z = vec.z*3
|
||||
|
||||
object:setvelocity(vec)
|
||||
|
||||
object:get_luaentity().physical_state = false
|
||||
object:get_luaentity().object:set_properties(
|
||||
{
|
||||
physical = false
|
||||
})
|
||||
|
||||
object:get_luaentity().object:set_properties({physical = false})
|
||||
else
|
||||
local lua = object:get_luaentity()
|
||||
|
||||
if object == nil or lua == nil or lua.itemstring == nil then
|
||||
return
|
||||
end
|
||||
|
||||
if inv:room_for_item("main", ItemStack(lua.itemstring)) then
|
||||
inv:add_item("main", ItemStack(lua.itemstring))
|
||||
|
||||
if lua.itemstring ~= "" then
|
||||
minetest.sound_play("item_drop_pickup", {pos = pos, gain = 0.3, max_hear_distance = 16})
|
||||
minetest.sound_play(
|
||||
"item_drop_pickup",
|
||||
{
|
||||
pos = pos,
|
||||
gain = 0.3,
|
||||
max_hear_distance = 16
|
||||
})
|
||||
end
|
||||
|
||||
lua.itemstring = ""
|
||||
object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
object:setvelocity({x = 0, y = 0, z = 0})
|
||||
lua.physical_state = true
|
||||
lua.object:set_properties(
|
||||
|
||||
object:get_luaentity().physical_state = true
|
||||
|
||||
object:get_luaentity().object:set_properties(
|
||||
{
|
||||
physical = true
|
||||
})
|
||||
@ -58,8 +88,6 @@ minetest.register_globalstep(
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
function minetest.handle_node_drops(pos, drops, digger)
|
||||
|
@ -137,6 +137,7 @@ minetest.register_ore(
|
||||
|
||||
minetest.register_abm(
|
||||
{
|
||||
label = "Lumien crystals",
|
||||
nodenames = {"lumien:crystal_on"},
|
||||
interval = timer_interval,
|
||||
chance = 1,
|
||||
|
@ -1293,6 +1293,7 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter
|
||||
mobs.spawning_mobs[name] = true
|
||||
minetest.register_abm(
|
||||
{
|
||||
label = "Mob spawn (" .. name .. ")",
|
||||
nodenames = nodes,
|
||||
neighbors = neighbors,
|
||||
interval = interval,
|
||||
|
@ -131,6 +131,7 @@ if minetest.setting_getbool("music_enable") then
|
||||
|
||||
minetest.register_abm(
|
||||
{
|
||||
label = "Music player",
|
||||
nodenames = {"music:player"},
|
||||
chance = 1,
|
||||
interval = 1,
|
||||
|
Loading…
Reference in New Issue
Block a user