[Mod] Fancy Vend [fancy_vend]

Post Reply
User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

[Mod] Fancy Vend [fancy_vend]

by ChimneySwift » Post

Fancy Vend
Image

A full-featured, fully-integrated vendor mod for Minetest.

There are many vendor mods for Minetest, but most have too few options, lack support for automation mods, or are too tedious to set up and maintain. Fancy vendors are entirely self-contained nodes which provide light, trade, display and store items. Fancy vendors are pipeworks, digilines and awards compatible, enabling a variety of automation-based features.

Download
GitHub

Code license: MIT

Textures license: MIT

Dependencies: default

Optional Dependencies: pipeworks, digilines, awards

Contributors: Many thanks to LadyK for the textures, patience and ideas.

Note: This mod is still a WIP, while the currently available version has been extensively tested to try and limit the possibility of bugs, there are no guarentees. Please install this mod with care and report any possible issues ASAP so they can be resolved. Thank you for your cooperation, we hope you enjoy Fancy Vend and look forward to hearing your suggestions for improvement.
Spoiler
Crafting and basic configuration

A fancy vendor can be crafted as follows:

Image

While the recipe is more expensive than most vendors, it more than makes up for this in the vendor's inventory size and additional features.

Each fancy vendor needs 2 nodes of room. If the area you wish to place the vendor doesn't have enough space, due to either a node or a protected area, the node will not be placed. If the vendor has sufficient room, it will place a vendor node in addition to a display node on top. The display node's only purpose is aesthetics, to "contain" the rotating display object.

Configuring a vendor is as simple as picking up and placing the input and output items into their respective slots as if they were regular inventories (items in these inventories are "ghosts", so don't actually take anything from the player's inventory) and setting the quantities for each item, as shown below:

Image

Stocking a vendor is as simple as placing the output item into the vendor's inventory (perhaps using one of the handy inventory movement buttons) as demonstrated below:

Image

After stocking a vendor, you may wish to press the "sort" button, which will combine unfilled stacks and sort the stacks in alphabetical order.

If the vendor is intended to be used to purchase items, you may wish to set the vendor to a depositor in the vendor settings, this will display the input item in the display case and change the vendor's appearance to make it clear to potential sellers the vendor's purpose. The previous example vendor set to a depositor can be seen below:

Image
Spoiler
Buying items

Regular players who can't access a fancy vendor's inventory or configuration will be displayed a purchase screen when they access a vendor. This screen displays vendor information and status, as well as buying options. Unlike many vendor mods, fancy vendors give buyers to buy multiple "lots" at once. Doing this can save a lot of clicking, as the number of input and output items traded is multiplied by this number.

There is also a button labeled "Fill lots to max" which will pre-load the lots field with the maximum number of lots that the player can purchase from the vendor (which will be either the maximum the player can afford, or the maximum the shop can sell, whichever is smaller).

An example image of the buyer formspec can be seen below:

Image
Spoiler
Advanced settings

Fancy vendors have many additional options which enable sellers to greatly customize vendors.

Image

Banned Buyers:
This field is a list of players (separated by commas) who won't be able to purchase from the vendor. This setting might be useful if you wish to stop players buying out your vendor's stock and reselling it for a higher margin.

Co-Sellers:
This field is a list of players (separated by commas) who will be able to access the vendor's inventory. Please note: Anyone added to the list has full access to the vendor's inventory, however cannot modify the vendor settings nor dig the vendor.

Buy/sell worn tools:
These options allow for the seller to stop the vendor from purchasing or selling worn tools. A message will display on the buyer formspec if one of these options is disabled.

Inactive force:
While the seller is reconfiguring a vendor, or in the process of creating a shop, the owner might wish for the vendor to be inactive so players cannot purchase from it, in which case they can enable this option.

Autosort: If this option is enabled, the vendor's inventory will automatically sort when the vendor formspec is closed by someone who can access the inventory.

Logs:
The logs formspec displays the 40 most-recent transactions. While only people who can modify the vendor are allowed to access this formspec, these logs are kept in metadata which could be easily read client-side.

Geminio Wand:
This tool can be used to easily copy vendor settings from one vendor to another. Simply right click a vendor with it to copy the settings to the tool, and left click any other vendor to set that vendor's settings. The Geminio Wand will not copy input and output items nor quantities. You must be able to modify the settings of the vendor to do this. You can craft one with the following recipe:

Image
Spoiler
Automation

Fancy Vendors are digilines and pipeworks compatible, enabling the creation of highly automated shops.

Pipeworks

Fancy vendors connect to pipeworks devices from the bottom, rear and sides. When the optional pipeworks dependancy is satisfied, a number of pipeworks-specific options will also appear in the settings menu:

Image

Split incoming stacks:
This option enabled incoming stacks from pipeworks tubes to be split if only some of the stack can be accepted.

Eject incoming currency:
When this option is enabled, the input items will be sent out of the bottom of the fancy vendor instead of being added to the vendor's internal inventory.

Accept output only:
When this option is enabled, incoming items which aren't the output item will be rejected and not added to the vendor's inventory.

Hoppers

Fancy vendors are hopper compatible. They have been tested to work with TenPlus1's hopper mod however should work with all hopper mods and forks. Hoppers can filter into vendors from the sides, however cannot be drained from the bottom as hoppers are protected and Fancy Vendors are locked. However, the shop owner is given the Eject incoming currency option which operates on hoppers similarly to how it does on pipeworks, by manually adding incoming currency to the inventory of a hopper placed below the vendor (or into the vendor's inventory if the hopper is full). Due to API limitations, Accept output only is not hopper-compatible and Split incoming stacks is not necessary.

Digilines

Fancy vendors are digilines compatible. When the digilines dependency is satisfied, an option to set the digiline channel will appear in settings. If this channel is set, every purchase will result in the following table being sent over that channel:

Code: Select all

local msg = {
    buyer = player:get_player_name(), -- Purchaser's playername
    lots = lots, -- Number of lots purchased
    settings = settings, -- The settings table
}
The default settings table can be seen below:

Code: Select all

local settings_default = {
    input_item = "",
    output_item = "",
    input_item_qty = 1,
    output_item_qty = 1,
    admin_vendor = false,
    depositor = false,
    currency_eject = false,
    accept_output_only = false,
    split_incoming_stacks = false,
    inactive_force = false,
    accept_worn_input = true,
    accept_worn_output = true,
    digiline_channel = "",
    co_sellers = "",
    banned_buyers = "",
}
Fancy Vendors and Fancy Vendor Display Nodes conduct digiline signals also.
This feature could theoretically make rewards-based shops feasable.
Spoiler
Upgrading vendors

NOTE: If you wish to simply run this mod in parallel with existing vendor mods, simply load this mod (no configuration required)

Many servers already have vendor mods in place. Fancy Vend makes it easier for servers to upgrade with it's unique upgrading system. Fancy Vend will replace vendors from the supported vendor mods (money, vendor, easyvend and currency) with upgrade nodes. Upgrade nodes allow for sellers to empty the old node's inventory (if applicable), dig the upgrade node (which will drop a regular vendor) and set up a new shop. if a user tried to place an upgrade node, the stack is turned into a stack of regular vendors.

Since upgrade functionality can be achieved without the old mod loaded, the server owner must add the old vendor mod's name to minetest.conf as follows:

fancy_vend_old_vendor_mods = money

If there are multiple vendor mods the the owner wishes to enable this functionality on, they can add several mods to the list, separating each mod name with commas as follows:

fancy_vend_old_vendor_mods = money,vendor,easyvend

If the owner wishes to keep the mod loaded, but still replace vendor nodes, the will need to add the mod to both minetest.conf and fancy_vend's depends.txt.

Vendor upgrade:

Image
Spoiler
Administration

Fancy vendors also include a variety of tools for server administrators.

Admin vendors:
Admin vendors perform the same role as their regular counterparts, however they do so with no stock or inventory requirements, simply creating and destroying items as players purchase.

Since incorrectly configured admin vendors could be easily used to duplicate items, the admin_vendor privilege is required for the option to switch a vendor to one appears. If the user is ever revoked this privilege, all admin vendors they own will be forced into an inactive state until the privilege is re-granted or the vendor is set to a player vendor.

Modifying vendors:
If a user has the protection_bypass privilage, they will be able to access the full extent of the vendor as if they were the owner, including inventory and settings.

Server and client load:
Fancy vend uses only one infrequent abm to refresh vendor objects in the event of a clearobjects. No other vendor updating is done unless a player purchases from the vendor or adjusts settings.

Note: Some clients using mobile and/or older devices, including PCs, may experience additional lag if many fancy vendors are used in a small space, however not to an extent greater than the majority of shops where players use itemframes or pedestals to achieve the same functionality as the fancy vendor's display.

Settings:
The following minetest.conf settings can be configured to further modify the appearence of Fancy Vendors:

fancy_vend_display_node - Change the display node to something other than default:obsidian_glass (ensure mod this node belongs to is in depends.txt)

fancy_vend_log_max - Change the maximum number of logs stored in a vendor's metadata

fancy_vend_autorotate_speed - Change the speed at which the display object rotates

Temporarily disabling vendors:
Any player with the disable_vendor privilege can run /disable_all_vendors to force all vendors into an inactive state. Please use this if you find a dangerous bug and are waiting for it to be fixed.
Last edited by ChimneySwift on Thu Mar 01, 2018 03:03, edited 3 times in total.
A spoon is basically a tiny bowl with a stick on it

User avatar
KatzEyez
Member
Posts: 50
Joined: Tue Aug 08, 2017 18:24
GitHub: KatzPetz
IRC: LadyK
In-game: LadyK
Location: (IG: Depends) (RL: USA)

Re: [Mod] Fancy Vend [fancy_vend]

by KatzEyez » Post

I love it! You did an excellent job on this ChimneySwift! You brought my ideas to life, which I could not. You were also patient with me as I drove you nuts mentioning all the crazy ideas I thought this mod needed! You threw your ideas in the mix too! I couldn't have dreamed of it coming out as nice as you have made it! Thank you.
Why wish upon a star when you can pray to the one who created it.

User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

Re: [Mod] Fancy Vend [fancy_vend]

by ChimneySwift » Post

KatzEyez wrote:I love it! You did an excellent job on this ChimneySwift! You brought my ideas to life, which I could not. You were also patient with me as I drove you nuts mentioning all the crazy ideas I thought this mod needed! You threw your ideas in the mix too! I couldn't have dreamed of it coming out as nice as you have made it! Thank you.
Thanks!

Your ideas only gave me more work because they were so good, and I could never have done it without your textures, lol.
A spoon is basically a tiny bowl with a stick on it

Chem871
Member
Posts: 999
Joined: Sat Aug 19, 2017 21:49
GitHub: Chemguy99
In-game: Chem Nyx
Location: My Basement's Attic

Re: [Mod] Fancy Vend [fancy_vend]

by Chem871 » Post

Looks like a better shop mod! Would you make it hopper-compatible?

P.S. Quite a few people seem to be hating on OldCoder, what exactly did they do?
What is SCP-055?

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: [Mod] Fancy Vend [fancy_vend]

by Stix » Post

YESsss! this is amazing! +1 to you and katzeyez, i like that instead of a special node for a admin shop its a setting, and the display cabinet portion means players dont need to wast resouces on itemframes, even better, it could be added to a server after another shop mod being used for a while without screwing things, amazing!
Hey, what can i say? I'm the bad guy.

User avatar
Lone_Wolf
Member
Posts: 2578
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [Mod] Fancy Vend [fancy_vend]

by Lone_Wolf » Post

Great mod! Love it!
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

Re: [Mod] Fancy Vend [fancy_vend]

by ChimneySwift » Post

Chem871 wrote:Would you make it hopper-compatible?
Good idea, I spend more time using pipeworks so forgot about hoppers, but a lot of servers use them so I will definitely add this. I should be able to make all of the current pipeworks settings work with them also.

EDIT: due to API limitations, only the "Eject incomming currency." setting will be compatible with hoppers for now.
Chem871 wrote:P.S. Quite a few people seem to be hating on OldCoder, what exactly did they do?
viewtopic.php?f=3&t=18946
A spoon is basically a tiny bowl with a stick on it

User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

Re: [Mod] Fancy Vend [fancy_vend]

by ChimneySwift » Post

Attention Admins:
A new update has been committed which solves 2 inventory glitches. If you are running on a version downloaded before this post please update fancy_vend. In light of these bugs, I have implemented a chat command (/disable_all_vendors) which requires the disable_vendor privilege, which will force all vendors into an inactive state, please use this if you find a dangerous bug and are waiting for me to fix it.

Hoppers and sorting:
Hopper support has now been added. The eject currency setting will instead add the currency item directly to a hopper inventory if connected. Accept only output can not be done with hoppers due to API limitations, and split stack is not necessary.

Vendor inventories now have auto-sort and sort like technic_chests chests also.
A spoon is basically a tiny bowl with a stick on it

User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

Re: [Mod] Fancy Vend [fancy_vend]

by ChimneySwift » Post

New update, Fancy Vendors and Fancy Vendor display nodes now also conduct digiline signals.
A spoon is basically a tiny bowl with a stick on it

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] Fancy Vend [fancy_vend]

by azekill_DIABLO » Post

Pedestal+simple = this = +1 = Well done, it's far nicer than having only a golden chest to sell things!
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
GamingAssociation39
Member
Posts: 858
Joined: Mon Apr 25, 2016 16:09
GitHub: Gerold55
IRC: Gerold55
In-game: Gerold55
Location: Maryland, USA

Re: [Mod] Fancy Vend [fancy_vend]

by GamingAssociation39 » Post

Will there be a sequel to this mod to add real life looking vending machines that sell candy and soda pop?
Jesus Is Lord and Savior!!!

User avatar
Lone_Wolf
Member
Posts: 2578
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [Mod] Fancy Vend [fancy_vend]

by Lone_Wolf » Post

GamingAssociation39 wrote:Will there be a sequel to this mod to add real life looking vending machines that sell candy and soda pop?
Homedecor has the soda pop
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

Re: [Mod] Fancy Vend [fancy_vend]

by ChimneySwift » Post

GamingAssociation39 wrote:Will there be a sequel to this mod to add real life looking vending machines that sell candy and soda pop?
I wasn't planing on it.

It might be an interesting idea though, they would go as a separate mod I would think though.
A spoon is basically a tiny bowl with a stick on it

cybervision
Member
Posts: 31
Joined: Wed Jan 10, 2018 05:45
GitHub: tonsb
In-game: cybervision

Re: [Mod] Fancy Vend [fancy_vend]

by cybervision » Post

i hope you can update it so in admin vendors you can have a price of more than one item
like i want to trade 5 gold for a gold helmet but it will only allow 1

User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

Re: [Mod] Fancy Vend [fancy_vend]

by ChimneySwift » Post

cybervision wrote:i hope you can update it so in admin vendors you can have a price of more than one item
like i want to trade 5 gold for a gold helmet but it will only allow 1
I haven't checked the forums for a while and didn't realize this post, sorry.

You should be able to set any number of input/output item for admin vendors, the only difference is they create/destroy items instead of using inventory. Did you figure this out or is it still an issue? If so what exactly did you try to do?
A spoon is basically a tiny bowl with a stick on it

cybervision
Member
Posts: 31
Joined: Wed Jan 10, 2018 05:45
GitHub: tonsb
In-game: cybervision

Re: [Mod] Fancy Vend [fancy_vend]

by cybervision » Post

well i tried putting in five rotten flesh for 1 wooden helmet for my mob fighting minigame

User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

Re: [Mod] Fancy Vend [fancy_vend]

by ChimneySwift » Post

I was able to set a vendor up like this:
1.PNG
1.PNG (174.25 KiB) Viewed 1594 times
Unfortunately due to the way formspecs work you need to either press enter after changing text fields or send a button/checkbox change (eg, use a check box or change the page), if you press esc then it won't send the fields to the server.

Because of this I've added a close button to the tabs, which will send the fields to the server and close the formspec, hopefully this helps for mobile players, and resolves your issue (so try changing settings then pressing the X button).
A spoon is basically a tiny bowl with a stick on it

User avatar
neko259
Member
Posts: 805
Joined: Sun Jun 19, 2011 06:51

Re: [Mod] Fancy Vend [fancy_vend]

by neko259 » Post

It would be nice to allow the vendor owner access it like anyone else to buy and sell, at least to check out everything works. E.g. I tried to understand what depositor option does except change the texture, but I can't, because I don't see the "client" interface.

User avatar
neko259
Member
Posts: 805
Joined: Sun Jun 19, 2011 06:51

Re: [Mod] Fancy Vend [fancy_vend]

by neko259 » Post

neko259 wrote:It would be nice to allow the vendor owner access it like anyone else to buy and sell, at least to check out everything works. E.g. I tried to understand what depositor option does except change the texture, but I can't, because I don't see the "client" interface.
PS I modified the code to show the buyer interface on punch, and the configuration OR buyer interface (as of now) on rightclick. This allows me to buy from my vendor and buy from the other players even if I have the privileges to access their vendors. I can share the code if you want

Jackknife
Member
Posts: 189
Joined: Fri Sep 25, 2020 20:07

Re: [Mod] Fancy Vend [fancy_vend]

by Jackknife » Post

I ran into a problem

2022-01-16 16:23:31: ACTION[Server]: singleplayer moves x_bows:bow_wood to vendor at (-1686,5,-199)
2022-01-16 16:23:31: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback nodemeta_inventory_OnPut(): ...n64\minetest-5.4.1-win64\bin\..\mods\fancy_vend\init.lua:980: attempt to index a nil value
2022-01-16 16:23:31: ERROR[Main]: stack traceback:
2022-01-16 16:23:31: ERROR[Main]: ...n64\minetest-5.4.1-win64\bin\..\mods\fancy_vend\init.lua:980: in function 'refresh_vendor'
2022-01-16 16:23:31: ERROR[Main]: ...n64\minetest-5.4.1-win64\bin\..\mods\fancy_vend\init.lua:1398: in function <...n64\minetest-5.4.1-win64\bin\..\mods\fancy_vend\init.lua:1396>
2022-01-16 16:23:31: ACTION[Server]: singleplayer leaves game. List of players:
2022-01-16 16:23:31: ACTION[Main]: Server: Shutting down

Post Reply

Who is online

Users browsing this forum: No registered users and 34 guests