[Mod] Item sell/buy system / banking (for servers) [economy]

Post Reply
User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

[Mod] Item sell/buy system / banking (for servers) [economy]

by orwell » Post

This mod is not actively maintained anymore. I recommend you to use the [currency] and [atm] mods. If you want, you can port the vending machine there yourself.

Yet another money system!
Warning! This is not intended for singleplayer use! The machines need to be protected using area protection mods like denaid or areas!
This mod adds three new machines to Minetest:
Spoiler
This machine is used to sell and buy items. Players can throw items into a slot to sell them. Once items have been sold to the machine, other players can buy back these items.

Only items that are on the price list can be sold. The price list is editable inside init.lua and is a table containing items that can be sold and their selling price.
This list needs to be extended!You can help by adding prices for items of mods you use and are useful to be able to sell and posting them into this thread.

Every item sold to the machine is stored inside it (as metadata keys, not as inventory!). Players can buy items from the machine by accessing the price list and clicking the wanted item. This is only possible if the machine has any items of this type(any player sold that item to the machine before)
Spoiler
It is used 1. to see the last money transactions a player did and 2. to transfer money to other players. The menu appearing on right-clicking it should be self-explaining.
Spoiler
The player-controlled vending machine is a tool for players to offer their items for sale. They act almost like the regular vending machines: the player puts his items in and other players buy them, just with three differences:
- the owner can always put in and take out items as he wants, no money is transferred;
- if another player buys an item, the amount is directly transferred to the owner's account and
- players other than the owner can't sell items to the machine.
The currency used is TestDollar, abbreviated by the Unicode character ŧ (a 't' with 2 horizontal dashes). TestDollar do not exist as items and are only present as value on a virtual bank account.
The machines do not have crafting recipes, get them by /giveme-ing economy:vending or economy:bank
Of course there is an API to interface with the TestDollar money system. See documentation in readme.txt inside mod directory. Depend on this mod to use.

Depends on:
default
dye
(only for the crafting)

License:
Code: LGPL 3.0 (Node definition for the machines by VanessaE (homedecor soda vending machine))
Machine model and textures(modified) by VanessaE (homedecor soda vending machine): CC-by-SA 3.0

Now on github: https://github.com/orwell96/economy

Download:
economy_1_2.zip
v. 1.2
(21.78 KiB) Downloaded 497 times
added intllib support and German translation
added administrative chat commands
fixed stuff

Older versions:
economy_1_1.zip
v. 1.1
(17.2 KiB) Downloaded 201 times
added player controlled vending machines
economy_1_0.zip
v. 1.0
(9.2 KiB) Downloaded 137 times
Initial release
Last edited by orwell on Thu Sep 13, 2018 11:40, edited 8 times in total.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
mahmutelmas06
Member
Posts: 367
Joined: Mon Mar 02, 2015 13:10
GitHub: mahmutelmas06
IRC: mahmutelmas06
In-game: masum

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by mahmutelmas06 » Post

First of all thanks for the mod

Instead of new money, you could have used bitchange and currency mods moneys.
My Mods:

Beverage

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by orwell » Post

v. 1.1 released
Included player-controlled vending machines.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
ErrorNull
Member
Posts: 274
Joined: Thu Mar 03, 2016 00:43
GitHub: ErrorNull0

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by ErrorNull » Post

nice! i will definitely try this out.. been looking for a mod like this for my server.

User avatar
linushsao
Member
Posts: 418
Joined: Mon Jan 27, 2014 12:56
IRC: linushsao
In-game: linus
Location: Taipei,Taiwan(R.O.C)
Contact:

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by linushsao » Post

awesome,i like selling machine.it maybe used to create some "minetest offical shop" for some material of items(ex. for technic/mesecons) for players. players could have choice to dig by himself or buy from "minetest offical shop".

and players could exchange money by items no longer needed.

i really need this mod.

but the bank machine could not let me transfer money to other players, only could transfer to myself.(i has create other players for test).

Image

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by orwell » Post

Ok thanks, i will check that ASAP.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by orwell » Post

Version 1.2
added intllib support and German translation
added administrative chat commands
fixed stuff
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
AccidentallyRhine
Member
Posts: 252
Joined: Sun Aug 02, 2015 05:43

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by AccidentallyRhine » Post

Nice! I like that it doesn't just take the lazy route of operating through chat. I always felt the players should need to travel to a physical location to do things like buying or selling. Does this support 0.4.14?

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by orwell » Post

To Do List:
Remove a possible 'cheat' (I won't tell you what it's about, but server safety is not in danger)
create interfaces for 'hard-money' mods.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
AccidentallyRhine
Member
Posts: 252
Joined: Sun Aug 02, 2015 05:43

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by AccidentallyRhine » Post

I have decided to implement your mod on my server. I've made some tweaks, maybe you will want or not. It is important to me that players are able to set up their own town banks so I have added a crafting recipe for the banking machine:

Code: Select all

minetest.register_craft({
	output = "economy:bank",
	recipe = {
		{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
		{"dye:blue", "dye:cyan", "dye:blue"},
		{"default:steel_ingot", "default:copperblock", "default:steel_ingot"},
	},
})
I have also redone the inventory images to better match the art style. Files attached:
Attachments
economy_vending_inv.png
economy_vending_inv.png (639 Bytes) Viewed 1554 times
economy_playervendor_inv.png
economy_playervendor_inv.png (703 Bytes) Viewed 1554 times
economy_bank_inv.png
economy_bank_inv.png (590 Bytes) Viewed 1554 times

User avatar
christoferlevich
Member
Posts: 325
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by christoferlevich » Post

I have started messing with this mod for an educational purpose but I have two minor issues I am hoping someone might be able to help with... the first is this: I have been able to add a decimal to the currency and created nodes for us coins and bills.

1) Everything seems to be working well until the balance is '.00' In other words, one dime and one cent displays as "$.11" but a single dime it displays as '.1'. Any idea on how to get it to show ".10"? Maybe an invisible wildcard character?

2) Is there anyway to create an atm to accept the us currency nodes in trade for an automatic deposit into the players banking account? I can accept the nodes in game manually and add the currency via chat, but it seems like an automated atm would be better.
everything can be a learning experience...

User avatar
christoferlevich
Member
Posts: 325
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by christoferlevich » Post

I messed up and dont know how to delete my post
Last edited by christoferlevich on Mon Feb 20, 2017 21:36, edited 1 time in total.
everything can be a learning experience...

Byakuren
Member
Posts: 818
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by Byakuren » Post

christoferlevich wrote:1) Everything seems to be working well until the balance is '.00' In other words, one dime and one cent displays as "$.11" but a single dime it displays as '.1'. Any idea on how to get it to show ".10"? Maybe an invisible wildcard character?
You can use string.format to get a properly formatted string. e.g.

Code: Select all

local str = string.format("%2.2f", 4.4)
Also I would be careful with using vanilla floating point numbers for money, since you might accumulate precision errors. The best method would be to store the number of cents as an integer and just divide it by 100 when you display it.
Every time a mod API is left undocumented, a koala dies.

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by orwell » Post

I have not been working on this mod for a long time. There are some other alternatives around which can keep up to and are better than my mod in some aspects, some are worse. I also won't continue developing this except if you have revolutionary ideas.
Spoiler
Player vending machines can be used as infinite chests. If I should fix this, write here
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

Byakuren
Member
Posts: 818
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by Byakuren » Post

Every time a mod API is left undocumented, a koala dies.

User avatar
christoferlevich
Member
Posts: 325
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by christoferlevich » Post

Byakuren wrote: You can use string.format to get a properly formatted string. e.g.

Code: Select all

local str = string.format("%2.2f", 4.4)
Also I would be careful with using vanilla floating point numbers for money, since you might accumulate precision errors. The best method would be to store the number of cents as an integer and just divide it by 100 when you display it.
Well, I am trying to do it by counting everything as a penny (us) so 100 pennies is a dollar, etc. There are a lot of things I'd like to do with this mod that would make an educational server hum, but its going to take time for me to figure out how to do it.
everything can be a learning experience...

User avatar
christoferlevich
Member
Posts: 325
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by christoferlevich » Post

orwell wrote:I have not been working on this mod for a long time. There are some other alternatives around which can keep up to and are better than my mod in some aspects, some are worse. I also won't continue developing this except if you have revolutionary ideas.
Its actually working pretty well for what I need except I would also like to use it to have my imaginary shops have the ability to purchase items back at a user defined price. In the world we set up, for instance, we created items to represent coins and bills but they can't be physically 'sold' to a back to put the monetary amount into the accounts. Nothing really revolutionary. If I can figure out how to make a vending machine that does purchasing I'll be set.
everything can be a learning experience...

Michael Eh?
Member
Posts: 391
Joined: Sun Jan 01, 2012 17:21

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by Michael Eh? » Post

Tried the player vending machine. It's okay but I would like to define quantity sold and price. I can add pine cone nuts but all for one price... not lets say 25 for 10t

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by orwell » Post

I am not really developing this mod anymore. There are some better cash mods out there, I would recommend Minegeld.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

gpcf
Member
Posts: 382
Joined: Fri May 27, 2016 10:48
GitHub: gpcf
In-game: gabriel

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by gpcf » Post

The mod that provides minegeld is called currency. See https://github.com/minetest-mods/currency.

User avatar
casp3r
Member
Posts: 21
Joined: Sat Nov 11, 2017 10:38

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by casp3r » Post

currency+ bank_account are just terrible

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Item sell/buy system / banking (for servers) [econ

by orwell » Post

orwell wrote:I am not really developing this mod anymore. There are some better cash mods out there, I would recommend Minegeld.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 73 guests