Start adding crafting recipes to everything with the new crafting system and fix some things with armor
This commit is contained in:
parent
d7b63ec912
commit
dc8674b93f
@ -1,2 +1,3 @@
|
||||
default
|
||||
crafting
|
||||
achievements
|
||||
|
@ -6,24 +6,44 @@
|
||||
armor = {}
|
||||
|
||||
armor.player_skin = "character.png"
|
||||
armor.update_time = 1
|
||||
|
||||
armor.materials = {
|
||||
-- material craftitem % description
|
||||
-- material craftitem % description
|
||||
{"wood", "group:planks", 15, "Wooden"},
|
||||
{"steel", "default:ingot_steel", 30, "Steel"},
|
||||
{"chainmail", "armor:chainmail_sheet", 45, "Chainmail"},
|
||||
{"carbonsteel", "default:ingot_carbonsteel", 60, "Carbonsteel"},
|
||||
}
|
||||
|
||||
armor.slots = {"helmet", "chestplate", "boots"}
|
||||
-- Usable slots
|
||||
|
||||
local form_armor = default.ui.get_page("default:2part")
|
||||
default.ui.register_page("armor:armor", form_armor)
|
||||
armor.slots = {"helmet", "chestplate", "boots"}
|
||||
|
||||
local enable_drop = minetest.setting_getbool("drop_items_on_die") or false
|
||||
|
||||
local armor_timer = 10
|
||||
-- Timer
|
||||
|
||||
local timer_interval = 1
|
||||
local timer = 10
|
||||
|
||||
-- Formspec
|
||||
|
||||
local form_armor = default.ui.get_page("default:2part")
|
||||
|
||||
form_armor = form_armor .. "list[current_player;main;0.25,4.75;8,4;]"
|
||||
form_armor = form_armor .. default.ui.get_hotbar_itemslot_bg(0.25, 4.75, 8, 1)
|
||||
form_armor = form_armor .. default.ui.get_itemslot_bg(0.25, 5.75, 8, 3)
|
||||
form_armor = form_armor .. "listring[current_player;main]"
|
||||
|
||||
form_armor = form_armor .. "label[3.25,1;Helmet]"
|
||||
form_armor = form_armor .. "label[3.25,2;Chestplate]"
|
||||
form_armor = form_armor .. "label[3.25,3;Boots]"
|
||||
|
||||
form_armor = form_armor .. "list[current_player;armor;2.25,0.75;1,3;]"
|
||||
form_armor = form_armor .. "listring[current_player;armor]"
|
||||
form_armor = form_armor .. default.ui.get_itemslot_bg(2.25, 0.75, 1, 3)
|
||||
|
||||
default.ui.register_page("armor:armor", form_armor)
|
||||
|
||||
function armor.is_armor(itemname)
|
||||
local item = minetest.registered_items[itemname]
|
||||
@ -57,9 +77,10 @@ function armor.get_texture(player, base)
|
||||
|
||||
local image = base
|
||||
|
||||
for _, slot in ipairs(armor.slots) do
|
||||
local itemstack = inv:get_stack("armor_"..slot, 1)
|
||||
for slot_index, slot in ipairs(armor.slots) do
|
||||
local itemstack = inv:get_stack("armor", slot_index)
|
||||
local itemname = itemstack:get_name()
|
||||
|
||||
if armor.is_armor(itemname) and armor.is_slot(itemname, slot) then
|
||||
local item = minetest.registered_items[itemname]
|
||||
local mat = armor.materials[item.groups.armor_material][1]
|
||||
@ -68,7 +89,7 @@ function armor.get_texture(player, base)
|
||||
end
|
||||
end
|
||||
|
||||
-- print("[armor] Got armor texture: " .. image)
|
||||
-- print("[armor] Got armor texture: " .. image)
|
||||
|
||||
return image
|
||||
end
|
||||
@ -81,8 +102,8 @@ function armor.get_groups(player)
|
||||
|
||||
local inv = player:get_inventory()
|
||||
|
||||
for _, slot in ipairs(armor.slots) do
|
||||
local itemstack = inv:get_stack("armor_"..slot, 1)
|
||||
for slot_index, slot in ipairs(armor.slots) do
|
||||
local itemstack = inv:get_stack("armor", slot_index)
|
||||
local itemname = itemstack:get_name()
|
||||
|
||||
if armor.is_armor(itemname) then
|
||||
@ -96,9 +117,11 @@ function armor.get_groups(player)
|
||||
if match_mat == nil then
|
||||
match_mat = mat
|
||||
end
|
||||
|
||||
if mat == match_mat then
|
||||
match_amt = match_amt + 1
|
||||
end
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
@ -106,7 +129,9 @@ function armor.get_groups(player)
|
||||
end
|
||||
end
|
||||
|
||||
if match_amt == #armor.slots then -- if full set of same armor material, then boost armor by 10%
|
||||
-- If full set of same armor material, then boost armor by 10%
|
||||
|
||||
if match_amt == #armor.slots then
|
||||
groups.fleshy = groups.fleshy - 10
|
||||
end
|
||||
|
||||
@ -118,10 +143,8 @@ end
|
||||
function armor.init(player)
|
||||
local inv = player:get_inventory()
|
||||
|
||||
for _, slot in ipairs(armor.slots) do
|
||||
if inv:get_size("armor_"..slot) ~= 1 then
|
||||
inv:set_size("armor_"..slot, 1)
|
||||
end
|
||||
if inv:get_size("armor") ~= 3 then
|
||||
inv:set_size("armor", 3)
|
||||
end
|
||||
end
|
||||
|
||||
@ -143,13 +166,13 @@ local function on_joinplayer(player)
|
||||
armor.init(player)
|
||||
end
|
||||
|
||||
local function on_die(player)
|
||||
local function on_dieplayer(player)
|
||||
local pos = player:getpos()
|
||||
|
||||
local inv = player:get_inventory()
|
||||
|
||||
for _, slot in ipairs(armor.slots) do
|
||||
local item = inv:get_stack("armor_"..slot, 1)
|
||||
for slot_index, slot in ipairs(armor.slots) do
|
||||
local item = inv:get_stack("armor", slot_index)
|
||||
|
||||
local rpos = {
|
||||
x = pos.x + math.random(-0.2, 0.2),
|
||||
@ -165,7 +188,7 @@ local function on_die(player)
|
||||
x = math.random(-0.3, 0.3),
|
||||
y = 3,
|
||||
z = math.random(-0.3, 0.3),
|
||||
})
|
||||
})
|
||||
end
|
||||
|
||||
item:clear()
|
||||
@ -173,53 +196,73 @@ local function on_die(player)
|
||||
end
|
||||
end
|
||||
|
||||
local function step(dtime)
|
||||
armor_timer = armor_timer + dtime
|
||||
local function on_globalstep(dtime)
|
||||
timer = timer + dtime
|
||||
|
||||
if armor_timer > armor.update_time then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
armor.update(player)
|
||||
end
|
||||
armor_timer = 0
|
||||
if timer < timer_interval then
|
||||
return
|
||||
end
|
||||
|
||||
timer = 0
|
||||
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
armor.update(player)
|
||||
end
|
||||
end
|
||||
|
||||
if enable_drop then
|
||||
minetest.register_on_dieplayer(on_dieplayer)
|
||||
end
|
||||
|
||||
minetest.register_on_newplayer(on_newplayer)
|
||||
minetest.register_on_joinplayer(on_joinplayer)
|
||||
|
||||
minetest.register_globalstep(on_globalstep)
|
||||
|
||||
-- Chainmail
|
||||
|
||||
minetest.register_craftitem(
|
||||
"armor:chainmail_sheet",
|
||||
{
|
||||
description = "Chainmail sheet",
|
||||
description = "Chainmail Sheet",
|
||||
|
||||
inventory_image = "armor_chainmail.png",
|
||||
wield_image = "armor_chainmail.png",
|
||||
|
||||
stack_max = 20,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "armor:chainmail_sheet 3",
|
||||
recipe = {
|
||||
{"default:ingot_steel", "", "default:ingot_steel"},
|
||||
{"", "default:ingot_steel", ""},
|
||||
{"default:ingot_steel", "", "default:ingot_steel"},
|
||||
items = {
|
||||
"default:ingot_steel 5",
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
-- Armor pieces
|
||||
|
||||
for mat_index, _ in ipairs(armor.materials) do
|
||||
local def = armor.materials[mat_index]
|
||||
local mat = def[1]
|
||||
|
||||
local armor_def = math.floor(def[3] / #armor.slots)
|
||||
-- print("Material " .. mat .. ": " .. armor_def)
|
||||
-- print("Material " .. mat .. ": " .. armor_def)
|
||||
|
||||
for _, slot in ipairs(armor.slots) do
|
||||
minetest.register_craftitem(
|
||||
"armor:"..slot.."_"..mat,
|
||||
{
|
||||
description = def[4].." "..slot,
|
||||
local slot_pretty = slot:gsub(
|
||||
"(%a)([%w_']*)",
|
||||
function(first, rest)
|
||||
return first:upper() .. rest:lower()
|
||||
end)
|
||||
|
||||
inventory_image = "armor_"..slot.."_"..mat.."_inventory.png",
|
||||
wield_image = "armor_"..slot.."_"..mat.."_inventory.png",
|
||||
minetest.register_craftitem(
|
||||
"armor:" .. slot .. "_" .. mat,
|
||||
{
|
||||
description = def[4] .. " " .. slot_pretty,
|
||||
|
||||
inventory_image = "armor_" .. slot .. "_" .. mat .. "_inventory.png",
|
||||
wield_image = "armor_" .. slot .. "_" .. mat .. "_inventory.png",
|
||||
|
||||
groups = {
|
||||
is_armor = 1,
|
||||
@ -228,72 +271,34 @@ for mat_index, _ in ipairs(armor.materials) do
|
||||
},
|
||||
|
||||
stack_max = 1,
|
||||
})
|
||||
})
|
||||
end
|
||||
|
||||
local n = def[2]
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "armor:helmet_" .. mat,
|
||||
items = {
|
||||
def[2] .. " 5",
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "armor:helmet_"..mat,
|
||||
recipe = {
|
||||
{n, n, n},
|
||||
{n, "", n},
|
||||
{"", "", ""},
|
||||
output = "armor:chestplate_" .. mat,
|
||||
items = {
|
||||
def[2] .. " 8",
|
||||
}
|
||||
})
|
||||
minetest.register_craft(
|
||||
})
|
||||
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "armor:chestplate_"..mat,
|
||||
recipe = {
|
||||
{n, "", n},
|
||||
{n, n, n},
|
||||
{n, n, n},
|
||||
output = "armor:boots_" .. mat,
|
||||
items = {
|
||||
def[2] .. " 6",
|
||||
}
|
||||
})
|
||||
minetest.register_craft(
|
||||
{
|
||||
output = "armor:boots_"..mat,
|
||||
recipe = {
|
||||
{"", "", ""},
|
||||
{n, "", n},
|
||||
{n, "", n},
|
||||
}
|
||||
})
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_on_newplayer(on_newplayer)
|
||||
minetest.register_on_joinplayer(on_joinplayer)
|
||||
|
||||
if enable_drop then
|
||||
minetest.register_on_dieplayer(on_die)
|
||||
end
|
||||
|
||||
minetest.register_globalstep(step)
|
||||
|
||||
local form_armor = default.ui.get_page("default:2part")
|
||||
form_armor = form_armor .. "list[current_player;main;0.25,4.75;8,4;]"
|
||||
form_armor = form_armor .. default.ui.get_hotbar_itemslot_bg(0.25, 4.75, 8, 1)
|
||||
form_armor = form_armor .. default.ui.get_itemslot_bg(0.25, 5.75, 8, 3)
|
||||
form_armor = form_armor .. "listring[current_player;main]"
|
||||
|
||||
form_armor = form_armor .. "label[3.25,3;Boots]"
|
||||
form_armor = form_armor .. "list[current_player;armor_boots;2.25,2.75;1,1;]"
|
||||
form_armor = form_armor .. "listring[current_player;armor_boots]"
|
||||
form_armor = form_armor .. default.ui.get_itemslot_bg(2.25, 2.75, 1, 1)
|
||||
|
||||
form_armor = form_armor .. "label[3.25,2;Chestplate]"
|
||||
form_armor = form_armor .. "list[current_player;armor_chestplate;2.25,1.75;1,1;]"
|
||||
form_armor = form_armor .. "listring[current_player;armor_chestplate]"
|
||||
form_armor = form_armor .. default.ui.get_itemslot_bg(2.25, 1.75, 1, 1)
|
||||
|
||||
form_armor = form_armor .. "label[3.25,1;Helmet]"
|
||||
form_armor = form_armor .. "list[current_player;armor_helmet;2.25,0.75;1,1;]"
|
||||
form_armor = form_armor .. "listring[current_player;armor_helmet]"
|
||||
form_armor = form_armor .. default.ui.get_itemslot_bg(2.25, 0.75, 1, 1)
|
||||
|
||||
default.ui.register_page("armor:armor", form_armor)
|
||||
|
||||
-- Achievements
|
||||
|
||||
achievements.register_achievement(
|
||||
@ -303,15 +308,15 @@ achievements.register_achievement(
|
||||
description = "Craft a piece of armor",
|
||||
times = 1,
|
||||
craftitem = "group:is_armor",
|
||||
})
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"warrior",
|
||||
{
|
||||
title = "Warrior",
|
||||
description = "Craft 10 piece of armor",
|
||||
description = "Craft 10 pieces of armor",
|
||||
times = 10,
|
||||
craftitem = "group:is_armor",
|
||||
})
|
||||
})
|
||||
|
||||
default.log("mod:armor", "loaded")
|
||||
|
@ -189,8 +189,8 @@ crafting.register_craft(
|
||||
{
|
||||
output = "default:dust_carbonsteel",
|
||||
items = {
|
||||
"default:lump_coal",
|
||||
"default:lump_iron 2",
|
||||
"default:lump_coal 2",
|
||||
"default:lump_iron 3",
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -1,2 +1,3 @@
|
||||
default
|
||||
crafting
|
||||
achievements
|
||||
|
@ -6,6 +6,7 @@
|
||||
door = {}
|
||||
|
||||
-- Registers a door
|
||||
|
||||
function door.register_door(name, def)
|
||||
def.groups.not_in_creative_inventory = 1
|
||||
|
||||
@ -30,8 +31,8 @@ function door.register_door(name, def)
|
||||
if not def.sound_open_door then
|
||||
def.sound_open_door = "door_open"
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
minetest.register_craftitem(
|
||||
name, {
|
||||
description = def.description,
|
||||
@ -40,58 +41,59 @@ function door.register_door(name, def)
|
||||
groups = def.groups,
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if not pointed_thing.type == "node" then
|
||||
return itemstack
|
||||
end
|
||||
if not pointed_thing.type == "node" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local ptu = pointed_thing.under
|
||||
local nu = minetest.get_node(ptu)
|
||||
if minetest.registered_nodes[nu.name].on_rightclick then
|
||||
return minetest.registered_nodes[nu.name].on_rightclick(ptu, nu, placer, itemstack)
|
||||
end
|
||||
local ptu = pointed_thing.under
|
||||
local nu = minetest.get_node(ptu)
|
||||
if minetest.registered_nodes[nu.name].on_rightclick then
|
||||
return minetest.registered_nodes[nu.name].on_rightclick(
|
||||
ptu, nu, placer, itemstack)
|
||||
end
|
||||
|
||||
local pt = pointed_thing.above
|
||||
local pt2 = {x=pt.x, y=pt.y, z=pt.z}
|
||||
pt2.y = pt2.y+1
|
||||
if
|
||||
not minetest.registered_nodes[minetest.get_node(pt).name].buildable_to or
|
||||
not minetest.registered_nodes[minetest.get_node(pt2).name].buildable_to or
|
||||
not placer or
|
||||
not placer:is_player()
|
||||
then
|
||||
return itemstack
|
||||
end
|
||||
local pt = pointed_thing.above
|
||||
local pt2 = {x=pt.x, y=pt.y, z=pt.z}
|
||||
pt2.y = pt2.y+1
|
||||
if
|
||||
not minetest.registered_nodes[minetest.get_node(pt).name].buildable_to or
|
||||
not minetest.registered_nodes[minetest.get_node(pt2).name].buildable_to or
|
||||
not placer or
|
||||
not placer:is_player()
|
||||
then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
local pt3 = {x=pt.x, y=pt.y, z=pt.z}
|
||||
if p2 == 0 then
|
||||
pt3.x = pt3.x-1
|
||||
elseif p2 == 1 then
|
||||
pt3.z = pt3.z+1
|
||||
elseif p2 == 2 then
|
||||
pt3.x = pt3.x+1
|
||||
elseif p2 == 3 then
|
||||
pt3.z = pt3.z-1
|
||||
end
|
||||
if minetest.get_item_group(minetest.get_node(pt3).name, "door") == 0 then
|
||||
minetest.set_node(pt, {name=name.."_b_1", param2=p2})
|
||||
minetest.set_node(pt2, {name=name.."_t_1", param2=p2})
|
||||
else
|
||||
minetest.set_node(pt, {name=name.."_b_2", param2=p2})
|
||||
minetest.set_node(pt2, {name=name.."_t_2", param2=p2})
|
||||
minetest.get_meta(pt):set_int("right", 1)
|
||||
minetest.get_meta(pt2):set_int("right", 1)
|
||||
end
|
||||
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
local pt3 = {x=pt.x, y=pt.y, z=pt.z}
|
||||
if p2 == 0 then
|
||||
pt3.x = pt3.x-1
|
||||
elseif p2 == 1 then
|
||||
pt3.z = pt3.z+1
|
||||
elseif p2 == 2 then
|
||||
pt3.x = pt3.x+1
|
||||
elseif p2 == 3 then
|
||||
pt3.z = pt3.z-1
|
||||
end
|
||||
if minetest.get_item_group(minetest.get_node(pt3).name, "door") == 0 then
|
||||
minetest.set_node(pt, {name=name.."_b_1", param2=p2})
|
||||
minetest.set_node(pt2, {name=name.."_t_1", param2=p2})
|
||||
else
|
||||
minetest.set_node(pt, {name=name.."_b_2", param2=p2})
|
||||
minetest.set_node(pt2, {name=name.."_t_2", param2=p2})
|
||||
minetest.get_meta(pt):set_int("right", 1)
|
||||
minetest.get_meta(pt2):set_int("right", 1)
|
||||
end
|
||||
|
||||
itemstack:take_item()
|
||||
itemstack:take_item()
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
local tt = def.tiles_top
|
||||
local tb = def.tiles_bottom
|
||||
|
||||
|
||||
local function after_dig_node(pos, name, digger)
|
||||
local node = minetest.get_node(pos)
|
||||
if node.name == name then
|
||||
@ -106,23 +108,35 @@ function door.register_door(name, def)
|
||||
end
|
||||
local p2 = minetest.get_node(pos).param2
|
||||
p2 = params[p2+1]
|
||||
|
||||
|
||||
minetest.swap_node(pos, {name=replace_dir, param2=p2})
|
||||
|
||||
|
||||
pos.y = pos.y-dir
|
||||
minetest.swap_node(pos, {name=replace, param2=p2})
|
||||
|
||||
local snd_1 = def.sound_close_door
|
||||
local snd_2 = def.sound_open_door
|
||||
local snd_2 = def.sound_open_door
|
||||
if params[1] == 3 then
|
||||
snd_1 = def.sound_open_door
|
||||
snd_1 = def.sound_open_door
|
||||
snd_2 = def.sound_close_door
|
||||
end
|
||||
|
||||
if minetest.get_meta(pos):get_int("right") ~= 0 then
|
||||
minetest.sound_play(snd_1, {pos = pos, gain = 0.8, max_hear_distance = 10})
|
||||
minetest.sound_play(
|
||||
snd_1,
|
||||
{
|
||||
pos = pos,
|
||||
gain = 0.8,
|
||||
max_hear_distance = 10
|
||||
})
|
||||
else
|
||||
minetest.sound_play(snd_2, {pos = pos, gain = 0.8, max_hear_distance = 10})
|
||||
minetest.sound_play(
|
||||
snd_2,
|
||||
{
|
||||
pos = pos,
|
||||
gain = 0.8,
|
||||
max_hear_distance = 10
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
@ -151,22 +165,22 @@ function door.register_door(name, def)
|
||||
fixed = def.selection_box_bottom
|
||||
},
|
||||
groups = def.groups,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
pos.y = pos.y+1
|
||||
after_dig_node(pos, name.."_t_1", digger)
|
||||
end,
|
||||
|
||||
pos.y = pos.y+1
|
||||
after_dig_node(pos, name.."_t_1", digger)
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
if check_player_priv(pos, clicker) then
|
||||
on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
|
||||
end
|
||||
end,
|
||||
|
||||
if check_player_priv(pos, clicker) then
|
||||
on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
|
||||
end
|
||||
end,
|
||||
|
||||
can_dig = check_player_priv,
|
||||
sounds = def.sounds,
|
||||
sunlight_propagates = def.sunlight
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_node(
|
||||
name.."_t_1",
|
||||
@ -185,22 +199,22 @@ function door.register_door(name, def)
|
||||
fixed = def.selection_box_top
|
||||
},
|
||||
groups = def.groups,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
pos.y = pos.y-1
|
||||
after_dig_node(pos, name.."_b_1", digger)
|
||||
end,
|
||||
|
||||
pos.y = pos.y-1
|
||||
after_dig_node(pos, name.."_b_1", digger)
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
if check_player_priv(pos, clicker) then
|
||||
on_rightclick(pos, -1, name.."_b_1", name.."_t_2", name.."_b_2", {1,2,3,0})
|
||||
end
|
||||
end,
|
||||
|
||||
if check_player_priv(pos, clicker) then
|
||||
on_rightclick(pos, -1, name.."_b_1", name.."_t_2", name.."_b_2", {1,2,3,0})
|
||||
end
|
||||
end,
|
||||
|
||||
can_dig = check_player_priv,
|
||||
sounds = def.sounds,
|
||||
sunlight_propagates = def.sunlight,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_node(
|
||||
name.."_b_2",
|
||||
@ -219,22 +233,22 @@ function door.register_door(name, def)
|
||||
fixed = def.selection_box_bottom
|
||||
},
|
||||
groups = def.groups,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
pos.y = pos.y+1
|
||||
after_dig_node(pos, name.."_t_2", digger)
|
||||
end,
|
||||
|
||||
pos.y = pos.y+1
|
||||
after_dig_node(pos, name.."_t_2", digger)
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
if check_player_priv(pos, clicker) then
|
||||
on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
|
||||
end
|
||||
end,
|
||||
|
||||
if check_player_priv(pos, clicker) then
|
||||
on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
|
||||
end
|
||||
end,
|
||||
|
||||
can_dig = check_player_priv,
|
||||
sounds = def.sounds,
|
||||
sunlight_propagates = def.sunlight
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_node(
|
||||
name.."_t_2",
|
||||
@ -253,22 +267,22 @@ function door.register_door(name, def)
|
||||
fixed = def.selection_box_top
|
||||
},
|
||||
groups = def.groups,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
pos.y = pos.y-1
|
||||
after_dig_node(pos, name.."_b_2", digger)
|
||||
end,
|
||||
|
||||
pos.y = pos.y-1
|
||||
after_dig_node(pos, name.."_b_2", digger)
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
if check_player_priv(pos, clicker) then
|
||||
on_rightclick(pos, -1, name.."_b_2", name.."_t_1", name.."_b_1", {3,0,1,2})
|
||||
end
|
||||
end,
|
||||
|
||||
if check_player_priv(pos, clicker) then
|
||||
on_rightclick(pos, -1, name.."_b_2", name.."_t_1", name.."_b_1", {3,0,1,2})
|
||||
end
|
||||
end,
|
||||
|
||||
can_dig = check_player_priv,
|
||||
sounds = def.sounds,
|
||||
sunlight_propagates = def.sunlight
|
||||
})
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
@ -282,17 +296,17 @@ door.register_door(
|
||||
tiles_bottom = {"door_wood_b.png", "door_brown.png"},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
sunlight = false,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "door:door_wood",
|
||||
recipe = {
|
||||
{"default:fiber", "default:glass", "default:fiber"},
|
||||
{"default:stick", "default:stick", "default:stick"},
|
||||
{"default:fiber", "group:planks", "default:fiber"},
|
||||
items = {
|
||||
"default:fiber 6",
|
||||
"default:stick 7",
|
||||
"group:planks 2",
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
door.register_door(
|
||||
"door:door_stone",
|
||||
@ -304,17 +318,17 @@ door.register_door(
|
||||
tiles_bottom = {"door_stone_b.png", "door_brown.png"},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
sunlight = false,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "door:door_stone",
|
||||
recipe = {
|
||||
{"default:fiber", "default:glass", "default:fiber"},
|
||||
{"default:stick", "default:stick", "default:stick"},
|
||||
{"default:fiber", "group:stone", "default:fiber"},
|
||||
items = {
|
||||
"default:fiber 6",
|
||||
"default:stick 7",
|
||||
"group:stone 2",
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
-- Achievements
|
||||
|
||||
@ -325,6 +339,6 @@ achievements.register_achievement(
|
||||
description = "Craft a door",
|
||||
times = 1,
|
||||
craftitem = "group:door",
|
||||
})
|
||||
})
|
||||
|
||||
default.log("mod:door", "loaded")
|
||||
default.log("mod:door", "loaded")
|
||||
|
@ -1,23 +1,30 @@
|
||||
|
||||
--
|
||||
-- Crafts and items
|
||||
--
|
||||
|
||||
-- Items
|
||||
|
||||
minetest.register_craftitem(
|
||||
"farming:cotton",
|
||||
{
|
||||
description = "Cotton",
|
||||
inventory_image = "farming_cotton.png"
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"farming:wheat",
|
||||
{
|
||||
description = "Wheat",
|
||||
inventory_image = "farming_wheat.png"
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"farming:flour",
|
||||
{
|
||||
description = "Flour",
|
||||
inventory_image = "farming_flour.png"
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"farming:bread",
|
||||
@ -25,25 +32,27 @@ minetest.register_craftitem(
|
||||
description = "Bread",
|
||||
inventory_image = "farming_bread.png",
|
||||
on_use = minetest.item_eat({hp = 4, sat = 40})
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
-- Craft recipes
|
||||
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "farming:flour",
|
||||
recipe = {
|
||||
{"farming:wheat", "farming:wheat"},
|
||||
{"farming:wheat", "farming:wheat"},
|
||||
items = {
|
||||
"farming:wheat 4",
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
crafting.register_craft(
|
||||
{
|
||||
output = "farming:cotton_bale 2",
|
||||
recipe = {
|
||||
{"farming:cotton", "farming:cotton"},
|
||||
{"farming:cotton", "farming:cotton"},
|
||||
items = {
|
||||
"farming:cotton 2",
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
-- Cooking
|
||||
|
||||
minetest.register_craft(
|
||||
{
|
||||
@ -51,6 +60,6 @@ minetest.register_craft(
|
||||
output = "farming:bread",
|
||||
recipe = "farming:flour",
|
||||
cooktime = 15,
|
||||
})
|
||||
})
|
||||
|
||||
default.log("craft", "loaded")
|
||||
default.log("craft", "loaded")
|
||||
|
@ -1,3 +1,4 @@
|
||||
default
|
||||
weather
|
||||
crafting
|
||||
achievements
|
||||
|
Loading…
Reference in New Issue
Block a user