Thread Rating:
  • 3 Vote(s) - 4.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Feature] Restocking Vending machines
#1
Created a whole bunch of vending machine restocking cartridges that can be ordered from the QM. A lot of people have suggested something similar, I was looking through old threads and came across one about this, but I forget where it is now, most recently I saw that Frank Stein suggested something like this, well here it is.

Not much to it, use the cartridge on the corresponding vending machine and it will set all of the items in it back to default amounts. 

It's completely functional, the only thing is that it might need QM prices/amounts tweaking and I don't have any individual sprites for it. Was going to make a sprite request for it, but I'll do it after this post. 

https://github.com/goonstation/goonstation-2016/pull/62
Reply
#2
I don't think the all-purpose refill unit would be compatible with any vending machine right now since you don't have any code to handle the special situation where W:vendingType is "all".

Also, just a suggestion based on what I've been told and have experienced while making patches.

You might want to change

Code:
    if (istype(W, /obj/item/vending/restock_cartridge))
        //check if cartridge type matches the vending machine
        if (istype(src, text2path("/obj/machinery/vending/[W:vendingType]")))

to something like

Code:
    if (istype(W, /obj/item/vending/restock_cartridge))
        //check if cartridge type matches the vending machine
        var/obj/item/vending/restock_cartridge/Q = W
        if (istype(src, text2path("/obj/machinery/vending/[Q.vendingType]")))

Or something along those lines.

In general, avoid using : unless you absolutely have to.
Reply
#3
Thanks for the reply. You're right the 'All-Purpose Cartridge" didn't work. I actually never wanted it to, and was just using it as a parent type for all the varieties so after I made it I forgot about it. An all purpose cartridge really flies in the face of making all the varieties to begin with so I didn't want one. I've just changed the name to be an empty cartridge now so it's clear that it has no interaction with vending machines.

Also about not using ':', I made that change as well. I just don't like having to do that extra initialization for a temp variable only used once, I personally like ':'.
Reply
#4
(05-29-2018, 06:05 PM)kyle2143 Wrote: Also about not using ':', I made that change as well. I just don't like having to do that extra initialization for a temp variable only used once, I personally like ':'.

please no : thank
Reply
#5
LovelyMimic made some fantastic sprites for all the usable cartridges and I just added them to the patch. Everything is good to go now.

https://forum.ss13.co/showthread.php?tid=10582

https://github.com/goonstation/goonstati...62/commits
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)