Allow to change currency

master
Wuzzy 2016-09-03 17:31:11 +02:00
parent 5ecea640bd
commit bf214f6b71
2 changed files with 13 additions and 2 deletions

View File

@ -20,7 +20,13 @@
-- TODO: Improve mod compability
local slots_max = 31
local currency = "default:gold_ingot"
-- Set item which is used as payment for vending and depositing machines
local currency = minetest.setting_get("easyvend_currency")
if currency == nil or minetest.registered_items[currency] == nil then
currency = "default:gold_ingot"
end
local currency_desc = minetest.registered_items[currency].description
local registered_chests = {}
local cost_stack_max = ItemStack(currency):get_stack_max()
@ -146,7 +152,7 @@ easyvend.set_formspec = function(pos, player)
local wear = "false"
if meta:get_int("wear") == 1 then wear = "true" end
formspec = formspec
.."list[current_name;gold;0,1.65;1,1;]"
.."item_image_button[0,1.65;1,1;"..currency..";currency_image;]"
.."list[current_name;item;0,0.35;1,1;]"
.."listring[current_player;main]"
.."listring[current_name;item]"

5
settingtypes.txt Normal file
View File

@ -0,0 +1,5 @@
# Specify the item (as an itemstring) which is used as currency for vending
# and depositing machines. Vending machines take this item as payment and
# depositing machines give this item in return for items.
# Default: Gold Ingot.
easyvend_currency (Currency item for vending and depositing machines) string default:gold_ingot