-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathspace.dm
347 lines (285 loc) · 10.8 KB
/
space.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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
///The base color of light space emits
GLOBAL_VAR_INIT(base_starlight_color, default_starlight_color())
///The color of light space is currently emitting
GLOBAL_VAR_INIT(starlight_color, default_starlight_color())
/proc/default_starlight_color()
var/turf/open/space/read_from = /turf/open/space
return initial(read_from.light_color)
///The range of the light space is displaying
GLOBAL_VAR_INIT(starlight_range, default_starlight_range())
/proc/default_starlight_range()
var/turf/open/space/read_from = /turf/open/space
return initial(read_from.light_range)
///The power of the light space is throwin out
GLOBAL_VAR_INIT(starlight_power, default_starlight_power())
/proc/default_starlight_power()
var/turf/open/space/read_from = /turf/open/space
return initial(read_from.light_power)
/proc/set_base_starlight(star_color = null, range = null, power = null)
GLOB.base_starlight_color = star_color
set_starlight(star_color, range, power)
/proc/set_starlight(star_color = null, range = null, power = null)
if(isnull(star_color))
star_color = GLOB.starlight_color
var/old_star_color = GLOB.starlight_color
GLOB.starlight_color = star_color
// set light color on all lit turfs
for(var/turf/open/space/spess as anything in GLOB.starlight)
spess.set_light(l_range = range, l_power = power, l_color = star_color)
if(star_color == old_star_color)
return
// Update the base overlays
for(var/obj/light as anything in GLOB.starlight_objects)
light.color = star_color
// Send some signals that'll update everything that uses the color
SEND_GLOBAL_SIGNAL(COMSIG_STARLIGHT_COLOR_CHANGED, old_star_color, star_color)
GLOBAL_LIST_EMPTY(starlight)
/turf/open/space
icon = 'icons/turf/space.dmi'
icon_state = "0"
name = "\proper space"
overfloor_placed = FALSE
underfloor_accessibility = UNDERFLOOR_INTERACTABLE
initial_temperature = TCMB
thermal_conductivity = 0
heat_capacity = 700000
flammability = 0 // nuh uh
var/starlight_source_count = 0
var/destination_z
var/destination_x
var/destination_y
var/static/datum/gas_mixture/immutable/space/space_gas
// We do NOT want atmos adjacent turfs
//init_air = FALSE
//run_later = TRUE
plane = PLANE_SPACE
layer = SPACE_LAYER
light_power = 1
light_range = 2
light_color = COLOR_STARLIGHT
light_height = LIGHTING_HEIGHT_SPACE
light_on = FALSE
space_lit = TRUE
bullet_bounce_sound = null
vis_flags = VIS_INHERIT_ID //when this be added to vis_contents of something it be associated with something on clicking, important for visualisation of turf in openspace and interraction with openspace that show you turf.
force_no_gravity = TRUE
FASTDMM_PROP(\
pipe_astar_cost = 3\
)
/turf/open/space/basic/New() //Do not convert to Initialize
SHOULD_CALL_PARENT(FALSE)
//This is used to optimize the map loader
return
/turf/open/space/Destroy()
GLOB.starlight -= src
return ..()
//ATTACK GHOST IGNORING PARENT RETURN VALUE
/turf/open/space/attack_ghost(mob/dead/observer/user)
if(destination_z)
var/turf/T = locate(destination_x, destination_y, destination_z)
user.forceMove(T)
/turf/open/space/Initalize_Atmos(times_fired)
return
/turf/open/space/ignite_turf(power, fire_color)
return // no fire in space
/turf/open/space/extinguish_turf()
if(active_hotspot) // there's no actual fire in space, but space dragons and stuff can make fire effects which should be cleared
qdel(active_hotspot)
/turf/open/space/TakeTemperature(temp)
/turf/open/space/RemoveLattice()
return
/turf/open/space/AfterChange()
..()
atmos_overlay_types = null
/turf/open/space/Assimilate_Air()
return
//IT SHOULD RETURN NULL YOU MONKEY, WHY IN TARNATION WHAT THE FUCKING FUCK
/turf/open/space/remove_air(amount)
return null
/turf/open/space/remove_air_ratio(amount)
return null
//IT SHOULD RETURN NULL YOU MONKEY, WHY IN TARNATION WHAT THE FUCKING FUCK
/turf/open/space/remove_air(amount)
return null
/// Updates starlight. Called when we're unsure of a turf's starlight state
/// Returns TRUE if we succeed, FALSE otherwise
/turf/open/space/proc/update_starlight()
for(var/t in RANGE_TURFS(1, src)) //RANGE_TURFS is in code\__HELPERS\game.dm
// I've got a lot of cordons near spaceturfs, be good kids
if(isspaceturf(t) || istype(t, /turf/cordon))
//let's NOT update this that much pls
continue
enable_starlight()
return TRUE
GLOB.starlight -= src
set_light(l_on = FALSE)
return FALSE
/// Turns on the stars, if they aren't already
/turf/open/space/proc/enable_starlight()
if(!light_on)
set_light(l_on = TRUE, l_range = GLOB.starlight_range, l_power = GLOB.starlight_power, l_color = GLOB.starlight_color)
GLOB.starlight += src
/turf/open/space/attack_paw(mob/user, list/modifiers)
return attack_hand(user, modifiers)
/turf/open/space/proc/CanBuildHere()
if(destination_z)
return FALSE
return TRUE
/turf/open/space/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd)
switch(the_rcd.construction_mode)
if(RCD_FLOORWALL)
return list("mode" = RCD_FLOORWALL, "delay" = 0, "cost" = 3)
return FALSE
/turf/open/space/rcd_act(mob/user, obj/item/construction/rcd/the_rcd, passed_mode)
switch(passed_mode)
if(RCD_FLOORWALL)
to_chat(user, span_notice("You build a floor."))
place_on_top(/turf/open/floor/plating, flags = CHANGETURF_INHERIT_AIR)
return TRUE
return FALSE
/turf/open/space/handle_slip()
return
/turf/open/space/attackby(obj/item/C, mob/user, params)
..()
if(!CanBuildHere())
return
if(istype(C, /obj/item/stack/rods))
build_with_rods(C, user)
else if(istype(C, /obj/item/stack/tile/plasteel))
build_with_floor_tiles(C, user)
/turf/open/space/Entered(atom/movable/arrived, atom/old_loc, list/atom/old_locs)
. = ..()
if(!arrived || src != arrived.loc)
return
if(destination_z && destination_x && destination_y && !arrived.pulledby && !arrived.currently_z_moving)
var/tx = destination_x
var/ty = destination_y
var/turf/DT = locate(tx, ty, destination_z)
var/itercount = 0
while(DT.density || istype(DT.loc,/area/shuttle)) // Extend towards the center of the map, trying to look for a better place to arrive
if (itercount++ >= 100)
log_game("SPACE Z-TRANSIT ERROR: Could not find a safe place to land [arrived] within 100 iterations.")
break
if (tx < 128)
tx++
else
tx--
if (ty < 128)
ty++
else
ty--
DT = locate(tx, ty, destination_z)
arrived.zMove(null, DT, ZMOVE_ALLOW_BUCKLED)
var/atom/movable/current_pull = arrived.pulling
while (current_pull)
var/turf/target_turf = get_step(current_pull.pulledby.loc, REVERSE_DIR(current_pull.pulledby.dir)) || current_pull.pulledby.loc
current_pull.zMove(null, target_turf, ZMOVE_ALLOW_BUCKLED)
current_pull = current_pull.pulling
/turf/open/space/MakeSlippery(wet_setting, min_wet_time, wet_time_to_add, max_wet_time, permanent)
return
/turf/open/space/singularity_act()
return
/turf/open/space/can_have_cabling()
if(locate(/obj/structure/lattice/catwalk, src))
return TRUE
return FALSE
/turf/open/space/is_transition_turf()
if(destination_x || destination_y || destination_z)
return TRUE
/turf/open/space/acid_act(acidpwr, acid_volume)
return FALSE
/turf/open/space/get_smooth_underlay_icon(mutable_appearance/underlay_appearance, turf/asking_turf, adjacency_dir)
generate_space_underlay(underlay_appearance, asking_turf)
return TRUE
/turf/open/space/rust_heretic_act()
return FALSE
/turf/open/space/attempt_lattice_replacement()
var/dest_x = destination_x
var/dest_y = destination_y
var/dest_z = destination_z
..()
destination_x = dest_x
destination_y = dest_y
destination_z = dest_z
/turf/open/space/can_cross_safely(atom/movable/crossing)
return HAS_TRAIT(crossing, TRAIT_SPACEWALK)
/turf/open/space/openspace
icon = 'icons/turf/floors.dmi'
icon_state = MAP_SWITCH("pure_white", "invisible")
plane = TRANSPARENT_FLOOR_PLANE
/turf/open/space/openspace/Initialize(mapload) // handle plane and layer here so that they don't cover other obs/turfs in Dream Maker
. = ..()
if(PERFORM_ALL_TESTS(focus_only/openspace_clear) && !GET_TURF_BELOW(src))
stack_trace("[src] was inited as openspace with nothing below it at ([x], [y], [z])")
icon_state = "pure_white"
// We make the assumption that the space plane will never be blacklisted, as an optimization
if(SSmapping.max_plane_offset)
plane = TRANSPARENT_FLOOR_PLANE - (PLANE_RANGE * SSmapping.z_level_to_plane_offset[z])
return INITIALIZE_HINT_LATELOAD
/turf/open/space/openspace/LateInitialize()
. = ..()
AddElement(/datum/element/turf_z_transparency)
/turf/open/space/openspace/Destroy()
// Signals persist through destroy, GO HOME
var/turf/below = GET_TURF_BELOW(src)
if(below)
UnregisterSignal(below, COMSIG_TURF_CHANGE)
return ..()
/turf/open/space/openspace/zAirIn(direction, turf/source)
return TRUE
/turf/open/space/openspace/zAirOut(direction, turf/source)
return TRUE
/turf/open/space/openspace/zPassIn(direction)
if(direction == DOWN)
for(var/obj/contained_object in contents)
if(contained_object.obj_flags & BLOCK_Z_IN_DOWN)
return FALSE
return TRUE
if(direction == UP)
for(var/obj/contained_object in contents)
if(contained_object.obj_flags & BLOCK_Z_IN_UP)
return FALSE
return TRUE
return FALSE
/turf/open/space/openspace/zPassOut(direction)
if(direction == DOWN)
for(var/obj/contained_object in contents)
if(contained_object.obj_flags & BLOCK_Z_OUT_DOWN)
return FALSE
return TRUE
if(direction == UP)
for(var/obj/contained_object in contents)
if(contained_object.obj_flags & BLOCK_Z_OUT_UP)
return FALSE
return TRUE
return FALSE
/turf/open/space/openspace/enable_starlight()
var/turf/below = GET_TURF_BELOW(src)
// Override = TRUE beacuse we could have our starlight updated many times without a failure, which'd trigger this
RegisterSignal(below, COMSIG_TURF_CHANGE, PROC_REF(on_below_change), override = TRUE)
if(!isspaceturf(below) || light_on)
return
set_light(l_on = TRUE, l_range = GLOB.starlight_range, l_power = GLOB.starlight_power, l_color = GLOB.starlight_color)
GLOB.starlight += src
/turf/open/space/openspace/update_starlight()
. = ..()
if(.)
return
// If we're here, the starlight is not to be
var/turf/below = GET_TURF_BELOW(src)
UnregisterSignal(below, COMSIG_TURF_CHANGE)
/turf/open/space/openspace/proc/on_below_change(turf/source, path, list/new_baseturfs, flags, list/post_change_callbacks)
SIGNAL_HANDLER
if(isspaceturf(source) && !ispath(path, /turf/open/space))
GLOB.starlight += src
set_light(l_on = TRUE, l_range = GLOB.starlight_range, l_power = GLOB.starlight_power, l_color = GLOB.starlight_color)
else if(!isspaceturf(source) && ispath(path, /turf/open/space))
GLOB.starlight -= src
set_light(l_on = FALSE)
/turf/open/space/replace_floor(turf/open/new_floor_path, flags)
if (!initial(new_floor_path.overfloor_placed))
ChangeTurf(new_floor_path, flags = flags)
return
// Create plating under tiled floor we try to create directly onto space
place_on_top(/turf/open/floor/plating, flags = flags)
place_on_top(new_floor_path, flags = flags)