vgstation-coders / vgstation13

Butts
GNU General Public License v3.0
264 stars 543 forks source link

The "Pay" hotlink on vending machines no longer works with ID in hands. #17363

Closed SonixApache closed 6 years ago

SonixApache commented 6 years ago

Description of issue

IDnowork Clicking the Pay link with your ID in either of your hands should process payment. However, right now, clicking Pay without an ID in your ID slot doesn't do anything at all.

On a related note, you can no longer pay by clicking your ID on the machine itself, but that's more related to #17102.

Difference between expected and actual behavior

Hold ID in hand, click Pay, funds get deducted, I get coffee. vs Hold ID in hand, click Pay, nothing happens, machine waits for further input.

Steps to reproduce

Attempt to acquire a product from a paid vending machine, try to pay by using your card.

Specific information for locating

https://github.com/vgstation-coders/vgstation13/blob/Bleeding-Edge/code/game/machinery/vending.dm#L737

Length of time in which bug has been known to occur

Probably since the custom vending machine system (#15339), and it's probably related to #17102 and the ID card issues surrounding vending machines.

Server revision

0715cffed91239d5997051c7cc2ad3abc70de0a9

SonixApache commented 6 years ago
if(src.currently_vending)
    var/dat = "<TT><center><b>[vendorname]</b></center><hr /><br>" //display the name, and added a horizontal rule

    dat += {"<b>You have selected [currently_vending.product_name].<br>Please ensure your ID is in your ID holder or hand.</b><br>
        <a href='byond://?src=\ref[src];buy=1'>Pay</a> |
        <a href='byond://?src=\ref[src];cancel_buying=1'>Cancel</a>"}
    user << browse(dat, "window=vending")
    onclose(user, "")
    return
else if (href_list["buy"]) //scan_card
    var/obj/item/weapon/card/card = usr.get_id_card()
    if(card)
        connect_account(usr, card)
    else //I added this for debug, and it fires every time
        to_chat(usr, "<span class='warning'>Please present a valid ID.</span>")
    src.updateUsrDialog()
    return

so for some reason, usr.get_id_card() isn't finding the ID card held in a hand get_id_card() is

    for(var/obj/item/I in src.get_all_slots())
        . = I.GetID()
        if(.)
break

get_all_slots() checks return list(wear_mask, back) + held_items GetID, when called on an ID, returns the ID i dunno where the fug held_items is defined but it works on everything else so i doubt that's it

Pathid commented 6 years ago

Not always a trivial problem since it stops you from buying things without a jumpsuit on. Might actually predate #15339 but I can't say.