💥 Break old settings

- Rename bitchange_ -> bitchange.
- Better coding style
- Run OptiPNG
This commit is contained in:
SmallJoker 2015-04-16 15:06:02 +02:00
parent 20fcf0a0a0
commit 84f1b0f330
26 changed files with 138 additions and 150 deletions

View File

@ -87,21 +87,21 @@ minetest.register_node("bitchange:bank", {
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
if bitchange_has_access(meta:get_string("owner"), player:get_player_name()) then
if bitchange.has_access(meta:get_string("owner"), player:get_player_name()) then
return count
end
return 0
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if bitchange_has_access(meta:get_string("owner"), player:get_player_name()) then
if bitchange.has_access(meta:get_string("owner"), player:get_player_name()) then
return stack:get_count()
end
return 0
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if bitchange_has_access(meta:get_string("owner"), player:get_player_name()) then
if bitchange.has_access(meta:get_string("owner"), player:get_player_name()) then
return stack:get_count()
end
return 0

View File

@ -1,30 +1,31 @@
-- General configuration - BitChange
-- Created by Krock
bitchange_initial_give = 2
bitchange.initial_give = 2
-- Enable/Disable whole nodes
bitchange_enable_exchangeshop = true
bitchange_enable_moneychanger = true
bitchange_enable_warehouse = false
bitchange_enable_toolrepair = true
bitchange_enable_donationbox = true
bitchange.enable_exchangeshop = true
bitchange.enable_moneychanger = true
bitchange.enable_warehouse = false
bitchange.enable_toolrepair = true
bitchange.enable_donationbox = true
-- Set this variable to false if you have a supported currency enabled
-- and if you want to disable the exchanging/converting point - the bank
-- Supported: money (by kotolegokot), money2 (by Bad Command), currency (by Dan Duncombe)
bitchange_enable_bank = false
bitchange.enable_bank = false
-- Converting other ores to MineCoins
-- Tin moreores
-- Zinc technic_worldgen
-- Quartz quartz
bitchange_use_moreores_tin = false
bitchange_use_technic_zinc = false
bitchange_use_quartz = false
bitchange.use_moreores_tin = false
bitchange.use_technic_zinc = false
bitchange.use_quartz = false
-- Pipeworks support
bitchange_exchangeshop_pipeworks = false
bitchange_warehouse_pipeworks = false
bitchange.exchangeshop_pipeworks = false
bitchange.warehouse_pipeworks = false
-- Advanced generation settings
-- Change in 'minecoins.lua', starting at line 101
bitchange.enable_generation = true

View File

@ -48,7 +48,7 @@ minetest.register_node("bitchange:donationbox", {
local inv = meta:get_inventory()
if not inv:is_empty("main") then
return false
elseif bitchange_has_access(meta:get_string("owner"), player:get_player_name()) then
elseif bitchange.has_access(meta:get_string("owner"), player:get_player_name()) then
return true
end
return false
@ -59,9 +59,9 @@ minetest.register_node("bitchange:donationbox", {
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if(not bitchange_has_access(meta:get_string("owner"), player:get_player_name())) then
if not bitchange.has_access(meta:get_string("owner"), player:get_player_name()) then
return 0
end
return stack:get_count()
@ -69,10 +69,10 @@ minetest.register_node("bitchange:donationbox", {
})
minetest.register_craft({
output = 'bitchange:donationbox',
output = "bitchange:donationbox",
recipe = {
{'default:wood', '', 'default:wood'},
{'default:wood', 'bitchange:minecoin', 'default:wood'},
{'default:wood', 'default:wood', 'default:wood'}
{"default:wood", "", "default:wood"},
{"default:wood", "bitchange:minecoin", "default:wood"},
{"default:wood", "default:wood", "default:wood"}
}
})

View File

@ -3,7 +3,7 @@ bitchange = {}
bitchange.mod_path = minetest.get_modpath("bitchange")
local world_path = minetest.get_worldpath()
if freeminer then
if rawget(_G, "freeminer") then
minetest = freeminer
end
@ -27,22 +27,22 @@ end
dofile(bitchange.mod_path.."/minecoins.lua")
dofile(bitchange.mod_path.."/moreores.lua")
if bitchange_enable_exchangeshop then
if bitchange.enable_exchangeshop then
dofile(bitchange.mod_path.."/shop.lua")
end
if bitchange_enable_moneychanger then
if bitchange.enable_moneychanger then
dofile(bitchange.mod_path.."/moneychanger.lua")
end
if bitchange_enable_warehouse then
if bitchange.enable_warehouse then
dofile(bitchange.mod_path.."/warehouse.lua")
end
if bitchange_enable_toolrepair then
if bitchange.enable_toolrepair then
dofile(bitchange.mod_path.."/toolrepair.lua")
end
if bitchange_enable_donationbox then
if bitchange.enable_donationbox then
dofile(bitchange.mod_path.."/donationbox.lua")
end
if bitchange_enable_bank then
if bitchange.enable_bank then
local loaded_bank = false
for i, v in ipairs({"money", "money2", "currency"}) do
if minetest.get_modpath(v) then
@ -61,13 +61,13 @@ end
if not minetest.setting_getbool("creative_mode") and bitchange_initial_give > 0 then
-- Giving initial money
minetest.register_on_newplayer(function(player)
player:get_inventory():add_item("main", "bitchange:mineninth "..bitchange_initial_give)
player:get_inventory():add_item("main", "bitchange:mineninth "..bitchange.initial_give)
end)
end
-- Privs
minetest.register_privilege("bitchange", "Can access to owned nodes of the bitchange mod")
function bitchange_has_access(owner, player_name)
function bitchange.has_access(owner, player_name)
return (player_name == owner or owner == "" or minetest.get_player_privs(player_name).server or minetest.get_player_privs(player_name).bitchange)
end

View File

@ -40,19 +40,19 @@ minetest.register_node("bitchange:minecoinblock", {
is_ground_content = true,
groups = {cracky=2},
sounds = default.node_sound_stone_defaults(),
stack_max = 30000,
stack_max = 30000,
})
minetest.register_craftitem("bitchange:minecoin", {
description = "MineCoin",
inventory_image = "bitchange_minecoin.png",
stack_max = 30000,
stack_max = 30000,
})
minetest.register_craftitem("bitchange:mineninth", {
description = "MineNinth",
inventory_image = "bitchange_mineninth.png",
stack_max = 30000,
stack_max = 30000,
})
minetest.register_craftitem("bitchange:coinbase", {
@ -62,56 +62,58 @@ minetest.register_craftitem("bitchange:coinbase", {
-- Crafting
minetest.register_craft({
output = 'bitchange:minecoinblock',
output = "bitchange:minecoinblock",
recipe = {
{'bitchange:minecoin', 'bitchange:minecoin', 'bitchange:minecoin'},
{'bitchange:minecoin', 'bitchange:minecoin', 'bitchange:minecoin'},
{'bitchange:minecoin', 'bitchange:minecoin', 'bitchange:minecoin'},
{"bitchange:minecoin", "bitchange:minecoin", "bitchange:minecoin"},
{"bitchange:minecoin", "bitchange:minecoin", "bitchange:minecoin"},
{"bitchange:minecoin", "bitchange:minecoin", "bitchange:minecoin"},
}
})
minetest.register_craft({
output = 'bitchange:minecoin 9',
output = "bitchange:minecoin 9",
recipe = {
{'bitchange:minecoinblock'},
{"bitchange:minecoinblock"},
}
})
minetest.register_craft({
output = 'bitchange:minecoin',
output = "bitchange:minecoin",
recipe = {
{'bitchange:mineninth', 'bitchange:mineninth', 'bitchange:mineninth'},
{'bitchange:mineninth', 'bitchange:mineninth', 'bitchange:mineninth'},
{'bitchange:mineninth', 'bitchange:mineninth', 'bitchange:mineninth'},
{"bitchange:mineninth", "bitchange:mineninth", "bitchange:mineninth"},
{"bitchange:mineninth", "bitchange:mineninth", "bitchange:mineninth"},
{"bitchange:mineninth", "bitchange:mineninth", "bitchange:mineninth"},
}
})
minetest.register_craft({
output = 'bitchange:mineninth 9',
output = "bitchange:mineninth 9",
recipe = {
{'bitchange:minecoin'},
{"bitchange:minecoin"},
}
})
-- Cooking
minetest.register_craft({
type = 'cooking',
type = "cooking",
recipe = "bitchange:coinbase",
output = "bitchange:mineninth",
})
minetest.register_craft({
type = 'cooking',
type = "cooking",
recipe = "default:goldblock",
output = "bitchange:minecoinblock 2",
})
minetest.register_craft({
type = 'cooking',
type = "cooking",
recipe = "bitchange:minecoinblock",
output = "default:gold_ingot 4",
})
-- Generation
if bitchange.enable_generation then
minetest.register_ore({
ore_type = "scatter",
ore = "bitchange:minecoin_in_ground",
@ -143,4 +145,5 @@ minetest.register_ore({
clust_size = 7,
height_max = 28000,
height_min = -255,
})
})
end

View File

@ -22,104 +22,86 @@ moneychanger.update_fields = function(pos, listname, index, stack, take)
local stack_src = inv:get_stack("source", 1)
local stack_src_name = stack_src:get_name()
local stack_real_count = 0
local canMove = false
if(take) then
if take then
stack_real_count = stack_inv:get_count() - stack:get_count()
else
if(stack_inv:get_name() ~= "") then
if stack_inv:get_name() ~= "" then
stack_real_count = stack_inv:get_count() + stack:get_count()
else
stack_real_count = stack:get_count()
end
end
if(listname == "source" and (stack_rest:get_count() == 0 or take)) then
if listname == "rest" then
return stack:get_count()
end
if listname == "source" and (stack_rest:get_count() == 0 or take) then
inv:set_list("output", { "", "" })
if(stack_real_count > 0) then
if(stack_name == "bitchange:minecoinblock") then
if stack_real_count > 0 then
if stack_name == "bitchange:minecoinblock" then
inv:set_list("output", { "bitchange:minecoin "..(stack_real_count*9), "" })
elseif(stack_name == "bitchange:minecoin") then
elseif stack_name == "bitchange:minecoin" then
inv:set_list("output", { "bitchange:mineninth "..math.min(stack_real_count*9, 30000), "bitchange:minecoinblock "..math.floor(stack_real_count/9) })
else
inv:set_list("output", { "bitchange:minecoin "..math.min(math.floor(stack_real_count/9), 30000), "" })
end
canMove = true
elseif(stack_real_count == 0 and stack_src:get_count() > 0) then
canMove = true
return stack:get_count()
elseif stack_real_count == 0 and stack_src:get_count() > 0 then
return stack:get_count()
end
elseif(listname == "output" and stack_rest:get_count() == 0) then
if(stack_src:get_count() < 1) then
if(stack:get_count() > 0) then
canMove = true
elseif listname == "output" and stack_rest:get_count() == 0 then
if stack_src:get_count() < 1 then
if stack:get_count() > 0 then
return stack:get_count()
end
inv:set_list("source", { "" })
else
if(stack_src_name ~= "") then
if(stack_name == "bitchange:minecoinblock" and stack_src_name == "bitchange:minecoin") then
if stack_src_name ~= "" then
if stack_name == "bitchange:minecoinblock" and stack_src_name == "bitchange:minecoin" then
local amount_left = (stack_src:get_count() - (stack:get_count()*9))
if(amount_left > 0) then
if amount_left > 0 then
inv:set_list("source", { stack_src_name.." "..amount_left })
else
inv:set_list("source", { "" })
end
if(index == 1) then
if index == 1 then
inv:set_stack("output", 2, "")
else
inv:set_stack("output", 1, "")
end
canMove = true
elseif(stack_name == "bitchange:minecoin" and stack_src_name == "bitchange:mineninth") then
return stack:get_count()
elseif stack_name == "bitchange:minecoin" and stack_src_name == "bitchange:mineninth" then
local amount_left = (stack_src:get_count() - (stack:get_count()*9))
if(amount_left > 0) then
if amount_left > 0 then
inv:set_list("source", { stack_src_name.." "..amount_left })
else
inv:set_list("source", { "" })
end
canMove = true
elseif(stack_name == "bitchange:minecoin" and stack_src_name == "bitchange:minecoinblock") then
return stack:get_count()
elseif (stack_name == "bitchange:minecoin" and stack_src_name == "bitchange:minecoinblock") or
(stack_name == "bitchange:mineninth" and stack_src_name == "bitchange:minecoin") then
local amount_left = stack_src:get_count() - (stack:get_count()/9)
local rest_count = (amount_left - math.floor(amount_left))*9
if(amount_left > -1) then
if amount_left > -1 then
inv:set_list("source", { stack_src_name.." "..math.floor(amount_left) })
if(rest_count > 0) then
if rest_count > 0 then
inv:set_list("rest", { stack_name.." "..rest_count })
else
inv:set_list("rest", { "" })
end
if(index == 1) then
if index == 1 then
inv:set_stack("output", 2, "")
else
inv:set_stack("output", 1, "")
end
inv:set_stack("output", index, stack_name.." "..stack:get_count())
canMove = true
end
elseif(stack_name == "bitchange:mineninth" and stack_src_name == "bitchange:minecoin") then
local amount_left = stack_src:get_count() - (stack:get_count()/9)
local rest_count = (amount_left - math.floor(amount_left))*9
if(amount_left > -1) then
inv:set_list("source", { stack_src_name.." "..math.floor(amount_left) })
if(rest_count > 0) then
inv:set_list("rest", { stack_name.." "..rest_count })
else
inv:set_list("rest", { "" })
end
if(index == 1) then
inv:set_stack("output", 2, "")
else
inv:set_stack("output", 1, "")
end
inv:set_stack("output", index, stack_name.." "..stack:get_count())
canMove = true
return stack:get_count()
end
end
end
end
elseif(listname == "rest") then
canMove = true
end
if(canMove) then
return stack:get_count()
end
return 0
end
@ -150,17 +132,19 @@ minetest.register_node("bitchange:moneychanger", {
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if(not bitchange_has_access(meta:get_string("owner"), player:get_player_name())) then
if not bitchange.has_access(meta:get_string("owner"), player:get_player_name()) then
return 0
end
if(listname == "source") then
if listname == "source" then
local stack_name = stack:get_name()
local inv = meta:get_inventory()
local inv_stack = inv:get_stack(listname, index)
if(inv_stack:get_name() ~= "") then
if inv_stack:get_name() ~= "" then
return 0
end
if(stack_name == "bitchange:mineninth" or stack_name == "bitchange:minecoin" or stack_name == "bitchange:minecoinblock") then
if stack_name == "bitchange:mineninth" or
stack_name == "bitchange:minecoin" or
stack_name == "bitchange:minecoinblock") then
return moneychanger.update_fields(pos, listname, index, stack, false)
end
end
@ -168,7 +152,7 @@ minetest.register_node("bitchange:moneychanger", {
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if(bitchange_has_access(meta:get_string("owner"), player:get_player_name())) then
if bitchange.has_access(meta:get_string("owner"), player:get_player_name()) then
return moneychanger.update_fields(pos, listname, index, stack, true)
end
return 0
@ -176,7 +160,7 @@ minetest.register_node("bitchange:moneychanger", {
can_dig = function(pos, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if(bitchange_has_access(meta:get_string("owner"), player:get_player_name())) then
if bitchange.has_access(meta:get_string("owner"), player:get_player_name()) then
return inv:is_empty("source") and inv:is_empty("output") and inv:is_empty("rest")
end
return 0

View File

@ -1,7 +1,7 @@
--Created by Krock
--License: WTFPL
if bitchange_use_moreores_tin and minetest.get_modpath("moreores") then
if bitchange.use_moreores_tin and minetest.get_modpath("moreores") then
minetest.register_craft({
output = "bitchange:coinbase 18",
recipe = {
@ -12,7 +12,7 @@ if bitchange_use_moreores_tin and minetest.get_modpath("moreores") then
})
end
if bitchange_use_technic_zinc and minetest.get_modpath("technic_worldgen") then
if bitchange.use_technic_zinc and minetest.get_modpath("technic_worldgen") then
minetest.register_craft({
output = "bitchange:coinbase 8",
recipe = {
@ -23,7 +23,7 @@ if bitchange_use_technic_zinc and minetest.get_modpath("technic_worldgen") then
})
end
if bitchange_use_quartz and minetest.get_modpath("quartz") then
if bitchange.use_quartz and minetest.get_modpath("quartz") then
minetest.register_craft({
output = "bitchange:coinbase",
recipe = {

View File

@ -50,7 +50,7 @@ local function get_exchange_shop_formspec(number,pos,title)
end
local function get_exchange_shop_tube_config(mode)
if bitchange_exchangeshop_pipeworks then
if bitchange.exchangeshop_pipeworks then
if mode == 1 then
return {choppy=2, oddly_breakable_by_hand=2, tubedevice=1, tubedevice_receiver=1}
else
@ -231,7 +231,7 @@ minetest.register_on_player_receive_fields(function(sender, formname, fields)
if err_msg ~= "" then
minetest.chat_send_player(player_name, "Exchange shop: "..err_msg)
end
elseif bitchange_has_access(shop_owner, player_name) then
elseif bitchange.has_access(shop_owner, player_name) then
local num = 0
if fields.vcustm then
num = 2
@ -301,12 +301,12 @@ minetest.register_node("bitchange:shop", {
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
if bitchange_has_access(meta:get_string("owner"), player:get_player_name()) then
if bitchange.has_access(meta:get_string("owner"), player:get_player_name()) then
return count
end
return 0
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if player:get_player_name() == ":pipeworks" then
return stack:get_count()
end
@ -315,18 +315,18 @@ minetest.register_node("bitchange:shop", {
return 0
end
local meta = minetest.get_meta(pos)
if bitchange_has_access(meta:get_string("owner"), player:get_player_name()) and
if bitchange.has_access(meta:get_string("owner"), player:get_player_name()) and
listname ~= "cust_ej" and listname ~= "custm_ej" then
return stack:get_count()
end
return 0
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if player:get_player_name() == ":pipeworks" then
return stack:get_count()
end
local meta = minetest.get_meta(pos)
if bitchange_has_access(meta:get_string("owner"), player:get_player_name()) or listname == "cust_ej" then
if bitchange.has_access(meta:get_string("owner"), player:get_player_name()) or listname == "cust_ej" then
return stack:get_count()
end
return 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 988 B

After

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 619 B

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1003 B

After

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 404 B

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1006 B

After

Width:  |  Height:  |  Size: 745 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 B

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 928 B

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 903 B

After

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 957 B

After

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -2,20 +2,20 @@
--License: WTFPL
local function set_infotext(meta, mode)
if(mode == meta:get_int("state")) then
if mode == meta:get_int("state") then
return
end
local owner = meta:get_string("owner")
local text = "Tool Repair "
local text2 = "[Inactive]"
if(mode == 0) then
if mode == 0 then
text = text.."(constructing)"
elseif(mode == 1) then
elseif mode == 1 then
text2 = "Inactive"
elseif(mode == 2) then
elseif mode == 2 then
text2 = "Active"
end
if(mode ~= 0) then
if mode ~= 0 then
text = text.."["..text2.."] (owned by "..owner..")"
end
@ -59,19 +59,19 @@ minetest.register_node("bitchange:toolrepair", {
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if(player:get_player_name() ~= meta:get_string("owner")) then
if player:get_player_name() ~= meta:get_string("owner") then
return 0
end
if(listname == "src") then
if listname == "src" then
if(stack:get_wear() > 0
and stack:get_wear() < 65535
and stack:get_name() ~= "technic:water_can"
and stack:get_name() ~= "technic:lava_can") then
return 1
end
elseif(listname == "fuel") then
if(stack:get_name() == "bitchange:mineninth") then
elseif listname == "fuel" then
if stack:get_name() == "bitchange:mineninth" then
return stack:get_count()
end
end
@ -79,7 +79,7 @@ minetest.register_node("bitchange:toolrepair", {
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if(bitchange_has_access(meta:get_string("owner"), player:get_player_name())) then
if bitchange.has_access(meta:get_string("owner"), player:get_player_name()) then
return stack:get_count()
end
return 0
@ -87,7 +87,7 @@ minetest.register_node("bitchange:toolrepair", {
can_dig = function(pos, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if(bitchange_has_access(meta:get_string("owner"), player:get_player_name())) then
if bitchange.has_access(meta:get_string("owner"), player:get_player_name()) then
return inv:is_empty("src") and inv:is_empty("fuel")
end
return 0
@ -95,11 +95,11 @@ minetest.register_node("bitchange:toolrepair", {
})
minetest.register_craft({
output = 'bitchange:toolrepair',
output = "bitchange:toolrepair",
recipe = {
{'default:steel_ingot', 'default:stick', 'default:steel_ingot'},
{'default:jungletree', 'default:mese_crystal', 'default:jungletree'},
{'default:jungletree', 'bitchange:minecoinblock', 'default:jungletree'}
{"default:steel_ingot", "default:stick", "default:steel_ingot"},
{"default:jungletree", "default:mese_crystal", "default:jungletree"},
{"default:jungletree", "bitchange:minecoinblock", "default:jungletree"}
}
})

View File

@ -3,7 +3,7 @@
--License: WTFPL
function get_warehouse_tube_config(mode)
if(bitchange_warehouse_pipeworks) then
if(bitchange.warehouse_pipeworks) then
if(mode == 1) then
return {cracky=1, level=2, tubedevice=1, tubedevice_receiver=1}
else
@ -11,22 +11,22 @@ function get_warehouse_tube_config(mode)
insert_object = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if(inv:room_for_item("main",stack)) then
return inv:add_item("main",stack)
if inv:room_for_item("main", stack) then
return inv:add_item("main", stack)
else
return inv:add_item("main2",stack)
return inv:add_item("main2", stack)
end
end,
can_insert = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if(inv:room_for_item("main",stack)) then
if inv:room_for_item("main", stack) then
return true
else
return inv:room_for_item("main2",stack)
return inv:room_for_item("main2", stack)
end
end,
input_inventory="main",
input_inventory = "main",
connect_sides = {left=1, right=1, back=1, top=1, bottom=1}
}
end
@ -90,31 +90,31 @@ minetest.register_node("bitchange:warehouse", {
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
if(not bitchange_has_access(meta:get_string("owner"), player:get_player_name())) then
if not bitchange.has_access(meta:get_string("owner"), player:get_player_name()) then
return 0
end
return count
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if(not bitchange_has_access(meta:get_string("owner"), player:get_player_name())) then
if not bitchange.has_access(meta:get_string("owner"), player:get_player_name()) then
return 0
end
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if(not bitchange_has_access(meta:get_string("owner"), player:get_player_name())) then
if not bitchange.has_access(meta:get_string("owner"), player:get_player_name()) then
return 0
end
return stack:get_count()
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
if(not bitchange_has_access(meta:get_string("owner"), sender:get_player_name())) then
if not bitchange.has_access(meta:get_string("owner"), sender:get_player_name()) then
return
end
if(fields.inv_lv1) then
if fields.inv_lv1 then
meta:set_string("formspec", "size[12,10;]"..
"label[0,0;Warehouse]"..
"label[2,0;Layer:]"..
@ -124,7 +124,7 @@ minetest.register_node("bitchange:warehouse", {
"list[current_name;main;0,1;12,4;]"..
"list[current_player;main;2,6;8,4;]")
end
if(fields.inv_lv2) then
if fields.inv_lv2 then
meta:set_string("formspec", "size[12,10;]"..
"label[0,0;Warehouse]"..
"label[2,0;Layer:]"..
@ -138,10 +138,10 @@ minetest.register_node("bitchange:warehouse", {
})
minetest.register_craft({
output = 'bitchange:warehouse',
output = "bitchange:warehouse",
recipe = {
{'default:chest_locked', 'bitchange:minecoinblock', 'default:chest_locked'},
{'default:chest_locked', 'default:mese', 'default:chest_locked'},
{'default:chest_locked', 'default:chest_locked', 'default:chest_locked'}
{"default:chest_locked", "bitchange:minecoinblock", "default:chest_locked"},
{"default:chest_locked", "default:mese", "default:chest_locked"},
{"default:chest_locked", "default:chest_locked", "default:chest_locked"}
}
})