Page 1 of 2

[Mod] Mint & Automatic Commerce Machines [mint]

PostPosted: Sun Dec 16, 2012 22:57
by aldobr
Mod
Mint & Automatic Commerce Machines

License
GPLv2

Version
1.25 Stable

Images
Some images were taken from http://www.iconarchive.com/

Sounds
All sounds were taken from http://www.freesound.org/

Dependencies
default

Minetest version
0.4.4 or later

Download
https://www.dropbox.com/s/rhvnh0yjzg3yx4o/mint.zip

Description
This mod adds coin minting to the game. Everyone can mint coins from gold ingots. The value of the money is guaranteed by the relative value of each node. Gold was choosen because of its relative rarity to other materials. There are three kinds of coins, Minetoon Pences, Shillings and Pounds. One Minetoon Pence is worth the value of 1/729 of a gold ingot. A Minetoon Shilling is worth the value of 1/81 of a gold ingot. While a Minetoon Pound is worth 1/9 of the value of a gold ingot. All values are convertible, you can make Shillings from Pounds, Shillings from Pences, and vice versa. Gold can be converted to Pounds and Pounds can be converted back to gold. This was done in order to avoid inflation.

The mod adds two new machines intended to work with said coins. The first one is an automatic selling machine, wich can sell items and receive minetoon money automatically. The other is an automatic buying machine, that can automatically pay money for items that the owner of the machine intends to buy. Those two machines can simplify the administration of a minetest shop, because they can work while the shop owner is offline.

The system is based on a full gold standard, where the value of everything is relative to gold. Coins being convertible back to gold allows removal of coins out of circulation. A gold stardard is well suited for a descentralized minting system, because coins dont lose their relative value over time.

Automatic Selling Machine operation
Shop owner should feed the machine with the item to be sold. The machine formspec is a default locket-chest invetory with the addition of a price field. Shop owner should set his price in that field and press enter to close the form. Any item inside the machine will be sold by this price. The price is shown on the info text of the machine. Usually only one kind of item should be stored in the machine, because the consumer can get confused about wich item will be sold next. The machine selects the next item to be sold by scanning the inventory from left to right, top to bottom. Coins are ignored in that process (you cant sell coins). To use the machine the player should punch it while having enought money in his inventory. The machine will automatically remove the price (in coins) from player inventory and add to its own inventory. The item sold is automatically stored into the player inventory, ending the transaction. If the player has not enough coins or the machine has no item to sell, or in the event any of both dont have enough storage space in their respective inventories, the machine will abort the transaction, sound a warning and show the error message at player inventory.

Automatic Buying Machine operation
This machine is quite similar to the ASM. The exception is that its operation is reversed. The shop owner should open the machine formspec and set both price and item. Item should be a fully qualified minetest item name (like default:dirt). When the player punchs the machine it will remove the item from the player and give him the ammount of coins set in the price field. In the event of error, a text will be shown in player chat and a sound will be played.

Recipes

Gold Ingots to Pounds
Image

Pounds to Gold Ingots
Image

Pounds to Shillings
Image

Shillings to Pounds
Image

Pence to Shillings
Image

Shillings to Pence
Image

Automatic Selling Machine
Image

Automatic Buying Machine
Image

News:

Added banking system. There are two new machines, bank draw machine and bank deposit machine. They allow money to be transfered to and from your bank account. No time to make the recipe screenshot so there goes the code :

Code: Select all
-- Drawing machine
minetest.register_craft({
   output = '"mint:draw" 1',
   recipe = {
      { "default:wood", "default:wood", "default:wood" },
      { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
      { "default:steel_ingot", "default:steel_ingot", "default:wood" }
   }
})

-- Deposit machine
minetest.register_craft({
   output = '"mint:deposit" 1',
   recipe = {
      { "default:wood", "default:wood", "default:wood" },
      { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
      { "default:wood", "default:steel_ingot", "default:steel_ingot" }
   }
})


News2 :

Added money transfer system. You can program single or recurrent money transfers between player accounts. Commands :

/bank
shows your current bank account balance
/transfer <toaccount> <ammount> <repeating> <interval>
programs a money transfer between two accounts.
<toaccount> is the account to wich to transfer money
<ammount> is the ammount of pences to transfer each time
<repeating> is the number of times to do the transfer (-1 to a infinite number of transfers)
<interval> is the interval between each transfer
/deletetransfer <id>
deletes a programmed transaction with id <id>
/listtransfers
lists all transfers programmed by the user

TODO:
- Add load/save bank scheduler.
- Add stock exchange.
- Add support for paid protector nodes (I need information on how to interface to area protection mods)
- Add support for offline mailboxes (I need information on how to interface to mailbox mods)

PostPosted: Sun Dec 16, 2012 23:10
by kaeza
+1000 bro.
Now Testing :)

PostPosted: Mon Dec 17, 2012 03:57
by Josh
Look's cool!

PostPosted: Mon Dec 17, 2012 06:10
by Zeg9
Nice, finally a money mod with actual items for money :)
Maybe I'll put that on my server, but for that please make a script to convert vendor's vending machines to yours...

PostPosted: Mon Dec 17, 2012 21:07
by aldobr
@Zeg9: I dont know that other mod. Where it is ?

PostPosted: Tue Dec 18, 2012 06:27
by Zeg9
http://minetest.net/forum/viewtopic.php?id=3039
Vending machines ^

Or you could make them compatible

PostPosted: Tue Dec 18, 2012 11:55
by cornellius
can i craft 3 mese coins to the 1 mese block??

PostPosted: Tue Dec 18, 2012 12:56
by aldobr
Nope, once mese is transformed into coins, it cannot leave the monetary system...

I am still thinking about a way to avoid inflation...

I believe now that the only way to avoid inflation is to allow mesecoins to be transformed back into mese...

That would allow removal of coins out of the monetary system.

This monetary system is similar to the gold standard.

Currently (IRL) we use a system where the currency is backed by the GDP, and its quite hard to control inflation...

I believe a gold standard is more suitable to minetest.

In a gold standard you can melt the coins to claim back the gold they are made of, removing gold from the monetary system.

In my monetary system the smallest denomination is the mese coin, that is worth 1/27th of a mese block.

So people can easily set the price of things based the relative value to mese.

If the coins cannot be returned to mese they will eventually saturate the market and assume a value independent of the relative value of mese, creating inflation.

I believe we trully need mese <-> mesecoin convertible, to make the mesecoin value trully attached to the value of mese.

i will make the changes...

PostPosted: Tue Dec 18, 2012 17:28
by kaeza
We totally need real economy in Minetest.
Though I'd hate to have to buy a flower for 847963 Mese Coins when everybody starts making lots of coins :)

PostPosted: Tue Dec 18, 2012 17:39
by NakedFury
For a better economy set it so only admins can get the minting machine and craft the coins.
When a player enters the server for the first time they are given a set amount of coins.
The admin then makes a server market where players trade stuff for more server coins. This is the only way to increase the coin amount in the game, otherwise players trade between themselves.

ohh and have the admin shop close from time to time so you wont have an over abundance of coins or set it so the prices are too high for materials and giving too few coins.

PostPosted: Tue Dec 18, 2012 19:40
by aldobr
IRL, during the time of the gold standard, there was no centralized mint system, yet, the economy worked.

IRL we need - now - centralized control of coin minting because the value of the money is not based on the rarity of any metal or goods but on the perceived performance of the GDP of a nation.

On a gold standard anyone can mint coins, because the value of the coin is not only on its face value (the value printed into it) but on the rarity - relative to other goods - of the gold that the coin is made of.

Mesecoin is a kind of gold standard where the value lies on mese. (A "mese standard").That way there is no need for centralized minting system.

Everyone just needs to set the price of things based on their relative rarity to mese.

For example : a coal lump is much more common than a mese block, so the price of coal will be less than the price of a full mese block.

Thats why i divided one mese block by 27 mesecoins, because that way you can buy like 27 coal lumps for the price of a single mese block. (This is another way to say that a mese block is 27 times more rare than a coal lump).

And so on...

Mese is even better standard than gold, because while IRL gold is almost useless (there are some uses, but they are easily solved by other means), on game mese is quite usefull.

Usefull and rare. Perfect value standard.

PostPosted: Fri Dec 21, 2012 01:10
by VanessaE
Mese has changed in minetest_game git master, such that it behaves sort of like an ore:

http://minetest.net/forum/viewtopic.php?id=4154

You might want to consider crafting your currency from one Mese Crystal plus one copper ingot from the Moreores, to make 9 coins of your lowest-value currency. If not that, then use Mese Crystal plus a steel ingot. That gives a value similar to what you currently have, but would work with the new method.

(Think of it as crushing the Crystal into granules and embedding those into the metal to make the coins)

PostPosted: Fri Dec 21, 2012 02:17
by aldobr
meseblock = 9x old mese
mesecrystal = 1x old mese
mesecrystalfragment = 1/9x old mese

mesecoin = 1/27x old mese
9mesecoin = 1/3x old mese
81mesecoin = 9x old mese

so i will use mesecrystralfragment as the basis of value,

this yields :

1 mesecoin = 1/27 * 1/9 = 1/243x the value of mesecrystal
9 mesecoin = 1/3 * 1/9 = 1/27x the value of mesecrystal
81 mesecoin = 9 * 1/9 = 1x the value of mesecrystal.

at 1/243 you can even price dirt correctly...

i will change the name of 1 mesecoin to minetoon pences
9 mesecoin to minetoon shillings
and 81 mescoin to minetoon crowns

1 minetoon pences = 1/243x the value of a mesecrystal
1 minetoon shillings = 1/27x the value of a mesecrystal
1 minetoon crowns = 1x the value of a mesecrystal

they can be returned to the market as mesecrystal blocks.

i am doing the changes... how can i detect game version ?

PostPosted: Fri Dec 21, 2012 05:13
by VanessaE
Those ratios sound right to me.

Since you depend on the "default" mod, you should be able to just check to see if "default:mese_crystal" is registered. If it is not registered, assume the old version.

Note that your old recipe to turn Mese into coins conflicts with the Mesecons mod, so I definitely advise including a metal of some kind in your initial Mese*-to-coins recipes (both old and new).

PostPosted: Mon Dec 24, 2012 23:21
by aldobr
Everything reformulated, i believe its stable now.

PostPosted: Thu Dec 27, 2012 05:08
by RAPHAEL
There appears to be a fatal flaw in this mod. Here's what I did:

1. Place ASM and add an item to it and set a price.
2. Log in another player (any player with interact).
3. Open ASM with other player and move item from it to inventory.
4. Get item for free.

This is a fatal flaw to me as it defeats the whole purpose of a selling machine. Otherwise love this mod.

PostPosted: Thu Dec 27, 2012 19:59
by aldobr
???

i never tested it in multiplayer...

but i used the same logic as the locket chest...

let me see the code.

PostPosted: Thu Dec 27, 2012 20:01
by aldobr
after placing node, string "owner" is set to the placer name

Code: Select all
    after_place_node = function(pos, placer)
        local meta = minetest.env:get_meta(pos)
        meta:set_string("owner", placer:get_player_name())
        meta:set_string("infotext", "This machine sells items for " .. meta:get_string("price") .. " Minetoon Pence(s).")
    end,



When trying to move item, check the player that is trying to move and reject a move if he is not the owner...

Code: Select all
    allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
        local meta = minetest.env:get_meta(pos)
        if not player:get_player_name() == meta:get_string("owner") then
            minetest.log("action", player:get_player_name()..
            " tried to access a locked ASM belonging to "..
            meta:get_string("owner").." at "..
            minetest.pos_to_string(pos))
            return 0
        end
        return count
    end,


This is basically the same code as locked chest...

PostPosted: Fri Dec 28, 2012 03:57
by RAPHAEL
aldobr wrote:after placing node, string "owner" is set to the placer name

Code: Select all
    after_place_node = function(pos, placer)
        local meta = minetest.env:get_meta(pos)
        meta:set_string("owner", placer:get_player_name())
        meta:set_string("infotext", "This machine sells items for " .. meta:get_string("price") .. " Minetoon Pence(s).")
    end,



When trying to move item, check the player that is trying to move and reject a move if he is not the owner...

Code: Select all
    allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
        local meta = minetest.env:get_meta(pos)
        if not player:get_player_name() == meta:get_string("owner") then
            minetest.log("action", player:get_player_name()..
            " tried to access a locked ASM belonging to "..
            meta:get_string("owner").." at "..
            minetest.pos_to_string(pos))
            return 0
        end
        return count
    end,


This is basically the same code as locked chest...


Is this new code? The code in the mod I have locally isn't same.

after_place_node = function(pos, placer)
local meta = minetest.env:get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "")
meta:set_string("infotext", "This machine sells items for " .. meta:get_string("price") .. " Minetoon Pence(s).")
end,


and

allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.env:get_meta(pos)
if not player:get_player_name() == meta:get_string("owner") then
minetest.log("action", player:get_player_name()..
" tried to access a locked ASM belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return 0
end
return count
end,


Is what I got locally. If code has changed please inform and update first post to reflect.

PostPosted: Mon Dec 31, 2012 02:59
by aldobr
i've found the bug.

its was a simple matter of operator precedence :///
annoying

PostPosted: Tue Apr 23, 2013 02:06
by aldobr
Pls someone move that mod to the release section ;)

PostPosted: Tue Apr 23, 2013 02:50
by kaeza
aldobr wrote:Pls someone move that mod to the release section ;)

It's better if you post in this topic.

PostPosted: Fri May 17, 2013 13:30
by webdesigner97
The download link is dead? Can you provide a new one?

PostPosted: Fri May 17, 2013 15:04
by ch98
maybe a minting machine made from very rare materials so only banks and governments can make it then make creation of each coin cheeper than coin itself so government does not go bankrupt. Also make it so only few players can operate it.

PostPosted: Mon Jun 03, 2013 10:28
by aldobr
ch98, you keep thinking about money in the current fiat model of currency.

on a gold standard theres no problem if everybody mint coins.