mirror of
https://github.com/SmallJoker/bitchange.git
synced 2024-11-14 23:00:18 +01:00
Donation box, a better saving, serval updates
This commit is contained in:
parent
f846f5624c
commit
eec023f449
|
@ -3,7 +3,7 @@
|
|||
--License: WTFPL
|
||||
|
||||
local file_path = minetest.get_worldpath() .. "/bitchange_bank_currency"
|
||||
local exchange_worth = 12 -- default worth in "money" for 10 MineCoins, change if not okay
|
||||
local exchange_worth = 8 -- default worth in "money" for 10 MineCoins, change if not okay
|
||||
local bank = {}
|
||||
local changes_made = false
|
||||
|
||||
|
@ -60,7 +60,7 @@ local function get_bank_formspec(number, pos)
|
|||
-- owner
|
||||
formspec = ("size[8,9;]"..
|
||||
"label[0,0;Bank]"..
|
||||
"label[1,0.5;Current MineCoin and MineGelt reserve: (Editable by owner)]"..
|
||||
"label[1,0.5;Current MineCoin and MineGeld reserve: (Editable by owner)]"..
|
||||
"list["..name..";coins;0,1;8,3;]"..
|
||||
"list[current_player;main;0,5;8,4;]")
|
||||
end
|
||||
|
|
|
@ -7,6 +7,7 @@ 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
|
||||
|
|
78
donationbox.lua
Normal file
78
donationbox.lua
Normal file
|
@ -0,0 +1,78 @@
|
|||
--Created by Krock for the BitChange mod
|
||||
--License: WTFPL
|
||||
|
||||
minetest.register_node("bitchange:donationbox", {
|
||||
description = "Donation box",
|
||||
tiles = {"default_wood.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy=2, oddly_breakable_by_hand=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.25,-0.5,-0.4375,0.25,-0.375,0.425}, --NodeBox1
|
||||
{0.25,-0.5,-0.4375,0.425,0.25,0.425}, --NodeBox2
|
||||
{-0.4375,-0.5,-0.4375,-0.25,0.25,0.425}, --NodeBox3
|
||||
{-0.3125,-0.5,-0.4375,0.25,0.0625,-0.25}, --NodeBox4
|
||||
{-0.25,-0.5,0.25,0.25,0.25,0.425}, --NodeBox5
|
||||
{-0.5,0.25,-0.5,0.5,0.375,0.5}, --NodeBox6
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.4,-0.5,-0.4,0.4,0.35,0.4},
|
||||
},
|
||||
},
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Donation box (constructing)")
|
||||
meta:set_string("owner", "")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 4*2)
|
||||
end,
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local owner = placer:get_player_name()
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", "size[8,8;]"..
|
||||
"label[2,0;Donation box (owned by "..owner..")]"..
|
||||
"list[current_name;main;2,1;4,2;]"..
|
||||
"list[current_player;main;0,4;8,4;]")
|
||||
meta:set_string("infotext", "Donation box (owned by "..owner..")")
|
||||
meta:set_string("owner", owner)
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
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
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
return 0
|
||||
end,
|
||||
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)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if(not bitchange_has_access(meta:get_string("owner"), player:get_player_name())) then
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'bitchange:donationbox',
|
||||
recipe = {
|
||||
{'default:wood', '', 'default:wood'},
|
||||
{'default:wood', 'bitchange:minecoin', 'default:wood'},
|
||||
{'default:wood', 'default:wood', 'default:wood'}
|
||||
}
|
||||
})
|
5
init.lua
5
init.lua
|
@ -40,6 +40,9 @@ end
|
|||
if(bitchange_enable_toolrepair) then
|
||||
dofile(mod_path.."/toolrepair.lua")
|
||||
end
|
||||
if(bitchange_enable_donationbox) then
|
||||
dofile(mod_path.."/donationbox.lua")
|
||||
end
|
||||
if(bitchange_enable_bank) then
|
||||
local loaded_bank = ""
|
||||
if(minetest.get_modpath("money") ~= nil) then
|
||||
|
@ -67,7 +70,7 @@ end
|
|||
-- Privs
|
||||
minetest.register_privilege("bitchange", "Can access to owned nodes of the bitchange mod")
|
||||
function bitchange_has_access(owner, player_name)
|
||||
return (player_name == 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
|
||||
|
||||
print("[BitChange] Loaded.")
|
||||
|
|
|
@ -9,7 +9,13 @@ minetest.register_node("bitchange:minecoin_in_ground", {
|
|||
is_ground_content = true,
|
||||
groups = {cracky=2},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drop = 'bitchange:minecoin',
|
||||
drop = {
|
||||
max_items = 2,
|
||||
items = {
|
||||
{items = {"bitchange:minecoin"}, rarity = 2 },
|
||||
{items = {"bitchange:minecoin 3"} }
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("bitchange:mineninth_in_ground", {
|
||||
|
@ -18,7 +24,14 @@ minetest.register_node("bitchange:mineninth_in_ground", {
|
|||
is_ground_content = true,
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drop = 'bitchange:coinbase',
|
||||
drop = {
|
||||
max_items = 3,
|
||||
items = {
|
||||
{items = {"bitchange:coinbase"}, rarity = 5 },
|
||||
{items = {"bitchange:coinbase 2"}, rarity = 3 },
|
||||
{items = {"bitchange:coinbase 6"} }
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("bitchange:minecoinblock", {
|
||||
|
|
|
@ -155,6 +155,11 @@ minetest.register_node("bitchange:moneychanger", {
|
|||
end
|
||||
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
|
||||
return 0
|
||||
end
|
||||
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
|
||||
|
|
3
shop.lua
3
shop.lua
|
@ -90,6 +90,9 @@ minetest.register_on_player_receive_fields(function(sender, formname, fields)
|
|||
local meta = minetest.get_meta(pos)
|
||||
local title = meta:get_string("title") or ""
|
||||
local shop_owner = meta:get_string("owner")
|
||||
if(fields.quit) then
|
||||
exchange_shop[player_name] = nil
|
||||
end
|
||||
|
||||
if(fields.exchange) then
|
||||
local player_inv = sender:get_inventory()
|
||||
|
|
|
@ -24,7 +24,7 @@ local function set_infotext(meta, mode)
|
|||
|
||||
local formspec =
|
||||
"size[8,9]"..
|
||||
"label[1,1;Damaged tool:]]"..
|
||||
"label[1,1;Damaged tool:]"..
|
||||
"list[current_name;src;3.5,1;1,1;]"..
|
||||
"label[3.4,2;\\["..text2.."\\]]"..
|
||||
"label[1.5,3;MineNinth:]]"..
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
======>- Version 1.7.0 -<======
|
||||
- donation box
|
||||
- more money in money-ores
|
||||
- possible cheating fixes
|
||||
|
||||
======>- Version 1.6.9 -<======
|
||||
- optional quartz converting support
|
||||
- some other little changes (also in the configuration)
|
||||
|
|
Loading…
Reference in New Issue
Block a user