forked from Aurorastation/Aurora.3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvending.dm
81 lines (73 loc) · 2.2 KB
/
vending.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/datum/wires/vending
proper_name = "Vending Machine"
holder_type = /obj/machinery/vending
/datum/wires/vending/New()
wires = list(
WIRE_THROW,
WIRE_CONTRABAND,
WIRE_SHOCK,
WIRE_IDSCAN,
WIRE_COOLING,
WIRE_HEATING
)
..()
/datum/wires/vending/blueprint
cares_about_holder = FALSE
/datum/wires/vending/interactable(mob/user)
if(!..())
return FALSE
var/obj/machinery/vending/V = holder
if(V.panel_open)
return TRUE
return FALSE
/datum/wires/vending/get_status()
var/obj/machinery/vending/V = holder
. += ..()
. += "The orange light is [V.seconds_electrified ? "off" : "on"]."
. += "The red light is [V.shoot_inventory ? "off" : "blinking"]."
. += "The green light is [(V.categories & CAT_HIDDEN) ? "on" : "off"]."
. += "The [V.scan_id ? "purple" : "yellow"] light is on."
. += "The cyan light is [V.temperature_setting == -1 ? "on" : "off"]."
. += "The blue light is [V.temperature_setting == 1 ? "on" : "off"]."
/datum/wires/vending/on_pulse(wire)
var/obj/machinery/vending/V = holder
switch(wire)
if(WIRE_THROW)
V.shoot_inventory = !V.shoot_inventory
if(WIRE_CONTRABAND)
V.categories ^= CAT_HIDDEN
if(WIRE_SHOCK)
V.seconds_electrified = 30
if(WIRE_IDSCAN)
V.scan_id = !V.scan_id
if(WIRE_COOLING)
V.temperature_setting = V.temperature_setting != -1 ? -1 : 0
if(WIRE_HEATING)
V.temperature_setting = V.temperature_setting != 1 ? 1 : 0
/datum/wires/vending/on_cut(wire, mend, source)
var/obj/machinery/vending/V = holder
switch(wire)
if(WIRE_THROW)
V.shoot_inventory = !mend
if(WIRE_CONTRABAND)
V.categories &= ~CAT_HIDDEN
if(WIRE_SHOCK)
if(mend)
V.seconds_electrified = 0
else
V.seconds_electrified = -1
if(WIRE_IDSCAN)
V.scan_id = 1
if(WIRE_COOLING)
V.temperature_setting = mend && V.temperature_setting != 1 ? -1 : 0
if(WIRE_HEATING)
V.temperature_setting = mend && V.temperature_setting != -1 ? 1 : 0
/datum/wires/vending/get_wire_diagram(var/mob/user)
var/dat = ""
for(var/color in colors)
if(is_dud_color(color))
continue
dat += "<font color='[color]'>[capitalize(color)]</font>: [get_wire(color)]<br>"
var/datum/browser/wire_win = new(user, "vendingwires", "Vending Wires", 450, 500)
wire_win.set_content(dat)
wire_win.open()