diff --git a/README.txt b/README.txt index ecf5a4a..f48c058 100644 --- a/README.txt +++ b/README.txt @@ -1,12 +1,11 @@ -Bitchange +BitChange ========= This mod adds the currency "MineCoin" to your Minetest world. To change a setting, edit the file 'bitchange_config.txt' in your world directory. Copy and paste 'config.default.txt' if the file does not exist yet. -License: WTFPL (for code and textures) -Adds privilege: bitchange +License: CC0 (for everything) Dependencies: default diff --git a/bank.lua b/bank.lua index fa44e7a..c002b7b 100644 --- a/bank.lua +++ b/bank.lua @@ -52,7 +52,7 @@ minetest.register_node("bitchange:bank", { "bitchange_bank_side.png", "bitchange_bank_side.png", "bitchange_bank_side.png", "bitchange_bank_front.png"}, paramtype2 = "facedir", - groups = {cracky=1,level=1}, + groups = {cracky=1, level=1, not_in_creative_inventory=1}, sounds = default.node_sound_stone_defaults(), after_place_node = function(pos, placer) local meta = minetest.get_meta(pos) @@ -99,7 +99,7 @@ minetest.register_node("bitchange:bank", { end return 0 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 bitchange.has_access(meta:get_string("owner"), player:get_player_name()) then return stack:get_count() diff --git a/config.default.txt b/config.default.txt index b0c6538..96d5367 100644 --- a/config.default.txt +++ b/config.default.txt @@ -1,7 +1,7 @@ -- General configuration - BitChange --- Created by Krock +-- Do NOT change your settings in "config.default.txt" -bitchange.initial_give = 2 +bitchange.initial_give = 10 -- Enable/Disable whole nodes bitchange.enable_exchangeshop = true bitchange.enable_moneychanger = true @@ -28,4 +28,4 @@ bitchange.warehouse_pipeworks = false -- Advanced generation settings -- Change in 'minecoins.lua', starting at line 101 -bitchange.enable_generation = true \ No newline at end of file +bitchange.enable_generation = false \ No newline at end of file diff --git a/init.lua b/init.lua index f9fa96a..63e21fc 100644 --- a/init.lua +++ b/init.lua @@ -1,12 +1,7 @@ ---Created by Krock for the BitChange mod bitchange = {} bitchange.mod_path = minetest.get_modpath("bitchange") local world_path = minetest.get_worldpath() -if rawget(_G, "freeminer") then - minetest = freeminer -end - dofile(bitchange.mod_path.."/config.default.txt") -- Copied from moretrees mod if not io.open(world_path.."/bitchange_config.txt", "r") then @@ -54,7 +49,7 @@ if bitchange.enable_bank then dofile(bitchange.mod_path.."/bank.lua") bitchange.bank.file_path = world_path.."/bitchange_bank_"..loaded_bank dofile(bitchange.mod_path.."/bank_"..loaded_bank..".lua") - print("[BitChange] Bank loaded: "..loaded_bank) + minetest.log("action", "[BitChange] Bank loaded: "..loaded_bank) end end @@ -66,13 +61,12 @@ if not minetest.setting_getbool("creative_mode") and bitchange.initial_give > 0 end -- Privs -minetest.register_privilege("bitchange", "Can access to owned nodes of the bitchange mod") function bitchange.has_access(owner, player_name) if player_name == owner or owner == "" then return true end local privs = minetest.get_player_privs(player_name) - return privs.server or privs.bitchange + return privs.server or privs.protection_bypass end -print("[BitChange] Loaded.") +minetest.log("action", "[BitChange] Loaded.") diff --git a/minecoins.lua b/minecoins.lua index 104a717..40e80aa 100644 --- a/minecoins.lua +++ b/minecoins.lua @@ -1,13 +1,9 @@ ---bitcoins by MilesDyson@DistroGeeks.com ---Modified by Krock ---License: WTFPL - -- Node definitions minetest.register_node("bitchange:minecoin_in_ground", { - description = "MineCoin Ore", + description = "you hacker!", tiles = { "default_stone.png^bitchange_minecoin_in_ground.png" }, is_ground_content = true, - groups = {cracky=2}, + groups = {cracky=2, not_in_creative_inventory=1}, sounds = default.node_sound_stone_defaults(), drop = { max_items = 2, @@ -19,17 +15,16 @@ minetest.register_node("bitchange:minecoin_in_ground", { }) minetest.register_node("bitchange:mineninth_in_ground", { - description = "MineNinth Ore", + description = "you hacker!", tiles = { "default_stone.png^bitchange_mineninth_in_ground.png" }, is_ground_content = true, - groups = {cracky=3}, + groups = {cracky=3, not_in_creative_inventory=1}, sounds = default.node_sound_stone_defaults(), drop = { max_items = 3, items = { - {items = {"bitchange:coinbase"}, rarity = 5 }, - {items = {"bitchange:coinbase 2"}, rarity = 3 }, - {items = {"bitchange:coinbase 6"} } + {items = {"bitchange:mineninth 4"}, rarity = 3 }, + {items = {"bitchange:mineninth 6"} } } }, }) @@ -37,7 +32,6 @@ minetest.register_node("bitchange:mineninth_in_ground", { minetest.register_node("bitchange:minecoinblock", { description = "MineCoin Block", tiles = { "bitchange_minecoinblock.png" }, - is_ground_content = true, groups = {cracky=2}, sounds = default.node_sound_stone_defaults(), stack_max = 30000, @@ -55,10 +49,7 @@ minetest.register_craftitem("bitchange:mineninth", { stack_max = 30000, }) -minetest.register_craftitem("bitchange:coinbase", { - description = "Coin base", - inventory_image = "bitchange_coinbase.png", -}) +minetest.register_alias("bitchange:coinbase", "bitchange:mineninth") -- Crafting minetest.register_craft({ @@ -94,12 +85,6 @@ minetest.register_craft({ }) -- Cooking -minetest.register_craft({ - type = "cooking", - recipe = "bitchange:coinbase", - output = "bitchange:mineninth", -}) - minetest.register_craft({ type = "cooking", recipe = "default:goldblock", diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..27fb0b9 --- /dev/null +++ b/mod.conf @@ -0,0 +1 @@ +name = bitchange \ No newline at end of file diff --git a/moreores.lua b/moreores.lua index 95ddd51..98bd0f9 100644 --- a/moreores.lua +++ b/moreores.lua @@ -1,9 +1,8 @@ ---Created by Krock ---License: WTFPL +-- Conversion of other ores to money if bitchange.use_moreores_tin and minetest.get_modpath("moreores") then minetest.register_craft({ - output = "bitchange:coinbase 18", + output = "bitchange:mineninth 18", recipe = { {"moreores:tin_block", "default:pick_diamond"}, {"moreores:tin_block", ""} @@ -14,7 +13,7 @@ end if bitchange.use_technic_zinc and minetest.get_modpath("technic_worldgen") then minetest.register_craft({ - output = "bitchange:coinbase 8", + output = "bitchange:mineninth 8", recipe = { {"technic:zinc_block", "default:pick_diamond"}, {"technic:zinc_block", ""} @@ -25,7 +24,7 @@ end if bitchange.use_quartz and minetest.get_modpath("quartz") then minetest.register_craft({ - output = "bitchange:coinbase", + output = "bitchange:mineninth", recipe = { {"quartz:quartz_crystal", "default:pick_diamond"}, {"quartz:quartz_crystal", "quartz:quartz_crystal"}, diff --git a/shop.lua b/shop.lua index 6bfb04e..817662d 100644 --- a/shop.lua +++ b/shop.lua @@ -16,8 +16,11 @@ if not bitchange then bitchange.exchangeshop_pipeworks = true function bitchange.has_access(owner, player_name) - return (player_name == owner or owner == "" - or minetest.get_player_privs(player_name).server) + if player_name == owner or owner == "" then + return true + end + local privs = minetest.get_player_privs(player_name) + return privs.server or privs.protection_bypass end end @@ -197,6 +200,8 @@ minetest.register_on_player_receive_fields(function(sender, formname, fields) end if fields.title then + -- Limit title length + fields.title = fields.title:sub(1, 80) if title ~= fields.title then if fields.title ~= "" then meta:set_string("infotext", "'" .. fields.title diff --git a/textures/bitchange_coinbase.png b/textures/bitchange_coinbase.png deleted file mode 100644 index f25c788..0000000 Binary files a/textures/bitchange_coinbase.png and /dev/null differ diff --git a/textures/bitchange_shop_front.png b/textures/bitchange_shop_front.png index f10b437..9401c9a 100644 Binary files a/textures/bitchange_shop_front.png and b/textures/bitchange_shop_front.png differ diff --git a/textures/bitchange_shop_side.png b/textures/bitchange_shop_side.png index eb2a129..63a35f6 100644 Binary files a/textures/bitchange_shop_side.png and b/textures/bitchange_shop_side.png differ diff --git a/textures/bitchange_shop_top.png b/textures/bitchange_shop_top.png index f8c442a..4a64334 100644 Binary files a/textures/bitchange_shop_top.png and b/textures/bitchange_shop_top.png differ diff --git a/textures/bitchange_toolrepair_side.png b/textures/bitchange_toolrepair_side.png index 6860eec..bf25ca0 100644 Binary files a/textures/bitchange_toolrepair_side.png and b/textures/bitchange_toolrepair_side.png differ