VendingManager

Utility for managing vending machines

Total Downloads: 1,959 - First Release: Feb 17, 2017 - Last Update: Apr 5, 2018

5/5, 9 likes
  1. The vending machine sell orders need a "currency item" in order to be added to the VM. So since blood bags aren't used anywhere else, you can use them as the currency item, and VendingManager knows to use Economics for those transactions. The quantity of blood bags is equal to the Economics money - so 1 blood bag = $1, 5=$5, etc.
     
  2. so we put in the sale order bloodbags, but the plugin will deduct the currency from economics instead ?
     
  3. Yes exactly. I wish there was a better way, but Rust needs that "currency" item for the sell orders :(
     
  4. Code:
    {
      "config": {
        "destroyOnUnload": false,
        "ejectLocks": false,
        "health": 500.0,
        "lockable": true,
        "lockFailureMessage": true,
        "saveLocks": true,
        "setHealth": true,
        "noBroadcast": true,
        "restricted": true,
        "useEconomics": true,
        "transactionTimeout": 300.0,
        "logTransSuccess": true,
        "logTransFailure": true
      },
      "resistances": {
        "Generic": 0.98,
        "Hunger": 0.0,
        "Thirst": 0.0,
        "Cold": 0.0,
        "Drowned": 0.0,
        "Heat": 1.0,
        "Bleeding": 0.0,
        "Poison": 0.0,
        "Suicide": 0.0,
        "Bullet": 0.9999,
        "Slash": 0.99,
        "Blunt": 0.99,
        "Fall": 0.0,
        "Radiation": 1.0,
        "Bite": 0.99,
        "Stab": 0.98,
        "Explosion": 0.3,
        "RadiationExposure": 0.0,
        "ColdExposure": 0.0,
        "Decay": 0.0,
        "ElectricShock": 0.0,
        "Arrow": 1.0
      },
      "templates": {
        "stone": {
          "entries": [
            {
              "itemToSellName": "stones",
              "itemToSellAmount": 100,
              "currencyName": "blood",
              "currencyAmountPerItem": 10
            }
          ]
        }
      }
    }

    ok got currency to set,
    set flag to bottomless - blood does not move from my inventory (tested)
    added sale order 100 stones for 10 blood
    saved sale order in template.

    no matter how much stock you put in the VM( I put in 1000 and then 6000 stone), you get the 100 ston in your inventory e but that stack in the VM disappears and only 1 stone is left. making the VM think its out of stock.

    I also got this error too each time I buy.. maybe this is making it have a problem ?

    (18:06:18) | Failed to call hook 'OnVendingTransaction' on plugin 'VendingManager v0.1.1' (NullReferenceException: Object reference not set to an instance of an object)

    (18:06:43) | Failed to call hook 'OnVendingTransaction' on plugin 'VendingManager v0.1.1' (NullReferenceException: Object reference not set to an instance of an object)

    (18:06:52) | Failed to call hook 'OnVendingTransaction' on plugin 'VendingManager v0.1.1' (NullReferenceException: Object reference not set to an instance of an object)


    Btw? can u change the way it saves those flags? like setting them would place the flag into the template itself ?

    before setting to bottomless.
     
  5. You don't need blood in your inventory to do the Economics transaction - it's done behind the scenes.

    I'll test out the stack clearing for Bottomless and see if I can replicate/resolve it... Did you have any other flags on the vending machine when you got that error?
     
  6. I don't think I had it set to anything when I got it. but i'll doublecheck

    Edit:
    When it was set to Bottomless it took all the inventory but 1, gave me mine and didn't give me an error
    When it had no flags at all... it left the inventory in there, gave me mine and I got the error.

    (18:41:01) | Failed to call hook 'OnVendingTransaction' on plugin 'VendingManager v0.1.1' (NullReferenceException: Object reference not set to an instance of an object)

    Economics transaction error possibly ?
     
    Last edited by a moderator: Mar 11, 2017
  7. ignignokt84 updated VendingManager with a new update entry:

    0.1.2

     
  8. ignignokt84 updated VendingManager with a new update entry:

    0.1.3


    [DOUBLEPOST=1489202110][/DOUBLEPOST]That should resolve your issues. Sorry about the multiple versions so close to each other but I found that second set of issues much quicker than I expected!
     
  9. Is it possible to use currency without receiving bloodbads even if they aren't taken from the player? because they don't stack... and will fill up the slots or does that matter ?
     
  10. You shouldn't be receiving any blood bags. They are just a placeholder in the sell order.
     
  11. ignignokt84 updated VendingManager with a new update entry:

    0.1.4

     
  12. Ok it works great now.

    Only thing is. Flags. When you load saved templates into the a new VM, it doesn't load the flags into that same VM, The config for Flags would have a long list of VM's Flags over time. Is there a way to delete and readd that same flag or flag set with the removal of old VM and loading of a new VM
     
  13. There currently isn't anything in place for this, but as I add flags I may readdress how flags are stored. They aren't stored on the sell order templates because they're not quite in the same scope, and it's easy to type /vm set Bottomless compared to entering sell orders.

    Also, incoming update - last one, I promise, and sorry about all these!
     
  14. ignignokt84 updated VendingManager with a new update entry:

    0.1.5

     
  15. I just don't want a big long list of ID's se t to flags that don't mean anything in the config. How much processing power does it take to go thru a long list of flags? will it affext the performance of the server if it gets too long ?

    n a side note: I love updates. keep em coming. with new stuff LOL
     
  16. It shouldn't have any impact at all. It's essentially negligible. Even with a few thousand entries, it's only loaded once when the plugin loads.

    Still, the list is necessary or the vending machines would lose all their flags on a restart or reload of VendingManager.
     
  17. ok. makes sence.. I'll have some questions for you in TruePVE here soon :) Stay Tuned if you can. LOL
     
  18. I note by installing the last version (0.1.5) that the transactions Economics work, to a "small" detail ready. The $ never fall !!! I get the goods but I do not lose a single $.
    In chat, the transaction message appears well, but the balance is always the same, no subtraction.
    An idea.

    Another question, will there be a way to use it upside down, ie that people can exchange trades into blood / $?

    Still thank you, and good job ^^
     
  19. You wouldn't happen to be purchasing from your own vending machine would you? Because if you are, the $ is transferring to yourself :)

    Yes, I should be able to make it possible to set up "buy" orders too, by using blood as selling item - I had thought about that previously, but I wanted to be sure the Economics transactions were stable first.
     
  20. I'm a idiot ^^

    Thanks !