/
shuttles.dm
211 lines (170 loc) · 5.91 KB
/
shuttles.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
/datum/map_template/shuttle
name = "Base Shuttle Template"
var/category
var/file_name
var/description
var/admin_notes
var/list/movement_force // If set, overrides default movement_force on shuttle
var/port_x_offset
var/port_y_offset
var/limit
var/cost
var/short_name
var/list/job_slots = list()
var/list/name_categories = list("GENERAL")
var/prefix = "SV"
/datum/map_template/shuttle/proc/prerequisites_met()
return TRUE
/datum/map_template/shuttle/New(path, rename, cache)
if(path)
mappath = path
else
mappath = "_maps/shuttles/[category]/[file_name].dmm"
. = ..()
/datum/map_template/shuttle/preload_size(path, cache)
. = ..(path, TRUE) // Done this way because we still want to know if someone actualy wanted to cache the map
if(!cached_map)
return
discover_port_offset()
if(!cache)
cached_map = null
/datum/map_template/shuttle/proc/discover_port_offset()
var/key
var/list/models = cached_map.grid_models
for(key in models)
if(findtext(models[key], "[/obj/docking_port/mobile]")) // Yay compile time checks
break // This works by assuming there will ever only be one mobile dock in a template at most
for(var/datum/grid_set/gset as anything in cached_map.gridSets)
var/ycrd = gset.ycrd
for(var/line in gset.gridLines)
var/xcrd = gset.xcrd
for(var/j in 1 to length(line) step cached_map.key_len)
if(key == copytext(line, j, j + cached_map.key_len))
port_x_offset = xcrd
port_y_offset = ycrd
return
++xcrd
--ycrd
/datum/map_template/shuttle/load(turf/T, centered, register=TRUE)
. = ..()
if(!.)
return
var/list/turfs = block( locate(.[MAP_MINX], .[MAP_MINY], .[MAP_MINZ]),
locate(.[MAP_MAXX], .[MAP_MAXY], .[MAP_MAXZ]))
for(var/turf/place as anything in turfs)
if(istype(place, /turf/open/space)) // This assumes all shuttles are loaded in a single spot then moved to their real destination.
continue
if(length(place.baseturfs) < 2) // Some snowflake shuttle shit
continue
var/list/sanity = place.baseturfs.Copy()
sanity.Insert(3, /turf/baseturf_skipover/shuttle) //The first two are the "real" baseturfs, place above these but below plating.
place.baseturfs = baseturfs_string_list(sanity, place)
for(var/obj/docking_port/mobile/port in place)
if(register)
port.register()
if(isnull(port_x_offset))
continue
switch(port.dir) // Yeah this looks a little ugly but mappers had to do this in their head before
if(NORTH)
port.width = width
port.height = height
port.dwidth = port_x_offset - 1
port.dheight = port_y_offset - 1
if(EAST)
port.width = height
port.height = width
port.dwidth = height - port_y_offset
port.dheight = port_x_offset - 1
if(SOUTH)
port.width = width
port.height = height
port.dwidth = width - port_x_offset
port.dheight = height - port_y_offset
if(WEST)
port.width = height
port.height = width
port.dwidth = port_y_offset - 1
port.dheight = width - port_x_offset
port.load(src)
//Whatever special stuff you want
/datum/map_template/shuttle/proc/post_load(obj/docking_port/mobile/M)
if(movement_force)
M.movement_force = movement_force.Copy()
/// Shiptest-specific main maps. Do not make subtypes! Make a json in /_maps/configs/ instead.
/datum/map_template/shuttle/shiptest
category = "shiptest"
/datum/map_template/shuttle/custom
job_slots = list(new /datum/job/assistant = 5) // There will already be a captain, probably!
file_name = "custom_shuttle" // Dummy
/// Mining shuttles
/datum/map_template/shuttle/mining
category = "mining"
/datum/map_template/shuttle/mining/kilo
file_name = "mining_kilo"
name = "mining shuttle (Kilo)"
/datum/map_template/shuttle/mining/large
file_name = "mining_large"
name = "mining shuttle (Large)"
/// Syndicate Infiltrator variants
/datum/map_template/shuttle/infiltrator
category = "infiltrator"
/datum/map_template/shuttle/infiltrator/basic
file_name = "infiltrator_basic"
name = "basic syndicate infiltrator"
/datum/map_template/shuttle/infiltrator/advanced
file_name = "infiltrator_advanced"
name = "advanced syndicate infiltrator"
/// Aux base templates
/datum/map_template/shuttle/aux_base
category = "aux_base"
/datum/map_template/shuttle/aux_base/default
file_name = "aux_base_default"
name = "auxilliary base (Default)"
/datum/map_template/shuttle/aux_base/small
file_name = "aux_base_small"
name = "auxilliary base (Small)"
/// Pirate ship templates
/datum/map_template/shuttle/pirate
category = "pirate"
/datum/map_template/shuttle/pirate/default
file_name = "pirate_default"
name = "pirate ship (Default)"
/// Fugitive hunter ship templates
/datum/map_template/shuttle/hunter
category = "hunter"
/datum/map_template/shuttle/hunter/space_cop
file_name = "hunter_space_cop"
name = "Police Spacevan"
/datum/map_template/shuttle/hunter/russian
file_name = "hunter_russian"
name = "Russian Cargo Ship"
/datum/map_template/shuttle/hunter/bounty
file_name = "hunter_bounty"
name = "Bounty Hunter Ship"
/// Shuttles to be loaded in ruins
/datum/map_template/shuttle/ruin
category = "ruin"
/datum/map_template/shuttle/ruin/caravan_victim
file_name = "ruin_caravan_victim"
name = "Small Freighter"
/datum/map_template/shuttle/ruin/pirate_cutter
file_name = "ruin_pirate_cutter"
name = "Pirate Cutter"
/datum/map_template/shuttle/ruin/syndicate_dropship
file_name = "ruin_syndicate_dropship"
name = "Syndicate Dropship"
/datum/map_template/shuttle/ruin/syndicate_fighter_shiv
file_name = "ruin_syndicate_fighter_shiv"
name = "Syndicate Fighter"
/datum/map_template/shuttle/ruin/solgov_exploration_pod
file_name = "ruin_solgov_exploration_pod"
name = "SolGov Exploration Pod"
/// Escape pod map templates
/datum/map_template/shuttle/escape_pod
category = "escape_pod"
/datum/map_template/shuttle/escape_pod/default
file_name = "escape_pod_default"
name = "escape pod (Default)"
/datum/map_template/shuttle/escape_pod/large
file_name = "escape_pod_large"
name = "escape pod (Large)"