forked from Mineclonia/Mineclonia
Compare commits
1 Commits
master
...
refactor-s
Author | SHA1 | Date |
---|---|---|
Nils Dagsson Moskopp | e410359b42 |
|
@ -1 +0,0 @@
|
|||
name = walkover
|
|
@ -1 +0,0 @@
|
|||
name = mcl_experience
|
|
@ -1,2 +1 @@
|
|||
name = mcl_formspec
|
||||
description = Helper mod to simplify creation of formspecs a little bit
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
name = mcl_tmp_message
|
|
@ -18,21 +18,19 @@ minetest.register_node("mcl_farming:beetroot_0", {
|
|||
_doc_items_longdesc = S("Beetroot plants are plants which grow on farmland under sunlight in 4 stages. On hydrated farmland, they grow a bit faster. They can be harvested at any time but will only yield a profit when mature."),
|
||||
_doc_items_entry_name = S("Premature Beetroot Plant"),
|
||||
paramtype = "light",
|
||||
paramtype2 = "meshoptions",
|
||||
sunlight_propagates = true,
|
||||
-- keep place_param2 for plantlike drawtype compatiblity
|
||||
place_param2 = 3,
|
||||
walkable = false,
|
||||
drawtype = "nodebox",
|
||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
||||
drawtype = "plantlike",
|
||||
drop = "mcl_farming:beetroot_seeds",
|
||||
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_0.png") },
|
||||
use_texture_alpha = "clip",
|
||||
tiles = {"mcl_farming_beetroot_0.png"},
|
||||
inventory_image = "mcl_farming_beetroot_0.png",
|
||||
wield_image = "mcl_farming_beetroot_0.png",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -9/16, -0.5, 0.5, -6/16, 0.5}
|
||||
{-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
||||
|
@ -44,21 +42,19 @@ minetest.register_node("mcl_farming:beetroot_1", {
|
|||
description = S("Premature Beetroot Plant (Stage 2)"),
|
||||
_doc_items_create_entry = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "meshoptions",
|
||||
sunlight_propagates = true,
|
||||
-- keep place_param2 for plantlike drawtype compatiblity
|
||||
place_param2 = 3,
|
||||
walkable = false,
|
||||
drawtype = "nodebox",
|
||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
||||
drawtype = "plantlike",
|
||||
drop = "mcl_farming:beetroot_seeds",
|
||||
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_1.png") },
|
||||
use_texture_alpha = "clip",
|
||||
tiles = {"mcl_farming_beetroot_1.png"},
|
||||
inventory_image = "mcl_farming_beetroot_1.png",
|
||||
wield_image = "mcl_farming_beetroot_1.png",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -9/16, -0.5, 0.5, -4/16, 0.5}
|
||||
{-0.5, -0.5, -0.5, 0.5, -3/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
||||
|
@ -70,21 +66,19 @@ minetest.register_node("mcl_farming:beetroot_2", {
|
|||
description = S("Premature Beetroot Plant (Stage 3)"),
|
||||
_doc_items_create_entry = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "meshoptions",
|
||||
sunlight_propagates = true,
|
||||
-- keep place_param2 for plantlike drawtype compatiblity
|
||||
place_param2 = 3,
|
||||
walkable = false,
|
||||
drawtype = "nodebox",
|
||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
||||
drawtype = "plantlike",
|
||||
drop = "mcl_farming:beetroot_seeds",
|
||||
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_2.png") },
|
||||
use_texture_alpha = "clip",
|
||||
tiles = {"mcl_farming_beetroot_2.png"},
|
||||
inventory_image = "mcl_farming_beetroot_2.png",
|
||||
wield_image = "mcl_farming_beetroot_2.png",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -9/16, -0.5, 0.5, 1/16, 0.5}
|
||||
{-0.5, -0.5, -0.5, 0.5, 2/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
||||
|
@ -97,12 +91,11 @@ minetest.register_node("mcl_farming:beetroot", {
|
|||
_doc_items_longdesc = S("A mature beetroot plant is a farming plant which is ready to be harvested for a beetroot and some beetroot seeds. It won't grow any further."),
|
||||
_doc_items_create_entry = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "meshoptions",
|
||||
sunlight_propagates = true,
|
||||
-- keep place_param2 for plantlike drawtype compatiblity
|
||||
place_param2 = 3,
|
||||
walkable = false,
|
||||
drawtype = "nodebox",
|
||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
||||
drawtype = "plantlike",
|
||||
drop = {
|
||||
--[[ drops 1 beetroot guaranteed.
|
||||
drops 1-4 beetroot seeds:
|
||||
|
@ -119,14 +112,13 @@ minetest.register_node("mcl_farming:beetroot", {
|
|||
{ items = {"mcl_farming:beetroot_seeds 1"}, rarity = 4 },
|
||||
},
|
||||
},
|
||||
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_3.png") },
|
||||
use_texture_alpha = "clip",
|
||||
tiles = {"mcl_farming_beetroot_3.png"},
|
||||
inventory_image = "mcl_farming_beetroot_3.png",
|
||||
wield_image = "mcl_farming_beetroot_3.png",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -9/16, -0.5, 0.5, 2/16, 0.5}
|
||||
{-0.5, -0.5, -0.5, 0.5, 3/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,beetroot=4},
|
||||
|
|
|
@ -28,20 +28,18 @@ for i=1, 7 do
|
|||
_doc_items_longdesc = longdesc,
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
-- keep place_param2 for plantlike drawtype compatiblity
|
||||
paramtype2 = "meshoptions",
|
||||
place_param2 = 3,
|
||||
walkable = false,
|
||||
drawtype = "nodebox",
|
||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
||||
drawtype = "plantlike",
|
||||
drop = "mcl_farming:carrot_item",
|
||||
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) },
|
||||
use_texture_alpha = "clip",
|
||||
tiles = {texture},
|
||||
inventory_image = texture,
|
||||
wield_image = texture,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -9/16, -0.5, 0.5, sel_height - 1/16, 0.5}
|
||||
{-0.5, -0.5, -0.5, 0.5, sel_height, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
||||
|
@ -55,13 +53,11 @@ minetest.register_node("mcl_farming:carrot", {
|
|||
_doc_items_longdesc = S("Mature carrot plants are ready to be harvested for carrots. They won't grow any further."),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
-- keep place_param2 for plantlike drawtype compatiblity
|
||||
paramtype2 = "meshoptions",
|
||||
place_param2 = 3,
|
||||
walkable = false,
|
||||
drawtype = "nodebox",
|
||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
||||
tiles = { mcl_farming:align_plantlike_nodebox_texture("farming_carrot_4.png") },
|
||||
use_texture_alpha = "clip",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_carrot_4.png"},
|
||||
inventory_image = "farming_carrot_4.png",
|
||||
wield_image = "farming_carrot_4.png",
|
||||
drop = {
|
||||
|
@ -76,7 +72,7 @@ minetest.register_node("mcl_farming:carrot", {
|
|||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -9/16, -0.5, 0.5, 3/16, 0.5}
|
||||
{-0.5, -0.5, -0.5, 0.5, 4/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
||||
|
|
|
@ -27,73 +27,3 @@ dofile(minetest.get_modpath("mcl_farming").."/potatoes.lua")
|
|||
|
||||
-- ========= BEETROOT =========
|
||||
dofile(minetest.get_modpath("mcl_farming").."/beetroot.lua")
|
||||
|
||||
-- This function generates a row of plantlike and nodebox nodes whose
|
||||
-- name starts with a given string, starting at a given position. It
|
||||
-- places a given node below so that the rendering can be examined.
|
||||
local function generate_plant_row(prefix, pos, below_node)
|
||||
local i = 1
|
||||
for node_name, node in pairs(minetest.registered_nodes) do
|
||||
if (
|
||||
1 == node_name:find(prefix) and
|
||||
(
|
||||
"plantlike" == node.drawtype or
|
||||
"nodebox" == node.drawtype
|
||||
)
|
||||
) then
|
||||
local node_pos = {
|
||||
x = pos.x + i,
|
||||
y = pos.y,
|
||||
z = pos.z,
|
||||
}
|
||||
minetest.set_node(
|
||||
node_pos,
|
||||
{
|
||||
name = node_name,
|
||||
param2 = node.place_param2 or 0
|
||||
}
|
||||
)
|
||||
local below_pos = {
|
||||
x = node_pos.x,
|
||||
y = node_pos.y - 1,
|
||||
z = node_pos.z
|
||||
}
|
||||
minetest.set_node(
|
||||
below_pos,
|
||||
below_node
|
||||
)
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("generate_farming_plant_rows",{
|
||||
description = "Generates rows of mcl_farming plant nodes on farming soil and glass",
|
||||
privs = { debug = true },
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local pos = player:get_pos()
|
||||
local node_prefixes = {
|
||||
"mcl_farming:beetroot",
|
||||
"mcl_farming:carrot",
|
||||
"mcl_farming:melon",
|
||||
"mcl_farming:potato",
|
||||
"mcl_farming:pumpkin",
|
||||
"mcl_farming:wheat",
|
||||
}
|
||||
for i,node_prefix in ipairs(node_prefixes) do
|
||||
generate_plant_row(
|
||||
node_prefix,
|
||||
pos,
|
||||
{ name = "mcl_farming:soil" }
|
||||
)
|
||||
pos.z = pos.z + 2
|
||||
generate_plant_row(
|
||||
node_prefix,
|
||||
pos,
|
||||
{ name = "mcl_core:glass" }
|
||||
)
|
||||
pos.z = pos.z + 2
|
||||
end
|
||||
end
|
||||
})
|
||||
|
|
|
@ -91,18 +91,16 @@ for s=1,7 do
|
|||
_doc_items_longdesc = longdesc,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "nodebox",
|
||||
node_box = mcl_farming:get_plantlike_plus_nodebox(),
|
||||
drawtype = "plantlike",
|
||||
sunlight_propagates = true,
|
||||
drop = stem_drop,
|
||||
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) },
|
||||
use_texture_alpha = "clip",
|
||||
tiles = {texture},
|
||||
wield_image = texture,
|
||||
inventory_image = texture,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.15, -9/16, -0.15, 0.15, -9/16+h, 0.15}
|
||||
{-0.15, -0.5, -0.15, 0.15, -0.5+h, 0.15}
|
||||
},
|
||||
},
|
||||
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, plant_melon_stem=s},
|
||||
|
|
|
@ -6,13 +6,13 @@ for i=1, 7 do
|
|||
local texture, selbox
|
||||
if i < 3 then
|
||||
texture = "mcl_farming_potatoes_stage_0.png"
|
||||
selbox = { -0.5, -9/16, -0.5, 0.5, -6/16, 0.5 }
|
||||
selbox = { -0.5, -0.5, -0.5, 0.5, -5/16, 0.5 }
|
||||
elseif i < 5 then
|
||||
texture = "mcl_farming_potatoes_stage_1.png"
|
||||
selbox = { -0.5, -9/16, -0.5, 0.5, -3/16, 0.5 }
|
||||
selbox = { -0.5, -0.5, -0.5, 0.5, -2/16, 0.5 }
|
||||
else
|
||||
texture = "mcl_farming_potatoes_stage_2.png"
|
||||
selbox = { -0.5, -9/16, -0.5, 0.5, 1/16, 0.5 }
|
||||
selbox = { -0.5, -0.5, -0.5, 0.5, 2/16, 0.5 }
|
||||
end
|
||||
|
||||
local create, name, longdesc
|
||||
|
@ -33,15 +33,13 @@ for i=1, 7 do
|
|||
_doc_items_entry_name = name,
|
||||
_doc_items_longdesc = longdesc,
|
||||
paramtype = "light",
|
||||
paramtype2 = "meshoptions",
|
||||
sunlight_propagates = true,
|
||||
-- keep place_param2 for plantlike drawtype compatiblity
|
||||
place_param2 = 3,
|
||||
walkable = false,
|
||||
drawtype = "nodebox",
|
||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
||||
drawtype = "plantlike",
|
||||
drop = "mcl_farming:potato_item",
|
||||
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) },
|
||||
use_texture_alpha = "clip",
|
||||
tiles = { texture },
|
||||
inventory_image = texture,
|
||||
wield_image = texture,
|
||||
selection_box = {
|
||||
|
@ -59,14 +57,12 @@ minetest.register_node("mcl_farming:potato", {
|
|||
description = S("Mature Potato Plant"),
|
||||
_doc_items_longdesc = S("Mature potato plants are ready to be harvested for potatoes. They won't grow any further."),
|
||||
paramtype = "light",
|
||||
paramtype2 = "meshoptions",
|
||||
sunlight_propagates = true,
|
||||
-- keep place_param2 for plantlike drawtype compatiblity
|
||||
place_param2 = 3,
|
||||
walkable = false,
|
||||
drawtype = "nodebox",
|
||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
||||
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_potatoes_stage_3.png") },
|
||||
use_texture_alpha = "clip",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"mcl_farming_potatoes_stage_3.png"},
|
||||
wield_image = "mcl_farming_potatoes_stage_3.png",
|
||||
inventory_image = "mcl_farming_potatoes_stage_3.png",
|
||||
drop = {
|
||||
|
@ -81,7 +77,7 @@ minetest.register_node("mcl_farming:potato", {
|
|||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.5, -9/16, -0.5, 0.5, 0, 0.5 }
|
||||
{ -0.5, -0.5, -0.5, 0.5, 1/16, 0.5 }
|
||||
}
|
||||
},
|
||||
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
||||
|
|
|
@ -63,18 +63,16 @@ for s=1,7 do
|
|||
_doc_items_longdesc = longdesc,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "nodebox",
|
||||
node_box = mcl_farming:get_plantlike_plus_nodebox(),
|
||||
drawtype = "plantlike",
|
||||
sunlight_propagates = true,
|
||||
drop = stem_drop,
|
||||
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) },
|
||||
use_texture_alpha = "clip",
|
||||
tiles = {texture},
|
||||
inventory_image = texture,
|
||||
wield_image = texture,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.15, -9/16, -0.15, 0.15, -9/16+h, 0.15}
|
||||
{-0.15, -0.5, -0.15, 0.15, -0.5+h, 0.15}
|
||||
},
|
||||
},
|
||||
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,},
|
||||
|
|
|
@ -265,7 +265,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
|||
stem_def.selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.15, -9/16, -0.15, 0.15, 7/16, 0.15}
|
||||
{-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}
|
||||
},
|
||||
}
|
||||
end
|
||||
|
@ -273,20 +273,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
|||
stem_def.paramtype = "light"
|
||||
end
|
||||
if not stem_def.drawtype then
|
||||
stem_def.drawtype = "nodebox"
|
||||
end
|
||||
if not stem_def.node_box then
|
||||
stem_def.node_box = mcl_farming:get_plantlike_plus_nodebox()
|
||||
end
|
||||
if stem_def.tiles then
|
||||
for i=1,#stem_def.tiles do
|
||||
stem_def.tiles[i] = mcl_farming:align_plantlike_nodebox_texture(
|
||||
stem_def.tiles[i]
|
||||
)
|
||||
end
|
||||
end
|
||||
if not stem_def.use_texture_alpha then
|
||||
stem_def.use_texture_alpha = "clip"
|
||||
stem_def.drawtype = "plantlike"
|
||||
end
|
||||
if stem_def.walkable == nil then
|
||||
stem_def.walkable = false
|
||||
|
@ -313,9 +300,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
|||
minetest.register_node(stem_itemstring, stem_def)
|
||||
|
||||
-- Register connected stems
|
||||
local connected_stem_texture = mcl_farming:align_plantlike_nodebox_texture(
|
||||
connected_stem_texture
|
||||
)
|
||||
|
||||
local connected_stem_tiles = {
|
||||
{ "blank.png", --top
|
||||
"blank.png", -- bottom
|
||||
|
@ -347,16 +332,16 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
|||
}
|
||||
}
|
||||
local connected_stem_nodebox = {
|
||||
{-0.5, -9/16, 0, 0.5, 7/16, 0},
|
||||
{-0.5, -9/16, 0, 0.5, 7/16, 0},
|
||||
{0, -9/16, -0.5, 0, 7/16, 0.5},
|
||||
{0, -9/16, -0.5, 0, 7/16, 0.5},
|
||||
{-0.5, -0.5, 0, 0.5, 0.5, 0},
|
||||
{-0.5, -0.5, 0, 0.5, 0.5, 0},
|
||||
{0, -0.5, -0.5, 0, 0.5, 0.5},
|
||||
{0, -0.5, -0.5, 0, 0.5, 0.5},
|
||||
}
|
||||
local connected_stem_selectionbox = {
|
||||
{-0.1, -9/16, -0.1, 0.5, 0.2 - 1/16, 0.1},
|
||||
{-0.5, -9/16, -0.1, 0.1, 0.2 - 1/16, 0.1},
|
||||
{-0.1, -9/16, -0.1, 0.1, 0.2 - 1/16, 0.5},
|
||||
{-0.1, -9/16, -0.5, 0.1, 0.2 - 1/16, 0.1},
|
||||
{-0.1, -0.5, -0.1, 0.5, 0.2, 0.1},
|
||||
{-0.5, -0.5, -0.1, 0.1, 0.2, 0.1},
|
||||
{-0.1, -0.5, -0.1, 0.1, 0.2, 0.5},
|
||||
{-0.1, -0.5, -0.5, 0.1, 0.2, 0.1},
|
||||
}
|
||||
|
||||
for i=1, 4 do
|
||||
|
@ -484,40 +469,3 @@ minetest.register_lbm({
|
|||
mcl_farming:grow_plant(identifier, pos, node, false, false, low_speed)
|
||||
end,
|
||||
})
|
||||
|
||||
-- This function returns a nodebox that imitates a plantlike plus (+)
|
||||
-- drawtype, but is shifted 1/16 lower, into the empty space above
|
||||
-- farming soil. The regular plantlike drawtype can not do this.
|
||||
function mcl_farming:get_plantlike_plus_nodebox()
|
||||
return {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ 0, -9/16, -0.15, 0, 7/16, 0.15 },
|
||||
{ -0.15, -9/16, 0, 0.15, 7/16, 0 }
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
-- This function returns a nodebox that imitates a plantlike grid (#)
|
||||
-- drawtype, but is shifted 1/16 lower, into the empty space above
|
||||
-- farming soil. The regular plantlike drawtype can not do this.
|
||||
function mcl_farming:get_plantlike_grid_nodebox()
|
||||
return {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ 4/16, -9/16, -8/16, 4/16, 7/16, 8/16},
|
||||
{-4/16, -9/16, -8/16, -4/16, 7/16, 8/16},
|
||||
{-8/16, -9/16, -4/16, 8/16, 7/16, -4/16},
|
||||
{-8/16, -9/16, 4/16, 8/16, 7/16, 4/16},
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
-- This function takes a texture and returns a modified texture where
|
||||
-- the bottom row is at the top, assuming 16px × 16px textures. This
|
||||
-- is used to align textures to a “plantlike” nodebox shifted 1/16
|
||||
-- below its own node – into the empty space above farming soil.
|
||||
function mcl_farming:align_plantlike_nodebox_texture(texture)
|
||||
local texture = texture:gsub("%^", "\\%^"):gsub(":", "\\:")
|
||||
return "[combine:16x16:0,-15=" .. texture .. ":0,1=" .. texture
|
||||
end
|
||||
|
|
|
@ -39,21 +39,19 @@ for i=1,7 do
|
|||
_doc_items_entry_name = name,
|
||||
_doc_items_longdesc = longdesc,
|
||||
paramtype = "light",
|
||||
-- keep place_param2 for plantlike drawtype compatiblity
|
||||
paramtype2 = "meshoptions",
|
||||
place_param2 = 3,
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
drawtype = "nodebox",
|
||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
||||
drawtype = "plantlike",
|
||||
drop = "mcl_farming:wheat_seeds",
|
||||
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_wheat_stage_"..(i-1)..".png") },
|
||||
use_texture_alpha = "clip",
|
||||
tiles = {"mcl_farming_wheat_stage_"..(i-1)..".png"},
|
||||
inventory_image = "mcl_farming_wheat_stage_"..(i-1)..".png",
|
||||
wield_image = "mcl_farming_wheat_stage_"..(i-1)..".png",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -9/16, -0.5, 0.5, sel_heights[i] - 1/16, 0.5}
|
||||
{-0.5, -0.5, -0.5, 0.5, sel_heights[i], 0.5}
|
||||
},
|
||||
},
|
||||
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1},
|
||||
|
@ -67,21 +65,13 @@ minetest.register_node("mcl_farming:wheat", {
|
|||
_doc_items_longdesc = S("Mature wheat plants are ready to be harvested for wheat and wheat seeds. They won't grow any further."),
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
-- keep place_param2 for plantlike drawtype compatiblity
|
||||
paramtype2 = "meshoptions",
|
||||
place_param2 = 3,
|
||||
walkable = false,
|
||||
drawtype = "nodebox",
|
||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
||||
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_wheat_stage_7.png") },
|
||||
use_texture_alpha = "clip",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"mcl_farming_wheat_stage_7.png"},
|
||||
inventory_image = "mcl_farming_wheat_stage_7.png",
|
||||
wield_image = "mcl_farming_wheat_stage_7.png",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.5, -9/16, -0.5, 0.5, 7/16, 0.5 }
|
||||
}
|
||||
},
|
||||
drop = {
|
||||
max_items = 4,
|
||||
items = {
|
||||
|
|
|
@ -10,7 +10,7 @@ Register platinum stair and slab based on node `example:platinum`:
|
|||
mcl_stairs.register_stair_and_slab_simple("platinum", "example:platinum", "Platinum Stair", "Platinum Slab", "Double Platinum Slab")
|
||||
```
|
||||
|
||||
## `mcl_stairs.register_stair_and_slab_simple(subname, sourcenode, desc_stair, desc_slab, double_description, corner_stair_texture_override)`
|
||||
## `mcl_stairs.register_stair_and_slab_simple(name, sourcenode, desc_stair, desc_slab, double_description, corner_stair_texture_override)`
|
||||
Register a simple stair and a slab. The stair and slab will inherit all attributes from `sourcenode`. The `sourcenode` is also used as the item for crafting recipes.
|
||||
|
||||
This function is meant for simple nodes; if you need more flexibility, use one of the other functions instead.
|
||||
|
@ -18,14 +18,14 @@ This function is meant for simple nodes; if you need more flexibility, use one o
|
|||
See `register_stair` and `register_slab` for the itemstrings of the registered nodes.
|
||||
|
||||
### Parameters
|
||||
* `subname`: Name fragment for node itemstrings (see `register_stair` and `register_slab`)
|
||||
* `name`: Name for node itemstrings (see `register_stair` and `register_slab`)
|
||||
* `sourcenode`: The node on which this stair is based on
|
||||
* `desc_stair`: Description of stair node
|
||||
* `desc_slab`: Description of slab node
|
||||
* `double_description`: Description of double slab node
|
||||
* `corner_stair_texture_override`: Optional, see `register_stair`
|
||||
|
||||
## `mcl_stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds, hardness, double_description, corner_stair_texture_override)`
|
||||
## `mcl_stairs.register_stair_and_slab(name, recipeitem, groups, images, desc_stair, desc_slab, sounds, hardness, double_description, corner_stair_texture_override)`
|
||||
Register a simple stair and a slab, plus crafting recipes. In this function, you need to specify most things explicitly.
|
||||
|
||||
### Parameters
|
||||
|
@ -33,17 +33,26 @@ Register a simple stair and a slab, plus crafting recipes. In this function, you
|
|||
* `desc_slab`: Description of slab node
|
||||
* Other parameters: Same as for `register_stair` and `register_slab`
|
||||
|
||||
## `mcl_stairs.register_stair(subname, recipeitem, groups, images, description, sounds, hardness, corner_stair_texture_override)`
|
||||
## `mcl_stairs.register_stair(name, recipeitem, groups, images, description, sounds, hardness, corner_stair_texture_override)`
|
||||
Registers a stair. This also includes the inner and outer corner stairs, they are added automatically. Also adds crafting recipes.
|
||||
|
||||
If `name` contains no colon, the itemstrings for the registered nodes will be of the form:
|
||||
|
||||
* `mcl_stairs:stair_<name>`: Normal stair
|
||||
* `mcl_stairs:stair_<name>_inner`: Inner stair
|
||||
* `mcl_stairs:stair_<name>_outer`: Outer stair
|
||||
|
||||
If `name` contains a colon, the string is split at the colon into `modname` and `subname`.
|
||||
The itemstrings for the registered nodes will be of the form:
|
||||
|
||||
* `mcl_stairs:stair_<subname>`: Normal stair
|
||||
* `mcl_stairs:stair_<subname>_inner`: Inner stair
|
||||
* `mcl_stairs:stair_<subname>_outer`: Outer stair
|
||||
* `<modname>:stair_<subname>`: Normal stair
|
||||
* `<modname>:stair_<subname>_inner`: Inner stair
|
||||
* `<modname>:stair_<subname>_outer`: Outer stair
|
||||
|
||||
In the latter case, item aliases are registered for stairs registered using the colon-less form.
|
||||
|
||||
### Parameters
|
||||
* `subname`: Name fragment for node itemstrings (see above)
|
||||
* `name`: Name fragment for node itemstrings (see above)
|
||||
* `recipeitem`: Item for crafting recipe. Use `group:` prefix to use a group instead
|
||||
* `groups`: Groups used for stair
|
||||
* `images`: Textures
|
||||
|
@ -68,14 +77,29 @@ It can be one of the following data types:
|
|||
{ tiles_def_for_outer_stair, tiles_def_for_inner_stair }
|
||||
* nil: Equivalent to "default"
|
||||
|
||||
## `mcl_stairs.register_slab(subname, recipeitem, groups, images, description, sounds, hardness, double_description)`
|
||||
## `mcl_stairs.register_slab(name, recipeitem, groups, images, description, sounds, hardness, double_description)`
|
||||
Registers a slab and a corresponding double slab. Also adds crafting recipe.
|
||||
|
||||
The itemstrings for the registered nodes will be of the form:
|
||||
|
||||
* `mcl_stairs:slab_<subname>`: Slab
|
||||
* `mcl_stairs:slab_<subname>_top`: Upper slab, used internally
|
||||
* `mcl_stairs:slab_<subname>_double`: Double slab
|
||||
* `mcl_stairs:slab_<name>`: Slab
|
||||
* `mcl_stairs:slab_<name>_top`: Upper slab, used internally
|
||||
* `mcl_stairs:slab_<name>_double`: Double slab
|
||||
|
||||
If `name` contains no colon, the itemstrings for the registered nodes will be of the form:
|
||||
|
||||
* `mcl_stairs:slab_<name>`: Normal stair
|
||||
* `mcl_stairs:slab_<name>_top`: Inner stair
|
||||
* `mcl_stairs:slab_<name>_double`: Outer stair
|
||||
|
||||
If `name` contains a colon, the string is split at the colon into `modname` and `subname`.
|
||||
The itemstrings for the registered nodes will be of the form:
|
||||
|
||||
* `<modname>:slab_<subname>`: Normal stair
|
||||
* `<modname>:slab_<subname>_top`: Inner stair
|
||||
* `<modname>:slab_<subname>_double`: Outer stair
|
||||
|
||||
In the latter case, item aliases are registered for slabs registered using the colon-less form.
|
||||
|
||||
### Parameters
|
||||
* `double_description`: Node description/tooltip for double slab
|
||||
|
|
|
@ -67,10 +67,40 @@ local function place_stair(itemstack, placer, pointed_thing)
|
|||
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||
end
|
||||
|
||||
-- Register stairs.
|
||||
-- Node will be called mcl_stairs:stair_<subname>
|
||||
local function get_modname_and_subname(name)
|
||||
local modname, subname
|
||||
if nil == string.find(name, ":") then
|
||||
modname, subname = "mcl_stairs", name
|
||||
else
|
||||
modname, subname = string.gmatch(name, "(.*):(.*)")()
|
||||
end
|
||||
return modname, subname
|
||||
end
|
||||
|
||||
function mcl_stairs.register_stair(subname, recipeitem, groups, images, description, sounds, blast_resistance, hardness, corner_stair_texture_override)
|
||||
local modname, subname = get_modname_and_subname("air")
|
||||
assert( "mcl_stairs" == modname )
|
||||
assert( "air" == subname )
|
||||
|
||||
local modname, subname = get_modname_and_subname("default:stone")
|
||||
assert( "default" == modname )
|
||||
assert( "stone" == subname )
|
||||
|
||||
-- Register aliases for backwards compatiblity with unprefixed API usage
|
||||
|
||||
local function register_mcl_stairs_alias(name)
|
||||
local modname, subname = string.gmatch(name, "(.*):(.*)")()
|
||||
assert( nil ~= modname )
|
||||
assert( nil ~= subname )
|
||||
if "mcl_stairs" ~= modname then
|
||||
local old_name = "mcl_stairs:" .. subname
|
||||
minetest.register_alias(old_name, name)
|
||||
end
|
||||
end
|
||||
|
||||
-- Register stairs.
|
||||
-- Node will be called mcl_stairs:stair_<name> or <modname>:stair_<subname>
|
||||
|
||||
function mcl_stairs.register_stair(name, recipeitem, groups, images, description, sounds, blast_resistance, hardness, corner_stair_texture_override)
|
||||
groups.stair = 1
|
||||
groups.building_block = 1
|
||||
|
||||
|
@ -92,7 +122,9 @@ function mcl_stairs.register_stair(subname, recipeitem, groups, images, descript
|
|||
end
|
||||
end
|
||||
|
||||
minetest.register_node(":mcl_stairs:stair_" .. subname, {
|
||||
local modname, subname = get_modname_and_subname(name)
|
||||
local stair = modname .. ":stair_" .. subname
|
||||
minetest.register_node(":" .. stair, {
|
||||
description = description,
|
||||
_doc_items_longdesc = S("Stairs are useful to reach higher places by walking over them; jumping is not required. Placing stairs in a corner pattern will create corner stairs. Stairs placed on the ceiling or at the upper half of the side of a block will be placed upside down."),
|
||||
drawtype = "mesh",
|
||||
|
@ -152,10 +184,11 @@ function mcl_stairs.register_stair(subname, recipeitem, groups, images, descript
|
|||
_mcl_blast_resistance = blast_resistance,
|
||||
_mcl_hardness = hardness,
|
||||
})
|
||||
register_mcl_stairs_alias(stair)
|
||||
|
||||
if recipeitem then
|
||||
minetest.register_craft({
|
||||
output = 'mcl_stairs:stair_' .. subname .. ' 4',
|
||||
output = modname .. ':stair_' .. subname .. ' 4',
|
||||
recipe = {
|
||||
{recipeitem, "", ""},
|
||||
{recipeitem, recipeitem, ""},
|
||||
|
@ -165,7 +198,7 @@ function mcl_stairs.register_stair(subname, recipeitem, groups, images, descript
|
|||
|
||||
-- Flipped recipe
|
||||
minetest.register_craft({
|
||||
output = 'mcl_stairs:stair_' .. subname .. ' 4',
|
||||
output = modname .. ':stair_' .. subname .. ' 4',
|
||||
recipe = {
|
||||
{"", "", recipeitem},
|
||||
{"", recipeitem, recipeitem},
|
||||
|
@ -174,7 +207,7 @@ function mcl_stairs.register_stair(subname, recipeitem, groups, images, descript
|
|||
})
|
||||
end
|
||||
|
||||
mcl_stairs.cornerstair.add("mcl_stairs:stair_"..subname, corner_stair_texture_override)
|
||||
mcl_stairs.cornerstair.add(modname .. ":stair_" .. subname, corner_stair_texture_override)
|
||||
end
|
||||
|
||||
|
||||
|
@ -182,12 +215,14 @@ end
|
|||
local slab_trans_dir = {[0] = 8, 0, 2, 1, 3, 4}
|
||||
|
||||
-- Register slabs.
|
||||
-- Node will be called mcl_stairs:slab_<subname>
|
||||
-- Node will be called mcl_stairs:slab_<name> or <modname>:slab_<subname>
|
||||
|
||||
-- double_description: NEW argument, not supported in Minetest Game
|
||||
-- double_description: Description of double slab
|
||||
function mcl_stairs.register_slab(subname, recipeitem, groups, images, description, sounds, blast_resistance, hardness, double_description)
|
||||
local lower_slab = "mcl_stairs:slab_"..subname
|
||||
function mcl_stairs.register_slab(name, recipeitem, groups, images, description, sounds, blast_resistance, hardness, double_description)
|
||||
local modname, subname = get_modname_and_subname(name)
|
||||
|
||||
local lower_slab = modname .. ":slab_" .. subname
|
||||
local upper_slab = lower_slab.."_top"
|
||||
local double_slab = lower_slab.."_double"
|
||||
|
||||
|
@ -281,6 +316,7 @@ function mcl_stairs.register_slab(subname, recipeitem, groups, images, descripti
|
|||
}
|
||||
|
||||
minetest.register_node(":"..lower_slab, slabdef)
|
||||
register_mcl_stairs_alias(lower_slab)
|
||||
|
||||
-- Register the upper slab.
|
||||
-- Using facedir is not an option, as this would rotate the textures as well and would make
|
||||
|
@ -314,6 +350,7 @@ function mcl_stairs.register_slab(subname, recipeitem, groups, images, descripti
|
|||
fixed = {-0.5, 0, -0.5, 0.5, 0.5, 0.5},
|
||||
}
|
||||
minetest.register_node(":"..upper_slab, topdef)
|
||||
register_mcl_stairs_alias(upper_slab)
|
||||
|
||||
|
||||
-- Double slab node
|
||||
|
@ -332,6 +369,7 @@ function mcl_stairs.register_slab(subname, recipeitem, groups, images, descripti
|
|||
drop = lower_slab .. " 2",
|
||||
_mcl_hardness = hardness,
|
||||
})
|
||||
register_mcl_stairs_alias(double_slab)
|
||||
|
||||
if recipeitem then
|
||||
minetest.register_craft({
|
||||
|
@ -351,18 +389,18 @@ end
|
|||
|
||||
|
||||
-- Stair/slab registration function.
|
||||
-- Nodes will be called mcl_stairs:{stair,slab}_<subname>
|
||||
-- Nodes will be called mcl_stairs:{stair,slab}_<name> or <modname>:{stair,slab}_<subname>
|
||||
|
||||
function mcl_stairs.register_stair_and_slab(subname, recipeitem,
|
||||
function mcl_stairs.register_stair_and_slab(name, recipeitem,
|
||||
groups, images, desc_stair, desc_slab, sounds, blast_resistance, hardness,
|
||||
double_description, corner_stair_texture_override)
|
||||
mcl_stairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds, blast_resistance, hardness, corner_stair_texture_override)
|
||||
mcl_stairs.register_slab(subname, recipeitem, groups, images, desc_slab, sounds, blast_resistance, hardness, double_description)
|
||||
mcl_stairs.register_stair(name, recipeitem, groups, images, desc_stair, sounds, blast_resistance, hardness, corner_stair_texture_override)
|
||||
mcl_stairs.register_slab(name, recipeitem, groups, images, desc_slab, sounds, blast_resistance, hardness, double_description)
|
||||
end
|
||||
|
||||
-- Very simple registration function
|
||||
-- Makes stair and slab out of a source node
|
||||
function mcl_stairs.register_stair_and_slab_simple(subname, sourcenode, desc_stair, desc_slab, desc_double_slab, corner_stair_texture_override)
|
||||
function mcl_stairs.register_stair_and_slab_simple(name, sourcenode, desc_stair, desc_slab, desc_double_slab, corner_stair_texture_override)
|
||||
local def = minetest.registered_nodes[sourcenode]
|
||||
local groups = {}
|
||||
-- Only allow a strict set of groups to be added to stairs and slabs for more predictable results
|
||||
|
@ -372,6 +410,6 @@ function mcl_stairs.register_stair_and_slab_simple(subname, sourcenode, desc_sta
|
|||
groups[allowed_groups[a]] = def.groups[allowed_groups[a]]
|
||||
end
|
||||
end
|
||||
mcl_stairs.register_stair_and_slab(subname, sourcenode, groups, def.tiles, desc_stair, desc_slab, def.sounds, def._mcl_blast_resistance, def._mcl_hardness, desc_double_slab, corner_stair_texture_override)
|
||||
mcl_stairs.register_stair_and_slab(name, sourcenode, groups, def.tiles, desc_stair, desc_slab, def.sounds, def._mcl_blast_resistance, def._mcl_hardness, desc_double_slab, corner_stair_texture_override)
|
||||
end
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
name = screwdriver
|
|
@ -1 +0,0 @@
|
|||
name = mcl_engine_workarounds
|
|
@ -1 +0,0 @@
|
|||
name = mcl_selftests
|
|
@ -1 +0,0 @@
|
|||
name = mcl_player
|
Loading…
Reference in New Issue