1
0
mirror of https://github.com/SmallJoker/bitchange.git synced 2024-12-25 18:30:18 +01:00

💥 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, end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos) 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 return count
end end
return 0 return 0
end, 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) 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() return stack:get_count()
end end
return 0 return 0
end, 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) 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() return stack:get_count()
end end
return 0 return 0

View File

@ -1,30 +1,31 @@
-- General configuration - BitChange -- General configuration - BitChange
-- Created by Krock -- Created by Krock
bitchange_initial_give = 2 bitchange.initial_give = 2
-- Enable/Disable whole nodes -- Enable/Disable whole nodes
bitchange_enable_exchangeshop = true bitchange.enable_exchangeshop = true
bitchange_enable_moneychanger = true bitchange.enable_moneychanger = true
bitchange_enable_warehouse = false bitchange.enable_warehouse = false
bitchange_enable_toolrepair = true bitchange.enable_toolrepair = true
bitchange_enable_donationbox = true bitchange.enable_donationbox = true
-- Set this variable to false if you have a supported currency enabled -- Set this variable to false if you have a supported currency enabled
-- and if you want to disable the exchanging/converting point - the bank -- and if you want to disable the exchanging/converting point - the bank
-- Supported: money (by kotolegokot), money2 (by Bad Command), currency (by Dan Duncombe) -- 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 -- Converting other ores to MineCoins
-- Tin moreores -- Tin moreores
-- Zinc technic_worldgen -- Zinc technic_worldgen
-- Quartz quartz -- Quartz quartz
bitchange_use_moreores_tin = false bitchange.use_moreores_tin = false
bitchange_use_technic_zinc = false bitchange.use_technic_zinc = false
bitchange_use_quartz = false bitchange.use_quartz = false
-- Pipeworks support -- Pipeworks support
bitchange_exchangeshop_pipeworks = false bitchange.exchangeshop_pipeworks = false
bitchange_warehouse_pipeworks = false bitchange.warehouse_pipeworks = false
-- Advanced generation settings -- Advanced generation settings
-- Change in 'minecoins.lua', starting at line 101 -- 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() local inv = meta:get_inventory()
if not inv:is_empty("main") then if not inv:is_empty("main") then
return false 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 return true
end end
return false return false
@ -59,9 +59,9 @@ minetest.register_node("bitchange:donationbox", {
allow_metadata_inventory_put = function(pos, listname, index, stack, player) allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return stack:get_count() return stack:get_count()
end, 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) 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 return 0
end end
return stack:get_count() return stack:get_count()
@ -69,10 +69,10 @@ minetest.register_node("bitchange:donationbox", {
}) })
minetest.register_craft({ minetest.register_craft({
output = 'bitchange:donationbox', output = "bitchange:donationbox",
recipe = { recipe = {
{'default:wood', '', 'default:wood'}, {"default:wood", "", "default:wood"},
{'default:wood', 'bitchange:minecoin', 'default:wood'}, {"default:wood", "bitchange:minecoin", "default:wood"},
{'default:wood', 'default:wood', 'default:wood'} {"default:wood", "default:wood", "default:wood"}
} }
}) })

View File

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

View File

@ -40,19 +40,19 @@ minetest.register_node("bitchange:minecoinblock", {
is_ground_content = true, is_ground_content = true,
groups = {cracky=2}, groups = {cracky=2},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
stack_max = 30000, stack_max = 30000,
}) })
minetest.register_craftitem("bitchange:minecoin", { minetest.register_craftitem("bitchange:minecoin", {
description = "MineCoin", description = "MineCoin",
inventory_image = "bitchange_minecoin.png", inventory_image = "bitchange_minecoin.png",
stack_max = 30000, stack_max = 30000,
}) })
minetest.register_craftitem("bitchange:mineninth", { minetest.register_craftitem("bitchange:mineninth", {
description = "MineNinth", description = "MineNinth",
inventory_image = "bitchange_mineninth.png", inventory_image = "bitchange_mineninth.png",
stack_max = 30000, stack_max = 30000,
}) })
minetest.register_craftitem("bitchange:coinbase", { minetest.register_craftitem("bitchange:coinbase", {
@ -62,56 +62,58 @@ minetest.register_craftitem("bitchange:coinbase", {
-- Crafting -- Crafting
minetest.register_craft({ minetest.register_craft({
output = 'bitchange:minecoinblock', output = "bitchange:minecoinblock",
recipe = { 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({ minetest.register_craft({
output = 'bitchange:minecoin 9', output = "bitchange:minecoin 9",
recipe = { recipe = {
{'bitchange:minecoinblock'}, {"bitchange:minecoinblock"},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'bitchange:minecoin', output = "bitchange:minecoin",
recipe = { 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({ minetest.register_craft({
output = 'bitchange:mineninth 9', output = "bitchange:mineninth 9",
recipe = { recipe = {
{'bitchange:minecoin'}, {"bitchange:minecoin"},
} }
}) })
-- Cooking -- Cooking
minetest.register_craft({ minetest.register_craft({
type = 'cooking', type = "cooking",
recipe = "bitchange:coinbase", recipe = "bitchange:coinbase",
output = "bitchange:mineninth", output = "bitchange:mineninth",
}) })
minetest.register_craft({ minetest.register_craft({
type = 'cooking', type = "cooking",
recipe = "default:goldblock", recipe = "default:goldblock",
output = "bitchange:minecoinblock 2", output = "bitchange:minecoinblock 2",
}) })
minetest.register_craft({ minetest.register_craft({
type = 'cooking', type = "cooking",
recipe = "bitchange:minecoinblock", recipe = "bitchange:minecoinblock",
output = "default:gold_ingot 4", output = "default:gold_ingot 4",
}) })
-- Generation -- Generation
if bitchange.enable_generation then
minetest.register_ore({ minetest.register_ore({
ore_type = "scatter", ore_type = "scatter",
ore = "bitchange:minecoin_in_ground", ore = "bitchange:minecoin_in_ground",
@ -143,4 +145,5 @@ minetest.register_ore({
clust_size = 7, clust_size = 7,
height_max = 28000, height_max = 28000,
height_min = -255, 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 = inv:get_stack("source", 1)
local stack_src_name = stack_src:get_name() local stack_src_name = stack_src:get_name()
local stack_real_count = 0 local stack_real_count = 0
local canMove = false
if(take) then if take then
stack_real_count = stack_inv:get_count() - stack:get_count() stack_real_count = stack_inv:get_count() - stack:get_count()
else else
if(stack_inv:get_name() ~= "") then if stack_inv:get_name() ~= "" then
stack_real_count = stack_inv:get_count() + stack:get_count() stack_real_count = stack_inv:get_count() + stack:get_count()
else else
stack_real_count = stack:get_count() stack_real_count = stack:get_count()
end end
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", { "", "" }) inv:set_list("output", { "", "" })
if(stack_real_count > 0) then if stack_real_count > 0 then
if(stack_name == "bitchange:minecoinblock") then if stack_name == "bitchange:minecoinblock" then
inv:set_list("output", { "bitchange:minecoin "..(stack_real_count*9), "" }) 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) }) inv:set_list("output", { "bitchange:mineninth "..math.min(stack_real_count*9, 30000), "bitchange:minecoinblock "..math.floor(stack_real_count/9) })
else else
inv:set_list("output", { "bitchange:minecoin "..math.min(math.floor(stack_real_count/9), 30000), "" }) inv:set_list("output", { "bitchange:minecoin "..math.min(math.floor(stack_real_count/9), 30000), "" })
end end
canMove = true return stack:get_count()
elseif(stack_real_count == 0 and stack_src:get_count() > 0) then elseif stack_real_count == 0 and stack_src:get_count() > 0 then
canMove = true return stack:get_count()
end end
elseif(listname == "output" and stack_rest:get_count() == 0) then elseif listname == "output" and stack_rest:get_count() == 0 then
if(stack_src:get_count() < 1) then if stack_src:get_count() < 1 then
if(stack:get_count() > 0) then if stack:get_count() > 0 then
canMove = true return stack:get_count()
end end
inv:set_list("source", { "" }) inv:set_list("source", { "" })
else else
if(stack_src_name ~= "") then if stack_src_name ~= "" then
if(stack_name == "bitchange:minecoinblock" and stack_src_name == "bitchange:minecoin") then if stack_name == "bitchange:minecoinblock" and stack_src_name == "bitchange:minecoin" then
local amount_left = (stack_src:get_count() - (stack:get_count()*9)) 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 }) inv:set_list("source", { stack_src_name.." "..amount_left })
else else
inv:set_list("source", { "" }) inv:set_list("source", { "" })
end end
if(index == 1) then if index == 1 then
inv:set_stack("output", 2, "") inv:set_stack("output", 2, "")
else else
inv:set_stack("output", 1, "") inv:set_stack("output", 1, "")
end end
canMove = true return stack:get_count()
elseif(stack_name == "bitchange:minecoin" and stack_src_name == "bitchange:mineninth") then elseif stack_name == "bitchange:minecoin" and stack_src_name == "bitchange:mineninth" then
local amount_left = (stack_src:get_count() - (stack:get_count()*9)) 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 }) inv:set_list("source", { stack_src_name.." "..amount_left })
else else
inv:set_list("source", { "" }) inv:set_list("source", { "" })
end end
canMove = true return stack:get_count()
elseif(stack_name == "bitchange:minecoin" and stack_src_name == "bitchange:minecoinblock") then 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 amount_left = stack_src:get_count() - (stack:get_count()/9)
local rest_count = (amount_left - math.floor(amount_left))*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) }) 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 }) inv:set_list("rest", { stack_name.." "..rest_count })
else else
inv:set_list("rest", { "" }) inv:set_list("rest", { "" })
end end
if(index == 1) then if index == 1 then
inv:set_stack("output", 2, "") inv:set_stack("output", 2, "")
else else
inv:set_stack("output", 1, "") inv:set_stack("output", 1, "")
end end
inv:set_stack("output", index, stack_name.." "..stack:get_count()) inv:set_stack("output", index, stack_name.." "..stack:get_count())
canMove = true return stack:get_count()
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
end end
end end
end end
end end
elseif(listname == "rest") then
canMove = true
end
if(canMove) then
return stack:get_count()
end end
return 0 return 0
end end
@ -150,17 +132,19 @@ minetest.register_node("bitchange:moneychanger", {
end, 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) 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 return 0
end end
if(listname == "source") then if listname == "source" then
local stack_name = stack:get_name() local stack_name = stack:get_name()
local inv = meta:get_inventory() local inv = meta:get_inventory()
local inv_stack = inv:get_stack(listname, index) local inv_stack = inv:get_stack(listname, index)
if(inv_stack:get_name() ~= "") then if inv_stack:get_name() ~= "" then
return 0 return 0
end 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) return moneychanger.update_fields(pos, listname, index, stack, false)
end end
end end
@ -168,7 +152,7 @@ minetest.register_node("bitchange:moneychanger", {
end, 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) 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) return moneychanger.update_fields(pos, listname, index, stack, true)
end end
return 0 return 0
@ -176,7 +160,7 @@ minetest.register_node("bitchange:moneychanger", {
can_dig = function(pos, player) can_dig = function(pos, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() 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") return inv:is_empty("source") and inv:is_empty("output") and inv:is_empty("rest")
end end
return 0 return 0

View File

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

View File

@ -50,7 +50,7 @@ local function get_exchange_shop_formspec(number,pos,title)
end end
local function get_exchange_shop_tube_config(mode) local function get_exchange_shop_tube_config(mode)
if bitchange_exchangeshop_pipeworks then if bitchange.exchangeshop_pipeworks then
if mode == 1 then if mode == 1 then
return {choppy=2, oddly_breakable_by_hand=2, tubedevice=1, tubedevice_receiver=1} return {choppy=2, oddly_breakable_by_hand=2, tubedevice=1, tubedevice_receiver=1}
else else
@ -231,7 +231,7 @@ minetest.register_on_player_receive_fields(function(sender, formname, fields)
if err_msg ~= "" then if err_msg ~= "" then
minetest.chat_send_player(player_name, "Exchange shop: "..err_msg) minetest.chat_send_player(player_name, "Exchange shop: "..err_msg)
end end
elseif bitchange_has_access(shop_owner, player_name) then elseif bitchange.has_access(shop_owner, player_name) then
local num = 0 local num = 0
if fields.vcustm then if fields.vcustm then
num = 2 num = 2
@ -301,12 +301,12 @@ minetest.register_node("bitchange:shop", {
end, end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos) 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 return count
end end
return 0 return 0
end, 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 if player:get_player_name() == ":pipeworks" then
return stack:get_count() return stack:get_count()
end end
@ -315,18 +315,18 @@ minetest.register_node("bitchange:shop", {
return 0 return 0
end end
local meta = minetest.get_meta(pos) 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 listname ~= "cust_ej" and listname ~= "custm_ej" then
return stack:get_count() return stack:get_count()
end end
return 0 return 0
end, 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 if player:get_player_name() == ":pipeworks" then
return stack:get_count() return stack:get_count()
end end
local meta = minetest.get_meta(pos) 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() return stack:get_count()
end end
return 0 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 --License: WTFPL
local function set_infotext(meta, mode) local function set_infotext(meta, mode)
if(mode == meta:get_int("state")) then if mode == meta:get_int("state") then
return return
end end
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
local text = "Tool Repair " local text = "Tool Repair "
local text2 = "[Inactive]" local text2 = "[Inactive]"
if(mode == 0) then if mode == 0 then
text = text.."(constructing)" text = text.."(constructing)"
elseif(mode == 1) then elseif mode == 1 then
text2 = "Inactive" text2 = "Inactive"
elseif(mode == 2) then elseif mode == 2 then
text2 = "Active" text2 = "Active"
end end
if(mode ~= 0) then if mode ~= 0 then
text = text.."["..text2.."] (owned by "..owner..")" text = text.."["..text2.."] (owned by "..owner..")"
end end
@ -59,19 +59,19 @@ minetest.register_node("bitchange:toolrepair", {
end, 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) 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 return 0
end end
if(listname == "src") then if listname == "src" then
if(stack:get_wear() > 0 if(stack:get_wear() > 0
and stack:get_wear() < 65535 and stack:get_wear() < 65535
and stack:get_name() ~= "technic:water_can" and stack:get_name() ~= "technic:water_can"
and stack:get_name() ~= "technic:lava_can") then and stack:get_name() ~= "technic:lava_can") then
return 1 return 1
end end
elseif(listname == "fuel") then elseif listname == "fuel" then
if(stack:get_name() == "bitchange:mineninth") then if stack:get_name() == "bitchange:mineninth" then
return stack:get_count() return stack:get_count()
end end
end end
@ -79,7 +79,7 @@ minetest.register_node("bitchange:toolrepair", {
end, 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) 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() return stack:get_count()
end end
return 0 return 0
@ -87,7 +87,7 @@ minetest.register_node("bitchange:toolrepair", {
can_dig = function(pos, player) can_dig = function(pos, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() 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") return inv:is_empty("src") and inv:is_empty("fuel")
end end
return 0 return 0
@ -95,11 +95,11 @@ minetest.register_node("bitchange:toolrepair", {
}) })
minetest.register_craft({ minetest.register_craft({
output = 'bitchange:toolrepair', output = "bitchange:toolrepair",
recipe = { recipe = {
{'default:steel_ingot', 'default:stick', 'default:steel_ingot'}, {"default:steel_ingot", "default:stick", "default:steel_ingot"},
{'default:jungletree', 'default:mese_crystal', 'default:jungletree'}, {"default:jungletree", "default:mese_crystal", "default:jungletree"},
{'default:jungletree', 'bitchange:minecoinblock', 'default:jungletree'} {"default:jungletree", "bitchange:minecoinblock", "default:jungletree"}
} }
}) })

View File

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