Clean up soil checking code in melon/pumpkin
This commit is contained in:
parent
d06df50d96
commit
6456351722
|
@ -280,9 +280,11 @@ minetest.register_abm({
|
||||||
newpos = {x=pos.x+x, y=pos.y, z=pos.z}
|
newpos = {x=pos.x+x, y=pos.y, z=pos.z}
|
||||||
local n = minetest.get_node(p)
|
local n = minetest.get_node(p)
|
||||||
local nod = minetest.get_node(newpos)
|
local nod = minetest.get_node(newpos)
|
||||||
|
local soilgroup = minetest.get_item_group(n.name, "soil")
|
||||||
|
|
||||||
if n.name=="mcl_core:dirt_with_grass" and nod.name=="air" and have_change == 0
|
if n.name=="mcl_core:dirt_with_grass" and nod.name=="air" and have_change == 0
|
||||||
or n.name=="mcl_core:dirt" and nod.name=="air" and have_change == 0
|
or n.name=="mcl_core:dirt" and nod.name=="air" and have_change == 0
|
||||||
or string.find(n.name, "mcl_farming:soil") and nod.name=="air" and have_change == 0 then
|
or (soilgroup == 2 or soilgroup == 3) and nod.name=="air" and have_change == 0 then
|
||||||
have_change = 1
|
have_change = 1
|
||||||
minetest.add_node(newpos, {name="mcl_farming:melon"})
|
minetest.add_node(newpos, {name="mcl_farming:melon"})
|
||||||
if x == 1 then
|
if x == 1 then
|
||||||
|
@ -298,9 +300,11 @@ minetest.register_abm({
|
||||||
newpos = {x=pos.x, y=pos.y, z=pos.z+z}
|
newpos = {x=pos.x, y=pos.y, z=pos.z+z}
|
||||||
local n = minetest.get_node(p)
|
local n = minetest.get_node(p)
|
||||||
local nod2 = minetest.get_node(newpos)
|
local nod2 = minetest.get_node(newpos)
|
||||||
|
local soilgroup = minetest.get_item_group(n.name, "soil")
|
||||||
|
|
||||||
if n.name=="mcl_core:dirt_with_grass" and nod2.name=="air" and have_change == 0
|
if n.name=="mcl_core:dirt_with_grass" and nod2.name=="air" and have_change == 0
|
||||||
or n.name=="mcl_core:dirt" and nod2.name=="air" and have_change == 0
|
or n.name=="mcl_core:dirt" and nod2.name=="air" and have_change == 0
|
||||||
or string.find(n.name, "mcl_farming:soil") and nod2.name=="air" and have_change == 0 then
|
or (soilgroup == 2 or soilgroup == 3) and nod2.name=="air" and have_change == 0 then
|
||||||
have_change = 1
|
have_change = 1
|
||||||
minetest.add_node(newpos, {name="mcl_farming:melon"})
|
minetest.add_node(newpos, {name="mcl_farming:melon"})
|
||||||
if z == 1 then
|
if z == 1 then
|
||||||
|
|
|
@ -254,8 +254,8 @@ mcl_farming:add_plant("mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"mcl_farming:pumpkintige_unconnect"},
|
nodenames = {"mcl_farming:pumpkintige_unconnect"},
|
||||||
neighbors = {"air"},
|
neighbors = {"air"},
|
||||||
interval = 30,
|
interval = 1,
|
||||||
chance = 15,
|
chance = 1,
|
||||||
action = function(pos)
|
action = function(pos)
|
||||||
local have_change = 0
|
local have_change = 0
|
||||||
local newpos = {x=pos.x, y=pos.y, z=pos.z}
|
local newpos = {x=pos.x, y=pos.y, z=pos.z}
|
||||||
|
@ -266,9 +266,10 @@ minetest.register_abm({
|
||||||
newpos = {x=pos.x+x, y=pos.y, z=pos.z}
|
newpos = {x=pos.x+x, y=pos.y, z=pos.z}
|
||||||
local n = minetest.get_node(p)
|
local n = minetest.get_node(p)
|
||||||
local nod = minetest.get_node(newpos)
|
local nod = minetest.get_node(newpos)
|
||||||
|
local soilgroup = minetest.get_item_group(n.name, "soil")
|
||||||
if n.name=="mcl_core:dirt_with_grass" and nod.name=="air" and have_change == 0
|
if n.name=="mcl_core:dirt_with_grass" and nod.name=="air" and have_change == 0
|
||||||
or n.name=="mcl_core:dirt" and nod.name=="air" and have_change == 0
|
or n.name=="mcl_core:dirt" and nod.name=="air" and have_change == 0
|
||||||
or string.find(n.name, "mcl_farming:soil") and nod.name=="air" and have_change == 0 then
|
or (soilgroup == 2 or soilgroup == 3) and nod.name=="air" and have_change == 0 then
|
||||||
have_change = 1
|
have_change = 1
|
||||||
minetest.add_node(newpos, {name="mcl_farming:pumpkin_face"})
|
minetest.add_node(newpos, {name="mcl_farming:pumpkin_face"})
|
||||||
if x == 1 then
|
if x == 1 then
|
||||||
|
@ -284,9 +285,10 @@ minetest.register_abm({
|
||||||
newpos = {x=pos.x, y=pos.y, z=pos.z+z}
|
newpos = {x=pos.x, y=pos.y, z=pos.z+z}
|
||||||
local n = minetest.get_node(p)
|
local n = minetest.get_node(p)
|
||||||
local nod2 = minetest.get_node(newpos)
|
local nod2 = minetest.get_node(newpos)
|
||||||
|
local soilgroup = minetest.get_item_group(n.name, "soil")
|
||||||
if n.name=="mcl_core:dirt_with_grass" and nod2.name=="air" and have_change == 0
|
if n.name=="mcl_core:dirt_with_grass" and nod2.name=="air" and have_change == 0
|
||||||
or n.name=="mcl_core:dirt" and nod2.name=="air" and have_change == 0
|
or n.name=="mcl_core:dirt" and nod2.name=="air" and have_change == 0
|
||||||
or string.find(n.name, "mcl_farming:soil") and nod2.name=="air" and have_change == 0 then
|
or (soilgroup == 2 or soilgroup == 3) and nod2.name=="air" and have_change == 0 then
|
||||||
have_change = 1
|
have_change = 1
|
||||||
minetest.add_node(newpos, {name="mcl_farming:pumpkin_face"})
|
minetest.add_node(newpos, {name="mcl_farming:pumpkin_face"})
|
||||||
if z == 1 then
|
if z == 1 then
|
||||||
|
|
Loading…
Reference in New Issue