0
0
Fork 0

Rename crafting mod to mcl_inventory

This commit is contained in:
Wuzzy 2017-03-09 17:16:50 +01:00
parent 59eb5c61eb
commit 7873bddf4f
50 changed files with 20 additions and 16 deletions

View File

@ -1,5 +1,4 @@
crafting = {} mcl_inventory.creative_inventory_size = 0
crafting.creative_inventory_size = 0
-- Prepare player info table -- Prepare player info table
local players = {} local players = {}
@ -77,7 +76,7 @@ local function set_inv(filter, player)
for _,itemstring in ipairs(creative_list) do for _,itemstring in ipairs(creative_list) do
inv:add_item("main", ItemStack(itemstring)) inv:add_item("main", ItemStack(itemstring))
end end
crafting.creative_inventory_size = #creative_list mcl_inventory.creative_inventory_size = #creative_list
end end
local function init(player) local function init(player)
@ -186,10 +185,10 @@ local function reset_menu_item_bg()
end end
crafting.set_creative_formspec = function(player, start_i, pagenum, show, page, filter) mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, show, page, filter)
reset_menu_item_bg() reset_menu_item_bg()
pagenum = math.floor(pagenum) or 1 pagenum = math.floor(pagenum) or 1
local pagemax = math.floor((crafting.creative_inventory_size-1) / (9*5) + 1) local pagemax = math.floor((mcl_inventory.creative_inventory_size-1) / (9*5) + 1)
local slider_height local slider_height
if pagemax == 1 then if pagemax == 1 then
slider_height = 4.525 slider_height = 4.525
@ -386,10 +385,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if start_i < 0 then if start_i < 0 then
start_i = start_i + 9*5 start_i = start_i + 9*5
end end
if start_i >= crafting.creative_inventory_size then if start_i >= mcl_inventory.creative_inventory_size then
start_i = start_i - 9*5 start_i = start_i - 9*5
end end
if start_i < 0 or start_i >= crafting.creative_inventory_size then if start_i < 0 or start_i >= mcl_inventory.creative_inventory_size then
start_i = 0 start_i = 0
end end
players[name].start_i = start_i players[name].start_i = start_i
@ -400,7 +399,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
players[name].filter = filter players[name].filter = filter
end end
crafting.set_creative_formspec(player, start_i, start_i / (9*5) + 1, false, page, filter) mcl_inventory.set_creative_formspec(player, start_i, start_i / (9*5) + 1, false, page, filter)
end) end)

View File

@ -0,0 +1 @@
Adds the player inventory, creative inventory and crafting table.

View File

@ -1,3 +1,5 @@
mcl_inventory = {}
local show_armor = false local show_armor = false
if minetest.get_modpath("3d_armor") ~= nil then show_armor = true end if minetest.get_modpath("3d_armor") ~= nil then show_armor = true end
@ -37,7 +39,7 @@ end
local function set_inventory(player) local function set_inventory(player)
if minetest.setting_getbool("creative_mode") then if minetest.setting_getbool("creative_mode") then
crafting.set_creative_formspec(player, 0, 1) mcl_inventory.set_creative_formspec(player, 0, 1)
return return
end end
local inv = player:get_inventory() local inv = player:get_inventory()
@ -173,7 +175,7 @@ minetest.register_on_joinplayer(function(player)
drop_fields(player, "craft") drop_fields(player, "craft")
end) end)
minetest.register_node("crafting:workbench", { minetest.register_node("mcl_inventory:workbench", {
description = "Crafting Table", description = "Crafting Table",
tiles = {"crafting_workbench_top.png", "default_wood.png", "crafting_workbench_side.png", tiles = {"crafting_workbench_top.png", "default_wood.png", "crafting_workbench_side.png",
"crafting_workbench_side.png", "crafting_workbench_front.png", "crafting_workbench_front.png"}, "crafting_workbench_side.png", "crafting_workbench_front.png", "crafting_workbench_front.png"},
@ -189,7 +191,7 @@ minetest.register_node("crafting:workbench", {
}) })
minetest.register_craft({ minetest.register_craft({
output = "crafting:workbench", output = "mcl_inventory:workbench",
recipe = { recipe = {
{"group:wood", "group:wood"}, {"group:wood", "group:wood"},
{"group:wood", "group:wood"} {"group:wood", "group:wood"}
@ -198,11 +200,12 @@ minetest.register_craft({
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "crafting:workbench", recipe = "mcl_inventory:workbench",
burntime = 15, burntime = 15,
}) })
if minetest.setting_getbool("creative_mode") then minetest.register_alias("crafting:workbench", "mcl_inventory:workbench")
dofile(minetest.get_modpath("crafting").."/creative.lua")
end
if minetest.setting_getbool("creative_mode") then
dofile(minetest.get_modpath("mcl_inventory").."/creative.lua")
end

View File

@ -0,0 +1 @@
name = mcl_inventory

View File

Before

Width:  |  Height:  |  Size: 374 B

After

Width:  |  Height:  |  Size: 374 B

View File

Before

Width:  |  Height:  |  Size: 340 B

After

Width:  |  Height:  |  Size: 340 B

View File

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 228 B

View File

Before

Width:  |  Height:  |  Size: 870 B

After

Width:  |  Height:  |  Size: 870 B

View File

Before

Width:  |  Height:  |  Size: 376 B

After

Width:  |  Height:  |  Size: 376 B

View File

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 187 B

View File

Before

Width:  |  Height:  |  Size: 308 B

After

Width:  |  Height:  |  Size: 308 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

Before

Width:  |  Height:  |  Size: 483 B

After

Width:  |  Height:  |  Size: 483 B

View File

Before

Width:  |  Height:  |  Size: 462 B

After

Width:  |  Height:  |  Size: 462 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 134 B

After

Width:  |  Height:  |  Size: 134 B

View File

Before

Width:  |  Height:  |  Size: 431 B

After

Width:  |  Height:  |  Size: 431 B

View File

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 406 B

View File

Before

Width:  |  Height:  |  Size: 389 B

After

Width:  |  Height:  |  Size: 389 B

View File

Before

Width:  |  Height:  |  Size: 455 B

After

Width:  |  Height:  |  Size: 455 B

View File

Before

Width:  |  Height:  |  Size: 801 B

After

Width:  |  Height:  |  Size: 801 B

View File

Before

Width:  |  Height:  |  Size: 768 B

After

Width:  |  Height:  |  Size: 768 B

View File

Before

Width:  |  Height:  |  Size: 1012 B

After

Width:  |  Height:  |  Size: 1012 B

View File

Before

Width:  |  Height:  |  Size: 844 B

After

Width:  |  Height:  |  Size: 844 B

View File

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 410 B

View File

Before

Width:  |  Height:  |  Size: 325 B

After

Width:  |  Height:  |  Size: 325 B

View File

Before

Width:  |  Height:  |  Size: 524 B

After

Width:  |  Height:  |  Size: 524 B

View File

Before

Width:  |  Height:  |  Size: 947 B

After

Width:  |  Height:  |  Size: 947 B

View File

Before

Width:  |  Height:  |  Size: 380 B

After

Width:  |  Height:  |  Size: 380 B

View File

Before

Width:  |  Height:  |  Size: 658 B

After

Width:  |  Height:  |  Size: 658 B

View File

Before

Width:  |  Height:  |  Size: 576 B

After

Width:  |  Height:  |  Size: 576 B

View File

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 744 B

View File

Before

Width:  |  Height:  |  Size: 751 B

After

Width:  |  Height:  |  Size: 751 B

View File

Before

Width:  |  Height:  |  Size: 859 B

After

Width:  |  Height:  |  Size: 859 B

View File

Before

Width:  |  Height:  |  Size: 425 B

After

Width:  |  Height:  |  Size: 425 B

View File

Before

Width:  |  Height:  |  Size: 430 B

After

Width:  |  Height:  |  Size: 430 B

View File

Before

Width:  |  Height:  |  Size: 487 B

After

Width:  |  Height:  |  Size: 487 B

View File

@ -6,6 +6,6 @@ mcl_colorblocks
mcl_wool mcl_wool
mcl_fences mcl_fences
mcl_chests mcl_chests
crafting mcl_inventory
mesecons_pressureplates mesecons_pressureplates
mcl_tnt mcl_tnt