forked from Sanerres/vgstation13
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoor_control.dm
208 lines (169 loc) · 4.57 KB
/
door_control.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/obj/machinery/door_control
name = "remote door-control"
desc = "It controls doors, remotely."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "doorctrl0"
desc = "A remote control-switch for a door."
power_channel = ENVIRON
var/id_tag = null
var/range = 10
var/normaldoorcontrol = 0
var/specialfunctions = 1
/*
Bitflag, 1= open
2= idscan,
4= bolts
8= shock
16= door safties
*/
var/exposedwires = 0
var/wires = 3
/*
Bitflag, 1=checkID
2=Network Access
*/
anchored = 1.0
use_power = 1
idle_power_usage = 2
active_power_usage = 4
ghost_read=0
ghost_write=0
machine_flags = EMAGGABLE | MULTITOOL_MENU
/obj/machinery/door_control/attack_ai(mob/user as mob)
src.add_hiddenprint(user)
if(wires & 2)
return src.attack_hand(user)
else
user << "Error, no route to host."
/obj/machinery/door_control/attack_paw(mob/user as mob)
return src.attack_hand(user)
/obj/machinery/door_control/emag(mob/user)
req_access = list()
req_one_access = list()
playsound(get_turf(src), "sparks", 100, 1)
/obj/machinery/door_control/attackby(obj/item/weapon/W, mob/user as mob)
..()
..()
/* For later implementation
if (istype(W, /obj/item/weapon/screwdriver))
{
if(wiresexposed)
icon_state = "doorctrl0"
wiresexposed = 0
else
icon_state = "doorctrl-open"
wiresexposed = 1
return
}
*/
if(istype(W, /obj/item/device/detective_scanner))
return
return src.attack_hand(user)
/obj/machinery/door_control/attack_hand(mob/user as mob)
src.add_fingerprint(usr)
if(stat & (NOPOWER|BROKEN))
return
if(!allowed(user) && (wires & 1))
user << "<span class='warning'>Access Denied</span>"
flick("doorctrl-denied",src)
return
use_power(5)
icon_state = "doorctrl1"
add_fingerprint(user)
if(normaldoorcontrol)
for(var/obj/machinery/door/airlock/D in range(range))
if(D.id_tag == src.id_tag)
spawn(0)
if(D)
if(D.density) D.open()
else D.close()
return
if(specialfunctions & IDSCAN)
D.aiDisabledIdScanner = !D.aiDisabledIdScanner
if(specialfunctions & BOLTS)
if(!D.isWireCut(4) && D.arePowerSystemsOn())
D.locked = !D.locked
D.update_icon()
if(specialfunctions & SHOCK)
D.secondsElectrified = D.secondsElectrified ? 0 : -1
if(specialfunctions & SAFE)
D.safe = !D.safe
else
for(var/obj/machinery/door/poddoor/M in poddoors)
if (M.id_tag == src.id_tag)
if (M.density)
spawn( 0 )
M.open()
return
else
spawn( 0 )
M.close()
return
spawn(15)
if(!(stat & NOPOWER))
icon_state = "doorctrl0"
/obj/machinery/door_control/power_change()
..()
if(stat & NOPOWER)
icon_state = "doorctrl-p"
else
icon_state = "doorctrl0"
/obj/machinery/door_control/change_area(oldarea, newarea)
..()
name = replacetext(name,oldarea,newarea)
/obj/machinery/driver_button/attack_ai(mob/user as mob)
src.add_hiddenprint(user)
return src.attack_hand(user)
/obj/machinery/driver_button/attack_paw(mob/user as mob)
return src.attack_hand(user)
/obj/machinery/driver_button/attackby(obj/item/weapon/W, mob/user as mob)
. = ..()
if(.)
return .
if(istype(W, /obj/item/device/detective_scanner))
return
if(istype(W, /obj/item/weapon/wrench))
playsound(get_turf(src), 'sound/items/Ratchet.ogg', 50, 1)
if(do_after(user, src, 30))
user << "<span class='notice'>You detach \the [src] from the wall.</span>"
new/obj/item/mounted/frame/driver_button(get_turf(src))
del(src)
return 1
return src.attack_hand(user)
/obj/machinery/driver_button/multitool_menu(var/mob/user, var/obj/item/device/multitool/P)
return {"
<ul>
<li>[format_tag("ID Tag","id_tag")]</li>
</ul>"}
/obj/machinery/driver_button/attack_hand(mob/user as mob)
src.add_fingerprint(usr)
if(stat & (NOPOWER|BROKEN))
return
if(active)
return
add_fingerprint(user)
use_power(5)
launch_sequence()
return
/obj/machinery/driver_button/proc/launch_sequence()
active = 1
icon_state = "launcheract"
for(var/obj/machinery/door/poddoor/M in poddoors)
if (M.id_tag == src.id_tag)
spawn()
M.open()
sleep(20)
for(var/obj/machinery/mass_driver/M in mass_drivers)
if(M.id_tag == src.id_tag)
M.drive()
sleep(50)
for(var/obj/machinery/door/poddoor/M in poddoors)
if (M.id_tag == src.id_tag)
spawn()
M.close()
return
icon_state = "launcherbtt"
active = 0
/obj/machinery/driver_button/change_area(oldarea, newarea)
..()
name = replacetext(name,oldarea,newarea)