now the pipes work too :)

This commit is contained in:
Ashleigh Carr
2018-07-29 18:37:25 +01:00
parent bf300cbf8b
commit 759570d92f
7 changed files with 30 additions and 13 deletions

View File

@@ -68,7 +68,7 @@
return level
/datum/map_template/proc/load(turf/T, centered = FALSE)
/datum/map_template/proc/load(turf/T, centered = FALSE, stationroom = FALSE) //yogs
if(centered)
T = locate(T.x - round(width/2) , T.y - round(height/2) , T.z)
if(!T)
@@ -78,7 +78,7 @@
if(T.y+height > world.maxy)
return
var/datum/parsed_map/parsed = maploader.load_map(file(mappath), T.x, T.y, T.z, cropMap=TRUE, no_changeturf=(SSatoms.initialized == INITIALIZATION_INSSATOMS), placeOnTop=TRUE)
var/datum/parsed_map/parsed = maploader.load_map(file(mappath), T.x, T.y, T.z, cropMap=TRUE, no_changeturf=(SSatoms.initialized == INITIALIZATION_INSSATOMS), placeOnTop=TRUE, stationroom = stationroom) //yogs
var/list/bounds = parsed?.bounds
if(!bounds)
return

View File

@@ -67,13 +67,13 @@ GLOBAL_DATUM_INIT(_preloader, /datum/map_preloader, new)
* 2) Read the map line by line, parsing the result (using parse_grid)
*
*/
/datum/maploader/load_map(dmm_file as file, x_offset as num, y_offset as num, z_offset as num, cropMap as num, measureOnly as num, no_changeturf as num, lower_crop_x as num, lower_crop_y as num, upper_crop_x as num, upper_crop_y as num, placeOnTop as num)
/datum/maploader/load_map(dmm_file as file, x_offset as num, y_offset as num, z_offset as num, cropMap as num, measureOnly as num, no_changeturf as num, lower_crop_x as num, lower_crop_y as num, upper_crop_x as num, upper_crop_y as num, placeOnTop as num, stationroom as num) //YOGS
//How I wish for RAII
Master.StartLoadingMap()
#ifdef TESTING
turfsSkipped = 0
#endif
. = load_map_impl(dmm_file, x_offset, y_offset, z_offset, cropMap, measureOnly, no_changeturf, lower_crop_x, upper_crop_x, lower_crop_y, upper_crop_y, placeOnTop)
. = load_map_impl(dmm_file, x_offset, y_offset, z_offset, cropMap, measureOnly, no_changeturf, lower_crop_x, upper_crop_x, lower_crop_y, upper_crop_y, placeOnTop, stationroom = stationroom) //yogs
#ifdef TESTING
if(turfsSkipped)
testing("Skipped loading [turfsSkipped] default turfs")
@@ -152,7 +152,7 @@ GLOBAL_DATUM_INIT(_preloader, /datum/map_preloader, new)
bounds[MAP_MAXX] = CLAMP(max(bounds[MAP_MAXX], cropMap ? min(maxx, world.maxx) : maxx), x_lower, x_upper)
CHECK_TICK
/datum/maploader/proc/load_map_impl(dmm_file, x_offset, y_offset, z_offset, cropMap, measureOnly, no_changeturf, x_lower = -INFINITY, x_upper = INFINITY, y_lower = -INFINITY, y_upper = INFINITY, placeOnTop = FALSE)
/datum/maploader/proc/load_map_impl(dmm_file, x_offset, y_offset, z_offset, cropMap, measureOnly, no_changeturf, x_lower = -INFINITY, x_upper = INFINITY, y_lower = -INFINITY, y_upper = INFINITY, placeOnTop = FALSE, stationroom = FALSE) //yogs
var/tfile = dmm_file//the map file we're creating
if(isfile(tfile))
tfile = file2text(tfile)
@@ -211,7 +211,7 @@ GLOBAL_DATUM_INIT(_preloader, /datum/map_preloader, new)
var/list/cache = modelCache[model_key]
if(!cache)
CRASH("Undefined model key in DMM: [model_key]")
build_coordinate(cache, gset.xcrd, gset.ycrd, gset.zcrd, no_afterchange, placeOnTop)
build_coordinate(cache, gset.xcrd, gset.ycrd, gset.zcrd, no_afterchange, placeOnTop, stationroom = stationroom) //yogs
#ifdef TESTING
else
++turfsSkipped
@@ -307,7 +307,7 @@ GLOBAL_DATUM_INIT(_preloader, /datum/map_preloader, new)
.[model_key] = list(members, members_attributes)
/datum/maploader/proc/build_coordinate(list/model, xcrd as num, ycrd as num, zcrd as num, no_changeturf as num, placeOnTop as num)
/datum/maploader/proc/build_coordinate(list/model, xcrd as num, ycrd as num, zcrd as num, no_changeturf as num, placeOnTop as num, stationroom = FALSE)
var/index
var/list/members = model[1]
var/list/members_attributes = model[2]
@@ -361,7 +361,7 @@ GLOBAL_DATUM_INIT(_preloader, /datum/map_preloader, new)
//finally instance all remainings objects/mobs
for(index in 1 to first_turf_index-1)
instance_atom(members[index],members_attributes[index],crds,no_changeturf,placeOnTop)
instance_atom(members[index],members_attributes[index],crds,no_changeturf,placeOnTop, stationroom = stationroom) //yogs
//Restore initialization to the previous value
SSatoms.map_loader_stop()
@@ -370,7 +370,7 @@ GLOBAL_DATUM_INIT(_preloader, /datum/map_preloader, new)
////////////////
//Instance an atom at (x,y,z) and gives it the variables in attributes
/datum/maploader/proc/instance_atom(path,list/attributes, turf/crds, no_changeturf, placeOnTop)
/datum/maploader/proc/instance_atom(path,list/attributes, turf/crds, no_changeturf, placeOnTop, stationroom = FALSE) //yogs
GLOB._preloader.setup(attributes, path)
if(crds)
@@ -382,7 +382,7 @@ GLOBAL_DATUM_INIT(_preloader, /datum/map_preloader, new)
else
. = create_atom(path, crds)//first preloader pass
else
. = create_atom(path, crds)//first preloader pass
. = create_atom(path, crds, stationroom = stationroom)//first preloader pass //yogs
if(GLOB.use_preloader && .)//second preloader pass, for those atoms that don't ..() in New()
GLOB._preloader.load(.)