Skip to content

Commit 7faed06

Browse files
Adds dynamic airlocks, a flexible mapping tool (#28852)
* move airlock controller defines to the right place * goddamnit * Adds dynamic airlocks, a flexible mapping tool * Apply suggestions from code review Co-authored-by: Luc <[email protected]> Signed-off-by: warriorstar-orion <[email protected]> * final as anythings * break some long comment lines * rebuild rust just in case --------- Signed-off-by: warriorstar-orion <[email protected]> Co-authored-by: Luc <[email protected]>
1 parent e8acea3 commit 7faed06

File tree

17 files changed

+389
-64
lines changed

17 files changed

+389
-64
lines changed

_maps/map_files/RandomRuins/SpaceRuins/druglab.dmm

Lines changed: 58 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,20 @@
2929
/area/ruin/space/methlab)
3030
"g" = (
3131
/obj/effect/decal/cleanable/blood,
32+
/obj/machinery/atmospherics/pipe/simple/visible{
33+
dir = 6
34+
},
3235
/turf/simulated/floor/plating,
3336
/area/ruin/space/methlab)
3437
"h" = (
3538
/obj/machinery/door/airlock/external{
3639
name = "Crackden Airlock"
3740
},
41+
/obj/machinery/atmospherics/pipe/simple/visible{
42+
dir = 8
43+
},
44+
/obj/machinery/access_button/offset/south,
45+
/obj/effect/map_effect/dynamic_airlock/door/interior,
3846
/turf/simulated/floor/plating,
3947
/area/ruin/space/methlab)
4048
"i" = (
@@ -48,6 +56,8 @@
4856
/obj/machinery/door/airlock/external{
4957
name = "Plain Airlock"
5058
},
59+
/obj/machinery/access_button/offset/southeast,
60+
/obj/effect/map_effect/dynamic_airlock/door/exterior,
5161
/turf/simulated/floor/plating,
5262
/area/ruin/space/methlab)
5363
"l" = (
@@ -93,15 +103,6 @@
93103
/obj/machinery/chem_master,
94104
/turf/simulated/floor/plating,
95105
/area/ruin/space/methlab)
96-
"s" = (
97-
/obj/effect/decal/cleanable/blood/oil,
98-
/turf/simulated/floor/plating,
99-
/area/ruin/space/methlab)
100-
"t" = (
101-
/obj/machinery/power/port_gen/pacman,
102-
/obj/structure/cable,
103-
/turf/simulated/floor/plating,
104-
/area/ruin/space/methlab)
105106
"u" = (
106107
/obj/machinery/chem_dispenser,
107108
/turf/simulated/floor/plating,
@@ -124,9 +125,49 @@
124125
/obj/machinery/kitchen_machine/microwave,
125126
/turf/simulated/floor/plating,
126127
/area/ruin/space/methlab)
128+
"A" = (
129+
/obj/item/grenade/chem_grenade/drugs,
130+
/obj/machinery/atmospherics/pipe/simple/visible,
131+
/turf/simulated/floor/plating,
132+
/area/ruin/space/methlab)
133+
"B" = (
134+
/obj/machinery/atmospherics/pipe/simple/visible{
135+
dir = 5
136+
},
137+
/turf/simulated/floor/plating,
138+
/area/ruin/space/methlab)
139+
"C" = (
140+
/obj/effect/decal/cleanable/blood/oil,
141+
/turf/simulated/floor/plating,
142+
/area/ruin/space/methlab)
127143
"K" = (
128144
/turf/simulated/mineral/random/high_chance/space,
129145
/area/ruin/space/methlab)
146+
"L" = (
147+
/obj/machinery/airlock_controller/air_cycler/directional/north,
148+
/obj/effect/map_effect/dynamic_airlock,
149+
/turf/simulated/floor/plating,
150+
/area/ruin/space/methlab)
151+
"M" = (
152+
/obj/machinery/atmospherics/unary/portables_connector{
153+
dir = 8
154+
},
155+
/obj/machinery/atmospherics/portable/canister/air,
156+
/turf/simulated/floor/plating,
157+
/area/ruin/space/methlab)
158+
"N" = (
159+
/obj/machinery/power/port_gen/pacman,
160+
/obj/structure/cable,
161+
/turf/simulated/floor/plating,
162+
/area/ruin/space/methlab)
163+
"Z" = (
164+
/obj/item/grenade/chem_grenade/drugs,
165+
/obj/machinery/atmospherics/unary/vent_pump/high_volume{
166+
dir = 8
167+
},
168+
/obj/effect/map_effect/dynamic_airlock,
169+
/turf/simulated/floor/plating,
170+
/area/ruin/space/methlab)
130171

131172
(1,1,1) = {"
132173
a
@@ -245,7 +286,7 @@ b
245286
d
246287
j
247288
j
248-
s
289+
C
249290
j
250291
j
251292
y
@@ -263,7 +304,7 @@ b
263304
e
264305
j
265306
p
266-
t
307+
N
267308
K
268309
K
269310
b
@@ -315,11 +356,11 @@ b
315356
b
316357
K
317358
g
318-
i
359+
A
360+
B
319361
j
320362
j
321-
j
322-
x
363+
q
323364
b
324365
a
325366
a
@@ -334,7 +375,7 @@ b
334375
b
335376
h
336377
b
337-
q
378+
M
338379
b
339380
b
340381
b
@@ -350,7 +391,7 @@ a
350391
a
351392
b
352393
b
353-
i
394+
Z
354395
b
355396
b
356397
b
@@ -368,7 +409,7 @@ a
368409
b
369410
b
370411
b
371-
j
412+
L
372413
b
373414
b
374415
b

code/__DEFINES/airlock_control_defines.dm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@
1212
// Airlock controller button modes
1313
#define MODE_INTERIOR "int"
1414
#define MODE_EXTERIOR "ext"
15+
16+
#define VENT_ID(_id_to_link) "[_id_to_link]_vent"
17+
#define EXT_DOOR_ID(_id_to_link) "[_id_to_link]_door_ext"
18+
#define INT_DOOR_ID(_id_to_link) "[_id_to_link]_door_int"
19+
#define EXT_BTN_ID(_id_to_link) "[_id_to_link]_btn_ext"
20+
#define INT_BTN_ID(_id_to_link) "[_id_to_link]_btn_int"

code/__DEFINES/mappers.dm

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,48 @@
1616
pixel_x = -offset_x; \
1717
}
1818

19+
#define BUTTON_HELPERS(path, offset_1, offset_2) \
20+
##path/offset/northwest {\
21+
dir = NORTHWEST; \
22+
pixel_x = -offset_2; \
23+
pixel_y = offset_1; \
24+
} \
25+
##path/offset/north {\
26+
dir = NORTH; \
27+
pixel_x = offset_2; \
28+
pixel_y = offset_1; \
29+
} \
30+
##path/offset/northeast {\
31+
dir = NORTHEAST; \
32+
pixel_x = offset_1; \
33+
pixel_y = offset_2; \
34+
} \
35+
##path/offset/east {\
36+
dir = EAST; \
37+
pixel_x = offset_1; \
38+
pixel_y = -offset_2; \
39+
} \
40+
##path/offset/southeast {\
41+
dir = SOUTHEAST; \
42+
pixel_x = offset_2; \
43+
pixel_y = -offset_1; \
44+
} \
45+
##path/offset/south {\
46+
dir = SOUTH; \
47+
pixel_x = -offset_2; \
48+
pixel_y = -offset_1; \
49+
} \
50+
##path/offset/southwest {\
51+
dir = SOUTHWEST; \
52+
pixel_x = -offset_1; \
53+
pixel_y = -offset_2; \
54+
} \
55+
##path/offset/west {\
56+
dir = WEST; \
57+
pixel_x = -offset_1; \
58+
pixel_y = offset_2; \
59+
}
60+
1961
// If we want to set custom offset to each cardinal direction
2062
#define MAPPING_DIRECTIONAL_HELPERS_CUSTOM(path, offset_north, offset_south, offset_east, offset_west) ##path/directional/north {\
2163
dir = NORTH; \

code/game/machinery/airlock_control/airlock_button.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ GLOBAL_LIST_EMPTY(all_airlock_access_buttons)
6767
controller_uid = C.UID()
6868
assigned_command = mode
6969

70+
BUTTON_HELPERS(/obj/machinery/access_button, 25, 7)

code/game/machinery/airlock_control/airlock_controllers.dm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747
/obj/machinery/airlock_controller/LateInitialize()
4848
for(var/obj/machinery/door/airlock/A in GLOB.airlocks)
4949
if(A.id_tag == int_door_link_id)
50-
interior_doors += A.UID()
50+
interior_doors |= A.UID()
5151
if(A.id_tag == ext_door_link_id)
52-
exterior_doors += A.UID()
52+
exterior_doors |= A.UID()
5353

5454
if(!length(interior_doors))
5555
stack_trace("[src] at [x],[y],[z] didnt setup any interior airlocks! Please double check the IDs!")
@@ -72,7 +72,6 @@
7272
if(!eb_setup)
7373
stack_trace("[src] at [x],[y],[z] didnt setup any exterior buttons! Please double check the IDs!")
7474

75-
7675
/obj/machinery/airlock_controller/attack_ghost(mob/user)
7776
ui_interact(user)
7877

@@ -415,3 +414,5 @@ send an additional command to open the door again.
415414
begin_cycle_in()
416415
if(MODE_EXTERIOR)
417416
begin_cycle_out()
417+
418+
MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airlock_controller/air_cycler, 25, 25)

code/game/objects/effects/spawners/airlock_spawner.dm

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ This spawner places pipe leading up to the interior door, you will need to finis
1111
#define DOOR_NORMAL_PLACEMENT 1
1212
#define DOOR_FLIPPED_PLACEMENT 2
1313

14-
#define VENT_ID "[id_to_link]_vent"
15-
#define EXT_DOOR_ID "[id_to_link]_door_ext"
16-
#define INT_DOOR_ID "[id_to_link]_door_int"
17-
#define EXT_BTN_ID "[id_to_link]_btn_ext"
18-
#define INT_BTN_ID "[id_to_link]_btn_int"
19-
2014
/obj/effect/spawner/airlock
2115
name = "1 by 1 airlock spawner (interior north, exterior south)"
2216
desc = "If you can see this, there's probably a missing airlock here. Better tell an admin and report this on the github."
@@ -95,17 +89,17 @@ This spawner places pipe leading up to the interior door, you will need to finis
9589
the_button.forceMove(get_step(the_button, NORTH))
9690

9791
/obj/effect/spawner/airlock/proc/handle_door_stuff(obj/machinery/door/airlock/A, is_this_an_interior_airlock) //This sets up the door vars correctly and then locks it before first use
98-
A.id_tag = is_this_an_interior_airlock ? INT_DOOR_ID : EXT_DOOR_ID
92+
A.id_tag = is_this_an_interior_airlock ? INT_DOOR_ID(id_to_link) : EXT_DOOR_ID(id_to_link)
9993
set_access_helper(A)
10094
A.name = door_name
10195
A.lock()
10296

10397
/obj/effect/spawner/airlock/proc/spawn_button(turf/T, some_direction, interior)
10498
var/obj/machinery/access_button/the_button = new(T)
10599
if(interior)
106-
the_button.autolink_id = INT_BTN_ID
100+
the_button.autolink_id = INT_BTN_ID(id_to_link)
107101
else
108-
the_button.autolink_id = EXT_BTN_ID
102+
the_button.autolink_id = EXT_BTN_ID(id_to_link)
109103

110104
switch(some_direction)
111105
if(NORTH)
@@ -127,11 +121,11 @@ This spawner places pipe leading up to the interior door, you will need to finis
127121
var/turf/T = get_turf(src)
128122
var/obj/machinery/airlock_controller/air_cycler/AC = new(T)
129123
set_access_helper(AC)
130-
AC.vent_link_id = VENT_ID
131-
AC.int_door_link_id = INT_DOOR_ID
132-
AC.ext_door_link_id = EXT_DOOR_ID
133-
AC.int_button_link_id = INT_BTN_ID
134-
AC.ext_button_link_id = EXT_BTN_ID
124+
AC.vent_link_id = VENT_ID(id_to_link)
125+
AC.int_door_link_id = INT_DOOR_ID(id_to_link)
126+
AC.ext_door_link_id = EXT_DOOR_ID(id_to_link)
127+
AC.int_button_link_id = INT_BTN_ID(id_to_link)
128+
AC.ext_button_link_id = EXT_BTN_ID(id_to_link)
135129
if(interior_direction != WEST && exterior_direction != WEST) //If west wall is free, place it there
136130
AC.pixel_x -= 25
137131
AC.pixel_y += 9
@@ -197,7 +191,7 @@ This spawner places pipe leading up to the interior door, you will need to finis
197191
A.on_construction(A.dir, initialization_directions ? initialization_directions : A.dir)
198192
if(istype(A, /obj/machinery/atmospherics/unary/vent_pump/high_volume))
199193
var/obj/machinery/atmospherics/unary/vent_pump/high_volume/created_pump = A
200-
created_pump.autolink_id = VENT_ID
194+
created_pump.autolink_id = VENT_ID(id_to_link)
201195

202196
/obj/effect/spawner/airlock/proc/set_access_helper(obj/I)
203197
var/obj/machinery/door/airlock/airlock = I
@@ -320,8 +314,3 @@ This spawner places pipe leading up to the interior door, you will need to finis
320314
#undef CHAMBER_BIGGER
321315
#undef DOOR_NORMAL_PLACEMENT
322316
#undef DOOR_FLIPPED_PLACEMENT
323-
#undef VENT_ID
324-
#undef EXT_DOOR_ID
325-
#undef INT_DOOR_ID
326-
#undef EXT_BTN_ID
327-
#undef INT_BTN_ID

0 commit comments

Comments
 (0)