Base functional CODE

This commit is contained in:
Kugamo
2020-11-06 22:55:32 -06:00
parent 540107bfd2
commit cc741c2ed3
+28 -8
View File
@@ -21,6 +21,7 @@
var/list/ticket_holders = list()
var/list/tickets = list()
var/id = 1
var/disabled = FALSE //used to ID card disable/enable ticket dispensing
/obj/machinery/ticket_machine/Destroy()
for(var/obj/item/ticket_machine_ticket/ticket in tickets)
@@ -102,14 +103,17 @@
handle_maptext()
/obj/machinery/ticket_machine/proc/handle_maptext()
switch(ticket_number) //This is here to handle maptext offsets so that the numbers align.
if(0 to 9)
maptext_x = 13
if(10 to 99)
maptext_x = 10
if(100)
maptext_x = 8
maptext = "<font face='Small Fonts'>[ticket_number]</font>"
if(disabled)
maptext = ""
else
switch(ticket_number) //This is here to handle maptext offsets so that the numbers align.
if(0 to 9)
maptext_x = 13
if(10 to 99)
maptext_x = 10
if(100)
maptext_x = 8
maptext = "<font face='Small Fonts'>[ticket_number]</font>"
/obj/machinery/ticket_machine/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/hand_labeler_refill))
@@ -130,6 +134,15 @@
max_number = initial(max_number)
update_icon()
return
else if(istype(I, /obj/item/card/id))
var/obj/item/card/id/heldID = I
if(ACCESS_HOP in heldID.access)
disabled = !disabled
to_chat(user, "<span class='notice'>You [disabled ? "disable" : "enable"] the ticket machine, it will [disabled ? "no longer" : "now"] dispense tickets!</span>")
handle_maptext()
return
else
to_chat(user, "<span class='warning'>You do not have the required access to disable the ticket machine.</span>")
else
return ..()
@@ -141,6 +154,9 @@
if(!ready)
to_chat(user,"<span class='warning'>You press the button, but nothing happens...</span>")
return
if(disabled)
to_chat(user, "<span class='warning'>The ticket machine has been disabled.</span>")
return
if(ticket_number >= max_number)
to_chat(user,"<span class='warning'>Ticket supply depleted, please refill this unit with a hand labeller refill cartridge!</span>")
return
@@ -172,6 +188,10 @@
/obj/machinery/ticket_machine/attack_ai(mob/user)
return
/obj/machinery/ticket_machine/examine(mob/user)
. = ..()
. += "<span class='info'>Use an ID card with HOP access on this machine to [disabled ? "enable":"disable"] ticket dispensing.</span>"
/obj/item/ticket_machine_ticket
name = "Ticket"
desc = "A ticket which shows your place in the Head of Personnel's line. Made from Nanotrasen patented NanoPaper. Though solid, its form seems to shimmer slightly. Feels (and burns) just like the real thing."