[Mod] Easy Vending Machines [1.0.1] [easyvend]

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

[Mod] Easy Vending Machines [1.0.1] [easyvend]

by Wuzzy » Post

This mod adds vending machines and depositing machines which allow players to exchange items for money (gold ingots by default). Fork of Vending Machines [vendor] and improved for usability and flexibility.
easyvend1.png
easyvend1.png (144.21 KiB) Viewed 941 times
Basics:
Vending machines (red) give items to their users and take their money in return.
Depositing machines (yellow) take items from their users and give them money in return.

Both vending and depositing machines use locked chests as storage for both items and money. Locked chests are essential for operation.
The machines use gold ingots as currency. The currency can be changed with a setting game-wide.
A status LED shows the machine status:
The green LED means the machine is operational and ready to trade.
The red LED means the machine is currently out of order and can't trade right now. Reasons: Out of stock, misconfiguration, no storage chest, etc.
easyvend2.png
easyvend2.png (54.76 KiB) Viewed 941 times
Quick Start:
(Note: Help entries for doc_items are provided.)
Spoiler
You can only use active machines (green LED) the other ones are currently out of order (you might visit them later).
Point the machine to see what is is buying or selling and who owns it. Rightclick the machine to see details and click on “Buy” or “Sell” to do a single exchange.
Provided that both you and the machine have enough money, items and inventory space for the exchange, the exchange is done.
The “message” field shows the previous user message to notify the user about something. It contains useful information when something didn't work.
Spoiler
For sellers (give items, take money):
  • Place a locked chest
  • Put the item you want to sell into the locked chest
  • Put a vending machine above or below it
  • Rightclick the vending machine
  • Put the item you want to sell into the “Offered item” slot
  • Enter the number of items and a selling price
  • Hit confirm. If the LED goes green, then you're all set, otherwise, check the message
  • Wait for customers to come and retrieve gained money from locked chest

    Hint: Any locked chest connected in an unbroken vertical stack of locked chests, vending machines and depositing machines can be accessed as storage by the vending machine.
For buyers (give money, take items):
This is the same as for buyers, but you use deposit machines, you have to put money into the chest, and you have to pick a “Required item”.

Special case: Tools. You can decide whether you want to sell/buy worn tools or if you only accept tools in perfect condition
Spoiler
Vending machine:

Code: Select all

WWW
WSW
WWW
Depositing machine:

Code: Select all

WSW
WSW
WWW
W = Any item belonging to the “wood” group, such as Wooden Planks, Acacia Wood Planks, etc.
S = Steel Ingot[/code]
Spoiler
This is a fork of a particular version/fork (not sure) of Vending Machines [vendor] where gold ingots rather than bank account values were used as money. This version has been used on the Just Test server and is still used on @test@. This mod is meant to be a drop-in replacement for the “gold ingot” version of this mod, eventually; but I might need to write some backwards-compability code first (not sure).
I did not really like version 1.02 of the original mod because I found the new bank account concept too confusing and it didn't even work for me. I liked the trading with items as currency much more and it was more straightforward to use. I have put a lot of work to make using this mod as easy as possible. Usability is important to me, if you have problems with this mod or find it unwieldy to use, please report it here.
Features overview:
  • Unique textures for active and inactive machines
  • Point a machine to see what is sells or buys
  • Machines support buying and selling of up to 31 times the maximum stack size per item (example: a vending machine can theoretically sell up to 3069 apples at once)
  • Choose whether the machines accept to buy/sell worn tools
  • Change the currency item used by machines with a setting (server-wide)
  • You can buy or sell from your own vending machines
  • Status LEDs: Green means it is active, red means it is inactive
  • Status and user messages in the form tell you about possible errors in the machine setup. The chat is kept clean
  • Help entries for Item Documentation [doc_items]
Download: Version 1.0.1
Git repository / project page (for developers): https://codeberg.org/Wuzzy/minetest_easyvend

Dependency: default (from Minetest Game) (Sorry for this, but I try to get rid of this dependency in later versions)
Optional dependencies: awards, doc, doc_items, screwdriver
Spoiler
  • Code: LGPL 2.1. Forked from vendor by Bad_Command_.
  • Sounds: CC-BY 3.0/CC-BY-SA 3.0/GPL 3.0/GPL 2.0
  • Textures: MIT License
Last edited by Wuzzy on Sat May 20, 2023 19:25, edited 15 times in total.

User avatar
qwertymine3
Member
Posts: 202
Joined: Wed Jun 03, 2015 14:33
GitHub: Qwertymine
In-game: qwertymine3

Re: [Mod] Easy Vending Machines [0.1.1] [easyvend]

by qwertymine3 » Post

Is there any reason why the "currency" item can't be chosen by the vending machine owner?

Some players may want to trade for something more immediately useful than a currency.
It also means that you have to include the otherwise redundant depositing machine.
Avatar by :devnko-ennekappao:

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Easy Vending Machines [0.1.1] [easyvend]

by Wuzzy » Post

Well, I inhereted this from the original vending machines mod, and I wanted to stay true to the original. This is how I learned about this mod on the now defunct Just Test server. Call it nostalgia. ;-)

Also, those are vending machines, not generic exchange machines.

It basically boils down to the question of why money exists. There are many reasons, but the reasons relevant for this mod are to make prices more comparable and to make trading in general easier.
I want to encourage trading with money more than trading with anything.

I already have thought of generalizing this whole trade thing but I have decided not to do so. It would require a nearly complete rewrite of the mod. It would also break with the original mod, obviously.
But when I think of it, it doesn't really make sense to “forbid” normal trading altogether since players will simply fall back to “trading by dropping items on the ground and hope they don't get screwed”. ;-)
But I certainly will keep the vending and deposit machines as such as those are a core concept of the mod. I will not remove or change them significantly.

I'd argue the machines are technically imcapable of generic trading. But I had an idea to add a 3rd machine which IS capable of generic trade and is crafted by combining both machines which means it is a bit more expensive to craft than the other machines. In this 3rd machine, the owner would be able to chose both given and taken items freely.
That way, this could mod have generic trading machines while still staying true to the original mod. Maybe I'd also add an option to disable the special 3rd machine for nostalgia mode. ;-)
But this is a major new feature and would take some time and work to implement, obviously. ;-)

I put it on the “maybe” to-do list after release of 1.0.0.

User avatar
ExeterDad
Member
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad
Location: New Hampshire U.S.A

Re: [Mod] Easy Vending Machines [0.1.1] [easyvend]

by ExeterDad » Post

I like that it gives gold, and the smelting of it a purpose. Cool mod, can't wait to test.

twoelk
Member
Posts: 1482
Joined: Fri Apr 19, 2013 16:19
GitHub: twoelk
IRC: twoelk
In-game: twoelk
Location: northern Germany

Re: [Mod] Easy Vending Machines [0.1.1] [easyvend]

by twoelk » Post

Wuzzy wrote:...
I already have thought of generalizing this whole trade thing but I have decided not to do so. It would require a nearly complete rewrite of the mod. It would also break with the original mod, obviously.
But when I think of it, it doesn't really make sense to “forbid” normal trading altogether since players will simply fall back to “trading by dropping items on the ground and hope they don't get screwed”. ;-)
...
There are the Trading mod and the old Currency and economy mod that even sported barter tables.

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Easy Vending Machines [0.1.1] [easyvend]

by Wuzzy » Post

There is no overlap with Trading as Trading is concerned with direct player-to-player trading/bartering while the machines are especially useful to sell/buy to many players while being absent.
Thus, these two concepts can co-exist.

Barter tables are not equivalent to my idea of a generic “exchange machine” as barter tables require players to be physically present, while the machines in my mod only require the user to be present. So, there's no overlap or redundancy as well if that is what you were trying to say.

So I think all these mods can co-exist without conflicts or redundancy. But thanks for mentioning the mods.

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Version 0.2.0

by Wuzzy » Post

I just released version 0.2.0!

This version now adds some legacy support for helping users of the original Vending Machines mod [vendor] by Bad_Command_ to automatically convert all their machines to [easyvend] ones. This is useful if you want to upgrade and switch from [vendor] to [easyvend].

This feature is experimental and NOT complete. Vending machines and depositing machines stored in inventories will not be upgraded for now (as I don't know how and I can't just use aliases).
If you want to help testing this feature (which I will appreciate very much!), read the readme file for instructions and don't forget to backup your world if it is important to you. Please post your test result here, no matter if you found bugs or not.
If you have access to a world with already a lot of vending machines in a real gameplay scenario (not just for testing), this would help a lot as this could potentionally catch some bugs I have overlooked so far.

Major plans for future versions:
- Finish legacy support
- Allow to select items currently not in inventory. This will be important to request rare items in depositing machines, otherwise you can only request items of which you already possess already 1 item.
- Allow machines to be stackable like in [vendor] 1.02
- Support more currencies
- Improve compability with other chests
- Add generic exchange machine which allows to set both given and taken item type freely

User avatar
taikedz
Member
Posts: 698
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake
Location: Scotland, UK
Contact:

Re: [Mod] Easy Vending Machines [0.2.0] [easyvend]

by taikedz » Post

This is THE mod I have been looking for....! My memory tells me it is similar to what was in use on maikerumine's ESMC last year, but I was never able to find something like it... saw the "vendor" mod, didn't like it.... but this just might be the ticket.

woohoo! will test soon :-)

User avatar
taikedz
Member
Posts: 698
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake
Location: Scotland, UK
Contact:

Re: [Mod] Easy Vending Machines [0.2.0] [easyvend]

by taikedz » Post

I gave it a whirl, this is definitely the system I prefer.

One of the forks you mention, as I recall, allowed stacking vending and depositing machines to a same chest. Is this on the roadmap for you?

Also, any chances of putting this in a git repo?

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Easy Vending Machines [0.2.0] [easyvend]

by Wuzzy » Post

Yes, stacking is on the roadmap like I mentioned in my previous post. But I guess it will take longer because there are so many corner cases to catch. I plan to release it in version 0.3.0.

A public Git repository already exists, I just forgot to post the link. Here's the repository:
http://repo.or.cz/minetest_easyvend.git

(Note: stackable machines/chests will be done in the tower branch)

User avatar
taikedz
Member
Posts: 698
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake
Location: Scotland, UK
Contact:

Re: [Mod] Easy Vending Machines [0.2.0] [easyvend]

by taikedz » Post

Thanks for the info - sorry, I scoured the first post for info only my bad.

Stacking - what corner cases are you thinking of? I was thinking, something like this simply
Spoiler

Code: Select all

function findvalidchest(pos,maxiter)
	local maxiterations = maxiter or 5
	local i = 1
	while i <= maxiterations do
		local tpos = {x=pos.x, y=pos.y-i, z=pos.z}
		local tnode = minetest.get_node(tpos)
		if  tnode.name == "default:chest_locked" then
			return tpos
		elseif not string.match(tnode.name,"easyvend:.+") then
			return {}
		end
		i = i+1
	end
	return {}
end
Am I being naive?
Last edited by taikedz on Tue Sep 13, 2016 12:04, edited 2 times in total.

User avatar
taikedz
Member
Posts: 698
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake
Location: Scotland, UK
Contact:

Re: [Mod] Easy Vending Machines [0.2.0] [easyvend]

by taikedz » Post

EDIT - nevermind, wrong branch. You have significantly re-worked on tower I'll leave it alone.

I made a working version with stacking support... Can I send you changes, and if so how? Simply make my own git repo and give you URL?

u34

Re: [Mod] Easy Vending Machines [0.2.0] [easyvend]

by u34 » Post

+1 good mod. i like it.

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Version 0.3.0

by Wuzzy » Post

Version 0.3.0 released!

Image

Vending machines, depositing machines and locked chests can now be stacked freely in a vertical line. Vending and depositing machines are now able to access ALL locked chests connected in a straight unbroken vertical line of machines and locked chests (order doesn't matter). This allows you to save space by building “towers” of machines accessing the same chest. Or you could extend storage by placing multiple locked chests in a column.
This new feature is a re-implementation of the stacking feature of the original vendor mod: viewtopic.php?t=3039

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Easy Vending Machines [0.3.0] [easyvend]

by Wuzzy » Post

Reply to rnd's review of this mod at <viewtopic.php?f=10&t=15334&start=125#p233995>:

First of all, thanks for reviewing this mod!
rnd wrote:1. good messages when configuring: what needs to be done
My goal was to make using the machines fool-proof, and to stop cluttering the chat. This has been motivated by the fact that many players have no clue how the machiens work on @test@ and it errors can easily sneak in.
That having said, if anyone has difficulties in using my machines, please write a complaint here.
rnd wrote:2. can use several locked chests put vertically in same line as shop
This has been reimplemented from the most recent vendor mod, so this feature was quite mandatory. ;-)
Interestingly, version 1.02 of vendor also kinda supported connected chests in the X and Z axis, but this was not documented and caused a lot of bugs. I only reimplemented vertical stacking for simplicity; I think also supporting the other directions is too complicated and too confusing to use.
rnd wrote:3. good texture
4. texture changes to indicate shop needs attention
Thanks, I wanted to make sure the machine's state is visible from afar. One of the frustrating things in Just Test and @test@ is that you have to check out all machines manually which can get tedious if you have lots of machines.
Also, I hate the original textures because they look way too similar to chests. ;-)
BAD:
1. it checks constantly - every 5 seconds for chest and materials
-> better: check/update only when player right click/punch it
Personally, I like that machines auto-update from time to time. Because players are lazy; without an auto-update, players could refill a chest, forget to update the machine manually and the machine will thus appear to be “off” indefinitely. :-(
But I am aware of possible performance issues. I have thought about this auto-updating by myselves. I have planned to test whether this regular checking has a serious impact on performance. Maybe 5 seconds is too fast, I am not sure. Maybe any interval is too much, I have no idea. This needs to be tested.
A clean way would be if I could detect instantly when a player is modifying chest contents WITHOUT overwriting the chest definition. I'm afraid this is not possible.

By the way, the machines already support being updated after punching.
2. dont like the fact you are limited to currency ( can be set by server owner for all shops but not by shop owner?).
I already addressed this concern in this thread.
3. featuritis - why you need stuff like jokes and then have to handle all that "joking".. also 48kbytes for this vendor mod - simple shop has just 5 kb and cleaner code
The feature you are talking about doesn't take much of the overall code. I also don't know what your standards on “code cleaniness” are and I don't know why I should obey them. ;-) (OK, maybe I could write a few comments.) Also, 48 KiB is still pretty lightweight. Trying to reduce source code file size is foolish; file size of media files is MUCH more relevant and blows up much faster.
While I agree the feature you talk about could be removed without problem and is non-essential, I don't see a real problem in having it; it doesn't cause maintenance trouble and only takes a rather minor part of the code.
I consider all other features to be essential to this mod.

For example, there's a reason why I support machines to allow/reject worn tools. This feature may seem like a luxury at first. But without this feature, there would be no way to buy new tools for guaranteed, so any tool you buy could be badly damaged and vending machines could screw you badly. This is simply neccessary complexity.

Besides, the “easy” in “easyvend” refers to “easy to use”, not necessarily “easy code”.
4. ERROR[Main]: ServerError: Lua: Runtime error from mod 'easyvend' in callback node_on_dig(): ...\minetest0414server\bin\..\mods\easyvend/easyvend.lua:854: at
tempt to index local 'chest' (a nil value)
Fixed.

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Version 0.4.0

by Wuzzy » Post

Version 0.4.0 released! Changelog:

- Add achievements for sellers ([awards] mod)
- Add a help button when Documentation System is active ([doc] and [doc_items])
- Fix possible crash after digging machine
- Show error when currency item is not known
- Compability with Documentation System 0.8.0

User avatar
SaKeL
Member
Posts: 742
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: [Mod] Easy Vending Machines [0.4.0] [easyvend]

by SaKeL » Post

FYI:

Code: Select all

Field "tile_images": Deprecated; new name is "tiles".
;)

UPDATE:
just crashed my server :(

Code: Select all

ERROR[Main]: ServerError: Lua: Runtime error from mod 'easyvend' in callback node_on_receive_fields(): /root/.minetest/mods/easyvend/easyvend.lua:540: attempt to index global 'awards' (a nil value)

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Version 0.4.1 released

by Wuzzy » Post

Oops! Version 0.4.1 released!

Changelog:
  • Fix critical bug: Mod made server crash when player was about to earn the “First Sale” award but the “awards” mod was not installed (reported by SaKeL)
  • Get rid of deprecated code (reported by SaKeL)
Spoiler

Code: Select all

10 HEAD -> TABLE
20 GOTO 10

User avatar
SaKeL
Member
Posts: 742
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: [Mod] Easy Vending Machines [0.4.1] [easyvend]

by SaKeL » Post

Thanks appreciate it.

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Version 0.4.2

by Wuzzy » Post

Version 0.4.2 released.
Changelog:
- Compability with the Help modpack (doc, doc_items, etc.), version 1.0.0.
- Fix error in credits
- Fix incorrect dependency

Note: Updating to 0.4.2 is neccessary if you use the new version of the Help modpack.

User avatar
fwhcat
Member
Posts: 26
Joined: Thu Aug 04, 2016 14:36
GitHub: fwhcat
IRC: fwhcat
In-game: fwhcat

Re: [Mod] Easy Vending Machines [0.4.2] [easyvend]

by fwhcat » Post

Hey Wuzzy, thanks for this awesome mod.

It seems there is a bug when you an item in a chest becomes unknown, the mod crashes when you go near the machine. It crashes here:
http://repo.or.cz/minetest_easyvend.git ... .lua#l1151

it should NOT go in the "if" when the node is "unknown".
Meowww

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Version 0.4.3

by Wuzzy » Post

Thanks for the bug report!

I just released version 0.4.3 which fixes the aforementioned crashes related to unknown items.

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] Easy Vending Machines [0.4.3] [easyvend]

by octacian » Post

Could you please add support for chests from the protector mod (protector:chest)?

Also, have you considered a type of admin vending machines? Essentially, an admin vending machine would allow someone with give privileges to sell an unlimited number of items assuming that the player can provide the correct amount of gold without having to fill a chest. And of course, the deposit machines would work in the opposite way, being able to provide gold for items without depending on a chest. This would be really useful for servers with a large number of players where administrators sometimes set up shops or banks when they are not actually trying to make a profit.

Anyways, if you'd be willing to implement the first item, I'd really appreciate it as it would allow for shops owned by multiple people. And the second one would be incredibly useful to have available, so if you're able to implement it, thanks!
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Easy Vending Machines [0.4.3] [easyvend]

by Wuzzy » Post

This idea of machines with infinite supply is very interesting.

On my endless TODO list for this mod is an API for adding new containers.

PS: Note that development for this mod is currently on hold.

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] Easy Vending Machines [0.4.3] [easyvend]

by azekill_DIABLO » Post

good mod anyway.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests