anchor.diff:  	to_chat(user, "<span class='notice'>You store linkage information in [I]'s buffer.</span>")
   	return TRUE
   
  -/obj/machinery/ticket_machine/emag_act(mob/user) //Emag the ticket machine to dispense burning tickets, as well as randomize its customer number to destroy the HOP's mind.
  +/obj/machinery/ticket_machine/emag_act(mob/user) //Emag the ticket machine to dispense burning tickets, as well as randomize its number to destroy the HoP's mind.
   	if(obj_flags & EMAGGED)
   		return
   	to_chat(user, "<span class='warning'>You overload [src]'s bureaucratic logic circuitry to its MAXIMUM setting.</span>")
  -	ticket_number = rand(0,999)
  +	ticket_number = rand(0,max_number)
  +	current_number = ticket_number
   	obj_flags |= EMAGGED
  +	if(tickets.len)
  +		for(var/obj/item/ticket_machine_ticket/ticket in tickets)
  +			ticket.visible_message("<span class='notice'>\the [ticket] disperses!</span>")
  +			qdel(ticket)
  +		tickets.Cut()
  +	update_icon()
   
   /obj/machinery/ticket_machine/Initialize()
   	. = ..()
  
positive.code: 	resistance_flags = FLAMMABLE
  	max_integrity = 50
  	var/saved_maptext = null
  
  /obj/item/ticket_machine_ticket/attack_hand(mob/user)
  	. = ..()
  
negative.code: 	if(current_number >= ticket_number)
  		return
  	playsound(src, 'sound/misc/announce_dig.ogg', 50, 0)
  	if(current_number && !(obj_flags & EMAGGED) && tickets[current_number])
  		tickets[current_number].visible_message("<span class='notice'>\the [tickets[current_number]] disperses!</span>")
  		qdel(tickets[current_number])
  	current_number ++ //Increment the one we're serving.
  	say("Now serving ticket #[current_number]!")
  	if(!(obj_flags & EMAGGED) && tickets[current_number])
  		tickets[current_number].visible_message("<span class='notice'>\the [tickets[current_number]] vibrates!</span>")
  	update_icon() //Update our icon here rather than when they take a ticket to show the current ticket number being served
  
  /obj/machinery/button/ticket_machine
  	name = "increment ticket counter"
  	desc = "Use this button after you've served someone to tell the next person to come forward."
  	device_type = /obj/item/assembly/control/ticket_machine
  	req_access = list()
  	id = "ticket_machine_default"
  