Utility for managing vending machines

Supported Games

VendingManager is a plugin which provides some tools for admins to help improve Vending Machine management. This includes the ability to save, load, and clear sales order templates (which are saved to the config file), as well as enable locking vending machine inventory access again.

Chat commands

effect is applied to vending machine being looked at

All chat commands preceded by /vm, e.g. /vm save MyMachine confirm

Commands

  • save [name] confirm: Save the sales orders of the vending machine as template named name. If a template already exists with that name, adding confirm to the command will overwrite it. (Note: Saving the machine config this way is critical.)
  • load [name]: Load the sales orders from the specified template [name] into the vending machine. This will replace all existing sales orders in the vending machine.
  • add [name]: Adds the sales orders from the specified template [name] into the vending machine. This will append to the existing sales orders in the vending machine. Note: Max sales orders is normally limited to 7 by Rust, but that limit is not enforced by this plugin.
  • clear: Clears all existing sales orders from the vending machine
  • resetconfirm: Clears all saved templates and resets the plugin configuration to default values - requires confirm to be entered as a parameter
  • list: Prints out a list of all available templates - for template details, it's recommended you look at the config. Sales order items are now stored as their item shortname.
  • eject: Ejects all locks from vending machines
  • info: Displays details of the Vending Machine being looked at
  • set [flag]: Sets a flag on the Vending Machine being looked at
  • unset [flag]: Unsets a flag on the Vending Machine being looked at

Flags (case-sensitive):

  • Bottomless: Items don't get removed from the Vending Machine on purchase. but no payment is deposited/transferred (meant for admins) - This requires at least one of the selling item to be in the vending machine, but it's recommended to keep a full stack or players cannot purchase more than one at a time!
  • Immortal: Vending Machine cannot be damaged
  • Restricted: Only the owner can access the Vending Machine administration panel (same behavior as global option, but for a specific vending machine)
  • LogTransactions: Log all transactions (to /oxide/logs/VendingManager.log)

Configuration

Default configuration

{
  "config": {
    "currencyItem": "blood",
    "destroyOnUnload": false,
    "ejectLocks": false,
    "health": 1250.0,
    "lockable": true,
    "lockFailureMessage": true,
    "saveLocks": true,
    "setHealth": true,
    "noBroadcast": false,
    "restricted": false,
    "useEconomics": true,
    "useServerRewards": false,
    "transactionTimeout": 300.0,
    "logTransSuccess": true,
    "logTransFailure": true,
    "transMessages": true,
  },

Configuration items

  • currencyItem: Shortname of item to be used as currency - defaults to "blood"
  • destroyOnUnload: Destroy locks on plugin unload (saved locks are recreated on reload)
  • ejectLocks: Locks are ejected on plugin unload
  • health: Vending Machine health - defaults to 500.
  • lockable: Enable locks to be added to Vending Machines (default "true". The lock placement is validated, so players cannot place locks on vending machines they don't own unless they have access to the back panel. The owner can still place a lock from the front. Note: Unloading this plugin or setting "lockable = false" will not remove existing locks from vending machines, but will only prevent new locks from being attached.
  • lockFailureMessage: Whether to display a "failure" message when a player tries to attach a lock to a vending machine for which they do not have access.
  • saveLocks: Save locks and recreate them on server restart
  • setHealth: Enable Vending Machine health to be updated - Setting "false" skips setting health, in case you are using another plugin to manage deployable health.
  • noBroadcast: Prevents players from turning on broadcasting
  • restricted: Restricts admin panel access to Vending Machine owner
  • useEconomics: Enables use of Economics money for purchases (see below for details)
  • useServerRewards: Enables use of ServerRewards RP for purchases (see below for details)
  • transactionTimeout: Forcibly cancels player looting Vending Machines after so many seconds (no timeout if set to zero) - to reduce Economics calls
  • logTransSuccess: Log transaction successes to /oxide/logs/VendingManager.log
  • logTransFailure: Log transaction failures to /oxide/logs/VendingManager.log
  • transMessages: Send success messages to players after transaction

Economics / ServerRewards

Economics money or ServerRewards RP can be used when the currency item is used in a vending machine transaction - other items will use the normal Rust transaction behavior. Each currency item is $1 of Economics money or 1RP, so selling an item for 10 currency items translates to $10 in Economics money or 10RP if using ServerRewards.

In order to keep things mostly synchronized, VendingManager will check the player's current balance from Economics or ServerRewards in short intervals while the store interface is open. This also allows semi-realtime updating of the availability buttons. In order to reduce calls to Economics or ServerRewards in case (for example) a player decides to AFK with the VM store interface open, a configurable timeout [I]transactionTimeout[/I] is implemented that will automatically end looting after some time has elapsed. This can be set to zero to disable the timeout, but something like the default 300s (5m) should be more than enough to fight the lag monster without annoying legitimate VM patrons. Normally, you should be able to turn this off (set to zero), unless you have an unusually high player count, and lots of vending machines being used causing lag.

On purchase, the required money or RP will be transferred from the purchasing player to the owner of the vending machine or vice versa. If the vending machine is currently set as [I]Bottomless[/I] then the money is simply withdrawn from the purchasing player, or deposited to their account.

To enable Economics $ as currency, set configuration option useEconomics to true.

To enable ServerRewards RP as currency, set configuration option useServerRewards to true.

**Note! Enabling usage of both Economics and ServerRewards will forcibly select Economics as the currency! If you wish to use ServerRewards, you must set useEconomics to false.**

Resistances

Resistances can now be customized in the configuration json. If the resistances do not exist in the config when VendingManager loads, the default resistances for VendingMachines will be written to the config. Resistances are stored as a percentage, where 1.0 = 100% resistance, and 0.0 = 0% resistance. (Note: Still trying to figure out what resistances means here.)

Permissions

  • vendingmanager.canuse - Allows plugin access to non-admin players (admins have access by default)
  • vendingmanager.caneject - Allows a non-admin player to run the [I]eject[/I] command (not that you'd ever want that)

Admin notes

The configuration of each machine is generally saved to the main config file. At some point in the future this may be migrated to the data directory.

    MIT License


    Copyright (c) 2019 rfc1920


    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:


    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.


    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.


    Download

    1.0K downloads
    47 watchers

    imported