Add pay button to vendors

This commit is contained in:
Markolie
2015-02-14 19:07:00 +01:00
parent 0f64c056bd
commit ba63ce5092
2 changed files with 37 additions and 16 deletions
+36 -16
View File
@@ -230,9 +230,21 @@
return // don't smack that machine with your 2 thalers
if(default_unfasten_wrench(user, W, time = 60))
return
if(istype(W, /obj/item/weapon/screwdriver) && anchored)
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
panel_open = !panel_open
user << "You [panel_open ? "open" : "close"] the maintenance panel."
overlays.Cut()
if(panel_open)
overlays += image(icon, "[initial(icon_state)]-panel")
nanomanager.update_uis(src) // Speaker switch is on the main UI, not wires UI
return
if(panel_open)
if(istype(W, /obj/item/device/multitool)||istype(W, /obj/item/weapon/wirecutters))
return attack_hand(user)
if(component_parts && istype(W, /obj/item/weapon/crowbar))
var/datum/data/vending_product/machine = product_records
for(var/datum/data/vending_product/machine_content in machine)
@@ -243,21 +255,7 @@
if(!machine_content.amount)
break
default_deconstruction_crowbar(W)
else if(istype(W, /obj/item/weapon/screwdriver) && anchored)
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
panel_open = !panel_open
user << "You [panel_open ? "open" : "close"] the maintenance panel."
overlays.Cut()
if(panel_open)
overlays += image(icon, "[initial(icon_state)]-panel")
nanomanager.update_uis(src) // Speaker switch is on the main UI, not wires UI
return
else if(istype(W, /obj/item/device/multitool)||istype(W, /obj/item/weapon/wirecutters))
if(panel_open)
attack_hand(user)
return
else if(istype(W, /obj/item/weapon/coin) && premium.len > 0)
if(istype(W, /obj/item/weapon/coin) && premium.len > 0)
user.drop_item()
W.loc = src
coin = W
@@ -477,7 +475,29 @@
usr << "\blue You remove the [coin] from the [src]"
coin = null
categories &= ~CAT_COIN
if (href_list["pay"])
if(currently_vending && vendor_account && !vendor_account.suspended)
if(istype(usr, /mob/living/carbon/human))
var/paid = 0
var/handled = 0
var/mob/living/carbon/human/H = usr
var/obj/item/weapon/card/card = null
if(istype(H.wear_id,/obj/item/weapon/card))
card = H.wear_id
paid = pay_with_card(card)
handled = 1
else if(istype(H.get_active_hand(), /obj/item/weapon/card))
card = H.get_active_hand()
paid = pay_with_card(card)
handled = 1
if(paid)
src.vend(currently_vending, usr)
return
else if(handled)
nanomanager.update_uis(src)
return // don't smack that machine with your 2 credits
if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))))
if ((href_list["vend"]) && (src.vend_ready) && (!currently_vending))
+1
View File
@@ -44,6 +44,7 @@
{{if data.message_err}} <span class='uiIcon16 icon-alert' ></span>{{/if}} {{:data.message}}
</div>
<div class='item'>
{{:helper.link('Pay', 'cart', {'pay' : 1})}}
{{:helper.link('Cancel', 'arrowreturn-1-w', {'cancelpurchase' : 1})}}
</div>
</div>