Merge pull request #11825 from Ghommie/Ghommie-cit674
Little Holodeck refactor.
This commit is contained in:
@@ -63,23 +63,38 @@ GLOBAL_LIST_INIT(duplicate_forbidden_vars_by_type, typecacheof_assoc_list(list(
|
||||
|
||||
var/src_min_x = 99999
|
||||
var/src_min_y = 99999
|
||||
var/src_max_x = 0
|
||||
var/src_max_y = 0
|
||||
var/list/refined_src = new/list()
|
||||
|
||||
for (var/turf/T in turfs_src)
|
||||
for (var/i in turfs_src)
|
||||
var/turf/T = i
|
||||
src_min_x = min(src_min_x,T.x)
|
||||
src_min_y = min(src_min_y,T.y)
|
||||
for (var/turf/T in turfs_src)
|
||||
src_max_x = max(src_max_x,T.y)
|
||||
src_max_y = max(src_max_y,T.y)
|
||||
for (var/i in turfs_src)
|
||||
var/turf/T = i
|
||||
refined_src[T] = "[T.x - src_min_x].[T.y - src_min_y]"
|
||||
|
||||
var/trg_min_x = 99999
|
||||
var/trg_min_y = 99999
|
||||
var/trg_max_x = 0
|
||||
var/trg_max_y = 0
|
||||
var/list/refined_trg = new/list()
|
||||
|
||||
for (var/turf/T in turfs_trg)
|
||||
for (var/i in turfs_trg)
|
||||
var/turf/T = i
|
||||
trg_min_x = min(trg_min_x,T.x)
|
||||
trg_min_y = min(trg_min_y,T.y)
|
||||
for (var/turf/T in turfs_trg)
|
||||
refined_trg["[T.x - trg_min_x].[T.y - trg_min_y]"] = T
|
||||
trg_max_x = max(trg_max_x,T.y)
|
||||
trg_max_y = max(trg_max_y,T.y)
|
||||
|
||||
var/diff_x = round(((src_max_x - src_min_x) - (trg_max_x - trg_min_x))/2)
|
||||
var/diff_y = round(((src_max_y - src_min_y) - (trg_max_y - trg_min_y))/2)
|
||||
for (var/i in turfs_trg)
|
||||
var/turf/T = i
|
||||
refined_trg["[T.x - trg_min_x + diff_x].[T.y - trg_min_y + diff_y]"] = T
|
||||
|
||||
var/list/toupdate = new/list()
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
Holodeck Update
|
||||
|
||||
The on-station holodeck area is of type [holodeck_type].
|
||||
All subtypes of [program_type] are loaded into the program cache or emag programs list.
|
||||
All types found in GLOB.holodeck_areas_per_comp_type[src.type], generated on make_datum_references_lists(),
|
||||
are loaded into the program cache or emag programs list.
|
||||
Paths with their abstract_type variable equal to themselves will be skipped.
|
||||
|
||||
If init_program is null, a random program will be loaded on startup.
|
||||
If you don't wish this, set it to the offline program or another of your choosing.
|
||||
|
||||
@@ -12,7 +15,6 @@
|
||||
3) Create a new control console that uses those areas
|
||||
|
||||
Non-mapped areas should be skipped but you should probably comment them out anyway.
|
||||
The base of program_type will always be ignored; only subtypes will be loaded.
|
||||
*/
|
||||
|
||||
#define HOLODECK_CD 25
|
||||
@@ -35,7 +37,6 @@
|
||||
// Splitting this up allows two holodecks of the same size
|
||||
// to use the same source patterns. Y'know, if you want to.
|
||||
var/holodeck_type = /area/holodeck/rec_center // locate(this) to get the target holodeck
|
||||
var/program_type = /area/holodeck/rec_center // subtypes of this (but not this itself) are loadable programs
|
||||
|
||||
var/active = FALSE
|
||||
var/damaged = FALSE
|
||||
@@ -181,7 +182,7 @@
|
||||
return ..()
|
||||
|
||||
/obj/machinery/computer/holodeck/proc/generate_program_list()
|
||||
for(var/typekey in subtypesof(program_type))
|
||||
for(var/typekey in GLOB.holodeck_areas_prototypes[type])
|
||||
var/area/holodeck/A = GLOB.areas_by_type[typekey]
|
||||
if(!A || !A.contents.len)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user