Code Tidy (thanks HybridDog)
This commit is contained in:
parent
f438eadeb9
commit
87316b5083
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
+## Generic ignorable patterns and files
|
||||||
|
+*~
|
||||||
|
+debug.txt
|
@ -13,6 +13,7 @@ Ethereal v7 Mapgen mod for Minetest
|
|||||||
- Changed frost dirt so that it no longer freezes water (saves lag)
|
- Changed frost dirt so that it no longer freezes water (saves lag)
|
||||||
- Torches cannot be placed next to water, otherwise they drop as items
|
- Torches cannot be placed next to water, otherwise they drop as items
|
||||||
- Added latest farming redo Bean Bushes to mapgen
|
- Added latest farming redo Bean Bushes to mapgen
|
||||||
|
- Code tidy (thanks HybridDog)
|
||||||
|
|
||||||
### 1.15
|
### 1.15
|
||||||
|
|
||||||
|
37
extra.lua
37
extra.lua
@ -267,12 +267,15 @@ minetest.register_tool("ethereal:light_staff", {
|
|||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
|
||||||
|
if pointed_thing.type ~= "node" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
|
local pname = user:get_player_name()
|
||||||
|
|
||||||
if pointed_thing.type ~= "node" then return end
|
if minetest.is_protected(pos, pname) then
|
||||||
|
minetest.record_protection_violation(pos, pname)
|
||||||
if minetest.is_protected(pos, user:get_player_name()) then
|
|
||||||
minetest.record_protection_violation(pos, user:get_player_name())
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -286,29 +289,29 @@ minetest.register_tool("ethereal:light_staff", {
|
|||||||
|
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
itemstack:add_wear(65535 / (USES - 1))
|
itemstack:add_wear(65535 / (USES - 1))
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "ethereal:light_staff",
|
output = "ethereal:light_staff",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"ethereal:illumishroom", "default:mese_crystal", "ethereal:illumishroom"},
|
{"ethereal:illumishroom", "default:mese_crystal", "ethereal:illumishroom"},
|
||||||
{"ethereal:illumishroom2", "default:steel_ingot", "ethereal:illumishroom2"},
|
{"ethereal:illumishroom2", "default:steel_ingot", "ethereal:illumishroom2"},
|
||||||
{"ethereal:illumishroom3", "default:steel_ingot", "ethereal:illumishroom3"}
|
{"ethereal:illumishroom3", "default:steel_ingot", "ethereal:illumishroom3"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Generate Illumishroom in caves next to coal
|
-- Generate Illumishroom in caves next to coal
|
||||||
minetest.register_on_generated(function(minp, maxp, seed)
|
minetest.register_on_generated(function(minp, maxp)
|
||||||
|
if minp.y > -30
|
||||||
local coal_nodes = minetest.find_nodes_in_area(minp, maxp, "default:stone_with_coal")
|
or maxp.y < -3000 then
|
||||||
|
return
|
||||||
|
end
|
||||||
local bpos
|
local bpos
|
||||||
for key, pos in pairs(coal_nodes) do
|
for key, pos in pairs(minetest.find_nodes_in_area(minp, maxp, "default:stone_with_coal")) do
|
||||||
|
|
||||||
bpos = { x=pos.x, y=pos.y + 1, z=pos.z }
|
bpos = { x=pos.x, y=pos.y + 1, z=pos.z }
|
||||||
|
|
||||||
if minetest.get_node(bpos).name == "air" then
|
if minetest.get_node(bpos).name == "air" then
|
||||||
if bpos.y > -3000 and bpos.y < -2000 then
|
if bpos.y > -3000 and bpos.y < -2000 then
|
||||||
minetest.add_node(bpos, {name = "ethereal:illumishroom3"})
|
minetest.add_node(bpos, {name = "ethereal:illumishroom3"})
|
||||||
|
27
gates.lua
27
gates.lua
@ -15,18 +15,20 @@ local nb_pil = {
|
|||||||
|
|
||||||
-- Open/Close Gates
|
-- Open/Close Gates
|
||||||
function gate_rightclick(pos, node)
|
function gate_rightclick(pos, node)
|
||||||
local data = nil
|
local gate, open = unpack(string.split(node.name, "_", 2))
|
||||||
data = string.split(node.name, "_", 2)
|
local gate = gate.."_"
|
||||||
local gate = data[1].."_"
|
|
||||||
local open = data[2]
|
local sound, name
|
||||||
|
|
||||||
if open == "open" then
|
if open == "open" then
|
||||||
minetest.sound_play("doors_door_close", {pos=pos, gain = 0.3, max_hear_distance = 10})
|
sound = "close"
|
||||||
minetest.set_node(pos, {name=gate.."closed", param2=node.param2})
|
name = "closed"
|
||||||
else
|
else
|
||||||
minetest.sound_play("doors_door_open", {pos=pos, gain = 0.3, max_hear_distance = 10})
|
sound = "open"
|
||||||
minetest.set_node(pos, {name=gate.."open", param2=node.param2})
|
name = "open"
|
||||||
end
|
end
|
||||||
|
node.name = gate..name
|
||||||
|
minetest.set_node(pos, node)
|
||||||
|
minetest.sound_play("doors_door_"..sound, {pos=pos, gain = 0.3, max_hear_distance = 10})
|
||||||
end
|
end
|
||||||
|
|
||||||
local gate = {}
|
local gate = {}
|
||||||
@ -46,11 +48,8 @@ gate.type = {
|
|||||||
{"pine", "Pine Wood", "default_pinewood.png", "default:pinewood"},
|
{"pine", "Pine Wood", "default_pinewood.png", "default:pinewood"},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, row in ipairs(gate.type) do
|
for _, row in pairs(gate.type) do
|
||||||
local name = row[1]
|
local name, desc, texture, nod = unpack(row)
|
||||||
local desc = row[2]
|
|
||||||
local texture = row[3]
|
|
||||||
local nod = row[4]
|
|
||||||
|
|
||||||
minetest.register_node("ethereal:"..name.."gate_open", {
|
minetest.register_node("ethereal:"..name.."gate_open", {
|
||||||
tiles = {texture},
|
tiles = {texture},
|
||||||
|
18
leaves.lua
18
leaves.lua
@ -74,16 +74,11 @@ minetest.register_node("ethereal:redwood_leaves", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- Default Apple Tree Leaves
|
-- Default Apple Tree Leaves
|
||||||
minetest.register_node(":default:leaves", {
|
minetest.override_item("default:leaves", {
|
||||||
description = "Leaves",
|
|
||||||
drawtype = leaftype,
|
drawtype = leaftype,
|
||||||
visual_scale = 1.2,
|
visual_scale = 1.2,
|
||||||
tiles = {"default_leaves.png"},
|
|
||||||
inventory_image = "default_leaves.png",
|
inventory_image = "default_leaves.png",
|
||||||
paramtype = "light",
|
|
||||||
walkable = false,
|
walkable = false,
|
||||||
waving = 1,
|
|
||||||
groups = {snappy=3, leafdecay=3, leaves=1, flammable=2},
|
|
||||||
drop = {
|
drop = {
|
||||||
max_items = 1,
|
max_items = 1,
|
||||||
items = {
|
items = {
|
||||||
@ -91,8 +86,6 @@ minetest.register_node(":default:leaves", {
|
|||||||
{ items = {"default:leaves"}}
|
{ items = {"default:leaves"}}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
after_place_node = default.after_place_leaves,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Default Orange Tree Leaves
|
-- Default Orange Tree Leaves
|
||||||
@ -118,16 +111,11 @@ minetest.register_node("ethereal:orange_leaves", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- Default Jungle Tree Leaves
|
-- Default Jungle Tree Leaves
|
||||||
minetest.register_node(":default:jungleleaves", {
|
minetest.override_item("default:jungleleaves", {
|
||||||
description = "Jungle Leaves",
|
|
||||||
drawtype = leaftype,
|
drawtype = leaftype,
|
||||||
visual_scale = 1.2,
|
visual_scale = 1.2,
|
||||||
tiles = {"default_jungleleaves.png"},
|
|
||||||
inventory_image = "default_jungleleaves.png",
|
inventory_image = "default_jungleleaves.png",
|
||||||
paramtype = "light",
|
|
||||||
walkable = false,
|
walkable = false,
|
||||||
waving = 1,
|
|
||||||
groups = {snappy=3, leafdecay=3, leaves=1, flammable=2},
|
|
||||||
drop = {
|
drop = {
|
||||||
max_items = 1,
|
max_items = 1,
|
||||||
items = {
|
items = {
|
||||||
@ -135,8 +123,6 @@ minetest.register_node(":default:jungleleaves", {
|
|||||||
{ items = {"default:jungleleaves"}}
|
{ items = {"default:jungleleaves"}}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
after_place_node = default.after_place_leaves,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Default Banana Tree Leaves
|
-- Default Banana Tree Leaves
|
||||||
|
102
mushroom.lua
102
mushroom.lua
@ -56,7 +56,7 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- Define Mushroom growth stages
|
-- Define Mushroom growth stages
|
||||||
minetest.register_node("ethereal:mushroom_1", {
|
local ndef = {
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
tiles = {"ethereal_mushroom_garden_1.png"},
|
tiles = {"ethereal_mushroom_garden_1.png"},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
@ -65,73 +65,32 @@ minetest.register_node("ethereal:mushroom_1", {
|
|||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
drop = {
|
drop = {
|
||||||
items = {
|
items = {
|
||||||
{items = {"ethereal:mushroom_craftingitem 1"},rarity=1},
|
{items = {"ethereal:mushroom_craftingitem"},rarity=1},
|
||||||
{items = {"ethereal:mushroom_plant 1"},rarity=14},
|
{items = {"ethereal:mushroom_plant"},rarity=14},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
|
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
|
||||||
groups = {snappy=3,flammable=2,plant=1,mushroom=1,attached_node=1,growing=1,not_in_creative_inventory=1},
|
groups = {snappy=3,flammable=2,plant=1,mushroom=1,attached_node=1,growing=1,not_in_creative_inventory=1},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
})
|
}
|
||||||
minetest.register_alias("ethereal:mushroom_garden_1", "ethereal:mushroom_1")
|
minetest.register_node("ethereal:mushroom_1", table.copy(ndef))
|
||||||
|
|
||||||
minetest.register_node("ethereal:mushroom_2", {
|
ndef.tiles[1] = "ethereal_mushroom_garden_2.png"
|
||||||
drawtype = "plantlike",
|
ndef.drop.items[2].rarity = 7
|
||||||
tiles = {"ethereal_mushroom_garden_2.png"},
|
ndef.groups.mushroom = 2
|
||||||
paramtype = "light",
|
minetest.register_node("ethereal:mushroom_2", table.copy(ndef))
|
||||||
sunlight_propagates = true,
|
|
||||||
walkable = false,
|
|
||||||
drop = {
|
|
||||||
items = {
|
|
||||||
{items = {"ethereal:mushroom_craftingitem 1"},rarity=1},
|
|
||||||
{items = {"ethereal:mushroom_plant 1"},rarity=7},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
buildable_to = true,
|
|
||||||
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
|
|
||||||
groups = {snappy=3,flammable=2,plant=1,mushroom=2,attached_node=1,growing=1,not_in_creative_inventory=1},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
})
|
|
||||||
minetest.register_alias("ethereal:mushroom_garden_2", "ethereal:mushroom_2")
|
|
||||||
|
|
||||||
minetest.register_node("ethereal:mushroom_3", {
|
ndef.tiles[1] = "ethereal_mushroom_garden_3.png"
|
||||||
drawtype = "plantlike",
|
ndef.drop.items[2] = {items = {"ethereal:mushroom_plant 3"},rarity=3}
|
||||||
tiles = {"ethereal_mushroom_garden_3.png"},
|
ndef.groups.mushroom = 3
|
||||||
paramtype = "light",
|
minetest.register_node("ethereal:mushroom_3", table.copy(ndef))
|
||||||
sunlight_propagates = true,
|
|
||||||
walkable = false,
|
|
||||||
drop = {
|
|
||||||
items = {
|
|
||||||
{items = {"ethereal:mushroom_craftingitem 1"},rarity=1},
|
|
||||||
{items = {"ethereal:mushroom_plant 3"},rarity=3},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
buildable_to = true,
|
|
||||||
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
|
|
||||||
groups = {snappy=3,flammable=2,plant=1,mushroom=3,attached_node=1,growing=1,not_in_creative_inventory=1},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
})
|
|
||||||
minetest.register_alias("ethereal:mushroom_garden_3", "ethereal:mushroom_3")
|
|
||||||
|
|
||||||
minetest.register_node("ethereal:mushroom_4", {
|
ndef.tiles[1] = "ethereal_mushroom_garden_4.png"
|
||||||
drawtype = "plantlike",
|
ndef.drop.items[2].rarity = 1
|
||||||
tiles = {"ethereal_mushroom_garden_4.png"},
|
ndef.drop.items[3] = {items = {"ethereal:mushroom_plant 3"},rarity=7}
|
||||||
paramtype = "light",
|
ndef.groups.mushroom = 4
|
||||||
sunlight_propagates = true,
|
ndef.groups.growing = nil
|
||||||
walkable = false,
|
minetest.register_node("ethereal:mushroom_4", table.copy(ndef))
|
||||||
buildable_to = true,
|
|
||||||
drop = {
|
|
||||||
items = {
|
|
||||||
{items = {"ethereal:mushroom_craftingitem 1"},rarity=1},
|
|
||||||
{items = {"ethereal:mushroom_plant 3"},rarity=1},
|
|
||||||
{items = {"ethereal:mushroom_plant 3"},rarity=7},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
|
|
||||||
groups = {snappy=3,flammable=2,plant=1,mushroom=4,attached_node=1,not_in_creative_inventory=1},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
})
|
|
||||||
minetest.register_alias("ethereal:mushroom_garden_4", "ethereal:mushroom_4")
|
|
||||||
|
|
||||||
-- Abm for growing Mushroom
|
-- Abm for growing Mushroom
|
||||||
if farming.mod ~= "redo" then
|
if farming.mod ~= "redo" then
|
||||||
@ -143,34 +102,39 @@ minetest.register_abm({
|
|||||||
chance = 2,
|
chance = 2,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
-- return if already full grown
|
-- return if already full grown
|
||||||
if minetest.get_item_group(node.name, "mushroom") == 4 then
|
if minetest.get_item_group(node.name, "growing") < 1 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check if on wet soil
|
-- check if on wet soil
|
||||||
pos.y = pos.y-1
|
pos.y = pos.y-1
|
||||||
local n = minetest.get_node(pos)
|
if minetest.get_item_group(minetest.get_node(pos).name, "soil") < 3 then
|
||||||
if minetest.get_item_group(n.name, "soil") < 3 then
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
pos.y = pos.y+1
|
pos.y = pos.y+1
|
||||||
|
|
||||||
-- check light
|
-- check light
|
||||||
if not minetest.get_node_light(pos) then
|
local light = minetest.get_node_light(pos)
|
||||||
return
|
if not light
|
||||||
end
|
or light < 5 then
|
||||||
if minetest.get_node_light(pos) < 5 then
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- grow
|
-- grow
|
||||||
local height = minetest.get_item_group(node.name, "mushroom") + 1
|
node.name = "ethereal:mushroom_garden_" .. minetest.get_item_group(node.name, "mushroom") + 1
|
||||||
minetest.set_node(pos, {name="ethereal:mushroom_garden_"..height})
|
minetest.set_node(pos, node)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- legacy
|
||||||
|
|
||||||
|
for i = 1,4 do
|
||||||
|
minetest.register_alias("ethereal:mushroom_garden_"..i, "ethereal:mushroom_"..i)
|
||||||
|
end
|
||||||
|
|
||||||
-- Temporary compatibility lines for Xanadu server
|
-- Temporary compatibility lines for Xanadu server
|
||||||
minetest.register_alias("ethereal:mushroom_7", "ethereal:mushroom_3")
|
minetest.register_alias("ethereal:mushroom_7", "ethereal:mushroom_3")
|
||||||
minetest.register_alias("ethereal:mushroom_8", "ethereal:mushroom_4")
|
minetest.register_alias("ethereal:mushroom_8", "ethereal:mushroom_4")
|
||||||
|
127
onion.lua
127
onion.lua
@ -11,7 +11,7 @@ minetest.register_craftitem("ethereal:wild_onion_plant", {
|
|||||||
minetest.register_alias("ethereal:wild_onion_craftingitem", "ethereal:wild_onion_plant")
|
minetest.register_alias("ethereal:wild_onion_craftingitem", "ethereal:wild_onion_plant")
|
||||||
|
|
||||||
-- Define Onion growth stages
|
-- Define Onion growth stages
|
||||||
minetest.register_node("ethereal:onion_1", {
|
local onion_def = {
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
tiles = {"ethereal_wild_onion_1.png"},
|
tiles = {"ethereal_wild_onion_1.png"},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
@ -20,90 +20,41 @@ minetest.register_node("ethereal:onion_1", {
|
|||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
drop = {
|
drop = {
|
||||||
items = {
|
items = {
|
||||||
{items = {"ethereal:wild_onion_plant 1"},rarity=1},
|
{items = {"ethereal:wild_onion_plant"},rarity=1},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
|
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
|
||||||
groups = {snappy=3,flammable=2,plant=1,attached_node=1,onion=1,growing=1,not_in_creative_inventory=1},
|
groups = {snappy=3,flammable=2,plant=1,attached_node=1,onion=1,growing=1,not_in_creative_inventory=1},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
})
|
}
|
||||||
minetest.register_alias("ethereal:wild_onion_1", "ethereal:onion_1")
|
minetest.register_node("ethereal:onion_1", table.copy(onion_def))
|
||||||
|
|
||||||
minetest.register_node("ethereal:onion_2", {
|
onion_def.tiles[1] = "ethereal_wild_onion_2.png"
|
||||||
drawtype = "plantlike",
|
onion_def.groups.onion = 2
|
||||||
tiles = {"ethereal_wild_onion_2.png"},
|
minetest.register_node("ethereal:onion_2", table.copy(onion_def))
|
||||||
paramtype = "light",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
walkable = false,
|
|
||||||
buildable_to = true,
|
|
||||||
drop = {
|
|
||||||
items = {
|
|
||||||
{items = {"ethereal:wild_onion_plant 1"},rarity=1},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
|
|
||||||
groups = {snappy=3,flammable=2,plant=1,attached_node=1,onion=2,growing=1,not_in_creative_inventory=1},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
})
|
|
||||||
minetest.register_alias("ethereal:wild_onion_2", "ethereal:onion_2")
|
|
||||||
|
|
||||||
minetest.register_node("ethereal:onion_3", {
|
onion_def.tiles[1] = "ethereal_wild_onion_3.png"
|
||||||
drawtype = "plantlike",
|
onion_def.groups.onion = 3
|
||||||
tiles = {"ethereal_wild_onion_3.png"},
|
onion_def.drop.items[2] = {
|
||||||
paramtype = "light",
|
items = {"ethereal:wild_onion_plant 2"}, rarity=3
|
||||||
sunlight_propagates = true,
|
}
|
||||||
walkable = false,
|
minetest.register_node("ethereal:onion_3", table.copy(onion_def))
|
||||||
buildable_to = true,
|
|
||||||
is_ground_content = true,
|
|
||||||
drop = {
|
|
||||||
items = {
|
|
||||||
{items = {"ethereal:wild_onion_plant 1"},rarity=1},
|
|
||||||
{items = {"ethereal:wild_onion_plant 2"},rarity=3},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
|
|
||||||
groups = {snappy=3,flammable=2,plant=1,attached_node=1,onion=3,growing=1,not_in_creative_inventory=1},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
})
|
|
||||||
minetest.register_alias("ethereal:wild_onion_3", "ethereal:onion_3")
|
|
||||||
|
|
||||||
minetest.register_node("ethereal:onion_4", {
|
onion_def.tiles[1] = "ethereal_wild_onion_4.png"
|
||||||
drawtype = "plantlike",
|
onion_def.groups.onion = 4
|
||||||
tiles = {"ethereal_wild_onion_4.png"},
|
onion_def.drop.items[2] = {
|
||||||
paramtype = "light",
|
items = {"ethereal:wild_onion_plant 3"}, rarity=3
|
||||||
sunlight_propagates = true,
|
}
|
||||||
walkable = false,
|
minetest.register_node("ethereal:onion_4", table.copy(onion_def))
|
||||||
buildable_to = true,
|
|
||||||
drop = {
|
|
||||||
items = {
|
|
||||||
{items = {"ethereal:wild_onion_plant 1"},rarity=1},
|
|
||||||
{items = {"ethereal:wild_onion_plant 3"},rarity=3},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
|
|
||||||
groups = {snappy=3,flammable=2,plant=1,attached_node=1,onion=4,growing=1,not_in_creative_inventory=1},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
})
|
|
||||||
minetest.register_alias("ethereal:wild_onion_4", "ethereal:onion_4")
|
|
||||||
|
|
||||||
minetest.register_node("ethereal:onion_5", {
|
onion_def.tiles[1] = "ethereal_wild_onion_5.png"
|
||||||
drawtype = "plantlike",
|
onion_def.groups.onion = 5
|
||||||
tiles = {"ethereal_wild_onion_5.png"},
|
onion_def.groups.growing = nil
|
||||||
paramtype = "light",
|
onion_def.drop.items = {
|
||||||
sunlight_propagates = true,
|
{items = {"ethereal:wild_onion_plant 2"},rarity=1},
|
||||||
walkable = false,
|
{items = {"ethereal:wild_onion_plant 3"},rarity=2},
|
||||||
buildable_to = true,
|
}
|
||||||
drop = {
|
minetest.register_node("ethereal:onion_5", table.copy(onion_def))
|
||||||
items = {
|
|
||||||
{items = {"ethereal:wild_onion_plant 2"},rarity=1},
|
|
||||||
{items = {"ethereal:wild_onion_plant 3"},rarity=2},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
|
|
||||||
groups = {snappy=3,flammable=2,plant=1,attached_node=1,onion=5,not_in_creative_inventory=1},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
})
|
|
||||||
minetest.register_alias("ethereal:wild_onion_5", "ethereal:onion_5")
|
|
||||||
|
|
||||||
-- Abm for growing Wild Onion
|
-- Abm for growing Wild Onion
|
||||||
if farming.mod ~= "redo" then
|
if farming.mod ~= "redo" then
|
||||||
@ -115,34 +66,40 @@ minetest.register_abm({
|
|||||||
chance = 3,
|
chance = 3,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
-- return if already full grown
|
-- return if already full grown
|
||||||
if minetest.get_item_group(node.name, "onion") == 5 then
|
if minetest.get_item_group(node.name, "growing") < 1 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check if on wet soil
|
-- check if on wet soil
|
||||||
pos.y = pos.y-1
|
pos.y = pos.y-1
|
||||||
local n = minetest.get_node(pos)
|
if minetest.get_item_group(minetest.get_node(pos).name, "soil") < 3 then
|
||||||
if minetest.get_item_group(n.name, "soil") < 3 then
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
pos.y = pos.y+1
|
pos.y = pos.y+1
|
||||||
|
|
||||||
-- check light
|
-- check light
|
||||||
if not minetest.get_node_light(pos) then
|
local light = minetest.get_node_light(pos)
|
||||||
return
|
if not light
|
||||||
end
|
or light < 13 then
|
||||||
if minetest.get_node_light(pos) < 13 then
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- grow
|
-- grow
|
||||||
local height = minetest.get_item_group(node.name, "onion") + 1
|
node.name = "ethereal:onion_" .. minetest.get_item_group(node.name, "onion") + 1
|
||||||
minetest.set_node(pos, {name="ethereal:wild_onion_"..height})
|
minetest.set_node(pos, node)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Legacy
|
||||||
|
|
||||||
|
minetest.register_alias("ethereal:wild_onion_craftingitem", "ethereal:wild_onion_plant")
|
||||||
|
for i = 1,5 do
|
||||||
|
minetest.register_alias("ethereal:wild_onion_"..i, "ethereal:onion_"..i)
|
||||||
|
end
|
||||||
|
|
||||||
-- Temporary compatibility lines for Xanadu server
|
-- Temporary compatibility lines for Xanadu server
|
||||||
minetest.register_alias("ethereal:onion_7", "ethereal:onion_4")
|
minetest.register_alias("ethereal:onion_7", "ethereal:onion_4")
|
||||||
minetest.register_alias("ethereal:onion_8", "ethereal:onion_5")
|
minetest.register_alias("ethereal:onion_8", "ethereal:onion_5")
|
||||||
|
@ -138,7 +138,7 @@ minetest.register_node("ethereal:banana", {
|
|||||||
groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=1,leafdecay_drop=1},
|
groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=1,leafdecay_drop=1},
|
||||||
on_use = minetest.item_eat(2),
|
on_use = minetest.item_eat(2),
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
after_place_node = function(pos, placer, itemstack)
|
after_place_node = function(pos, placer)
|
||||||
if placer:is_player() then
|
if placer:is_player() then
|
||||||
minetest.set_node(pos, {name="ethereal:banana", param2=1})
|
minetest.set_node(pos, {name="ethereal:banana", param2=1})
|
||||||
end
|
end
|
||||||
@ -181,7 +181,7 @@ minetest.register_node("ethereal:orange", {
|
|||||||
groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1},
|
groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1},
|
||||||
on_use = minetest.item_eat(4),
|
on_use = minetest.item_eat(4),
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
after_place_node = function(pos, placer, itemstack)
|
after_place_node = function(pos, placer)
|
||||||
if placer:is_player() then
|
if placer:is_player() then
|
||||||
minetest.set_node(pos, {name="ethereal:orange", param2=1})
|
minetest.set_node(pos, {name="ethereal:orange", param2=1})
|
||||||
end
|
end
|
||||||
@ -398,45 +398,24 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Gravel (5x cobble in X pattern gives 5 gravel)
|
-- X pattern craft recipes (5x a in X pattern gives 5 b)
|
||||||
minetest.register_craft({
|
for _,items in pairs({
|
||||||
output = "default:gravel 5",
|
{"cobble", "gravel"},
|
||||||
recipe = {
|
{"gravel", "dirt"},
|
||||||
{"default:cobble", "", "default:cobble"},
|
{"dirt", "sand"},
|
||||||
{"", "default:cobble", ""},
|
{"ice", "snow"},
|
||||||
{"default:cobble", "", "default:cobble"},
|
}) do
|
||||||
}
|
local a,b = unpack(items)
|
||||||
})
|
a = "default:"..a
|
||||||
|
minetest.register_craft({
|
||||||
-- Dirt (5x gravel in X pattern gives 5 dirt)
|
output = "default:"..b.." 5",
|
||||||
minetest.register_craft({
|
recipe = {
|
||||||
output = "default:dirt 5",
|
{a, "", a},
|
||||||
recipe = {
|
{"", a, ""},
|
||||||
{"default:gravel", "", "default:gravel"},
|
{a, "", a},
|
||||||
{"", "default:gravel", ""},
|
}
|
||||||
{"default:gravel", "", "default:gravel"},
|
})
|
||||||
}
|
end
|
||||||
})
|
|
||||||
|
|
||||||
-- Sand (5x dirt in X pattern gives 5 sand)
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "default:sand 5",
|
|
||||||
recipe = {
|
|
||||||
{"default:dirt", "", "default:dirt"},
|
|
||||||
{"", "default:dirt", ""},
|
|
||||||
{"default:dirt", "", "default:dirt"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Snow (5x ice in X pattern gives 5 snow)
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "default:snow 5",
|
|
||||||
recipe = {
|
|
||||||
{"default:ice", "", "default:ice"},
|
|
||||||
{"", "default:ice", ""},
|
|
||||||
{"default:ice", "", "default:ice"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Paper (2x3 string = 4 paper)
|
-- Paper (2x3 string = 4 paper)
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 507 KiB |
Loading…
Reference in New Issue
Block a user