Merge branch 'master' of https://github.com/VOREStation/Polaris into sync-09272018

# Conflicts:
#	code/__defines/holomap.dm
#	code/__defines/mobs.dm
#	code/_helpers/icons.dm
#	code/_helpers/unsorted.dm
#	code/_onclick/hud/hud.dm
#	code/_onclick/item_attack.dm
#	code/controllers/Processes/supply.dm
#	code/controllers/subsystems/planets.dm
#	code/datums/supplypacks/munitions.dm
#	code/datums/supplypacks/science.dm
#	code/datums/supplypacks/security.dm
#	code/datums/supplypacks/supply.dm
#	code/game/area/Space Station 13 areas.dm
#	code/game/atoms_movable.dm
#	code/game/machinery/autolathe.dm
#	code/game/machinery/doors/door.dm
#	code/game/machinery/jukebox.dm
#	code/game/machinery/recharger.dm
#	code/game/machinery/vending.dm
#	code/game/mecha/equipment/tools/medical_tools.dm
#	code/game/mecha/equipment/weapons/weapons.dm
#	code/game/objects/items/devices/PDA/PDA.dm
#	code/game/objects/items/devices/megaphone.dm
#	code/game/objects/items/poi_items.dm
#	code/game/objects/items/weapons/implants/implantlanguage.dm
#	code/game/objects/items/weapons/storage/firstaid.dm
#	code/game/objects/items/weapons/tools/weldingtool.dm
#	code/game/objects/structures/flora/trees.dm
#	code/game/objects/structures/plasticflaps.dm
#	code/game/supplyshuttle.dm
#	code/game/turfs/simulated/wall_attacks.dm
#	code/modules/admin/admin_verbs.dm
#	code/modules/assembly/infrared.dm
#	code/modules/client/client procs.dm
#	code/modules/client/preference_setup/loadout/loadout_utility.dm
#	code/modules/client/preferences.dm
#	code/modules/clothing/suits/miscellaneous.dm
#	code/modules/holomap/holomap_datum.dm
#	code/modules/holomap/station_holomap.dm
#	code/modules/integrated_electronics/core/printer.dm
#	code/modules/mining/machine_processing.dm
#	code/modules/mob/living/carbon/human/human_defense.dm
#	code/modules/mob/living/carbon/human/species/virtual_reality/avatar.dm
#	code/modules/mob/living/death.dm
#	code/modules/mob/living/silicon/ai/ai.dm
#	code/modules/mob/living/silicon/pai/pai.dm
#	code/modules/mob/living/silicon/robot/robot.dm
#	code/modules/mob/living/simple_animal/animals/parrot.dm
#	code/modules/mob/mob_movement.dm
#	code/modules/organs/organ_external.dm
#	code/modules/organs/organ_icon.dm
#	code/modules/organs/subtypes/standard.dm
#	code/modules/planet/weather.dm
#	code/modules/power/cable.dm
#	code/modules/power/fusion/core/core_control.dm
#	code/modules/power/fusion/fuel_assembly/fuel_control.dm
#	code/modules/power/fusion/gyrotron/gyrotron_control.dm
#	code/modules/projectiles/gun.dm
#	code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm
#	config/names/first_name_skrell.txt
#	config/names/last_name_skrell.txt
#	icons/mob/head.dmi
#	icons/mob/robots.dmi
#	icons/mob/species/tajaran/helmet.dmi
#	icons/obj/ammo.dmi
#	icons/obj/gun.dmi
#	icons/obj/mining.dmi
#	icons/obj/projectiles.dmi
#	icons/obj/rig_modules.dmi
#	icons/obj/surgery.dmi
#	icons/turf/walls.dmi
#	maps/southern_cross/southern_cross-1.dmm
#	maps/southern_cross/southern_cross-3.dmm
#	maps/southern_cross/southern_cross-6.dmm
#	maps/southern_cross/southern_cross-8.dmm
#	maps/submaps/surface_submaps/mountains/backup/IceCave1.dmm
#	maps/submaps/surface_submaps/mountains/backup/IceCave1A.dmm
#	maps/submaps/surface_submaps/mountains/backup/IceCave1B.dmm
#	maps/submaps/surface_submaps/mountains/backup/IceCave1C.dmm
#	maps/submaps/surface_submaps/mountains/crashedcontainmentshuttle.dmm
#	maps/submaps/surface_submaps/mountains/deadspy.dmm
#	maps/submaps/surface_submaps/mountains/mountains_areas.dm
#	maps/submaps/surface_submaps/plains/Thiefc.dmm
#	maps/~map_system/maps.dm
#	vorestation.dme
This commit is contained in:
Arokha Sieyes
2018-09-27 18:01:09 -04:00
1318 changed files with 19791 additions and 86128 deletions

View File

@@ -37,8 +37,8 @@ var/list/global/map_templates = list()
if(rename)
name = rename
/datum/map_template/proc/preload_size(path)
var/bounds = maploader.load_map(file(path), 1, 1, 1, cropMap=FALSE, measureOnly=TRUE)
/datum/map_template/proc/preload_size(path, orientation = SOUTH)
var/bounds = maploader.load_map(file(path), 1, 1, 1, cropMap=FALSE, measureOnly=TRUE, orientation=orientation)
if(bounds)
width = bounds[MAP_MAXX] // Assumes all templates are rectangular, have a single Z level, and begin at 1,1,1
height = bounds[MAP_MAXY]
@@ -82,7 +82,7 @@ var/list/global/map_templates = list()
admin_notice("<span class='danger'>Submap initializations finished.</span>", R_DEBUG)
/datum/map_template/proc/load_new_z(var/centered = FALSE)
/datum/map_template/proc/load_new_z(var/centered = FALSE, var/orientation = SOUTH)
var/x = 1
var/y = 1
@@ -90,7 +90,7 @@ var/list/global/map_templates = list()
x = round((world.maxx - width)/2)
y = round((world.maxy - height)/2)
var/list/bounds = maploader.load_map(file(mappath), x, y, no_changeturf = TRUE)
var/list/bounds = maploader.load_map(file(mappath), x, y, no_changeturf = TRUE, orientation=orientation)
if(!bounds)
return FALSE
@@ -102,10 +102,10 @@ var/list/global/map_templates = list()
on_map_loaded(world.maxz) //VOREStation Edit
return TRUE
/datum/map_template/proc/load(turf/T, centered = FALSE)
/datum/map_template/proc/load(turf/T, centered = FALSE, orientation = SOUTH)
var/old_T = T
if(centered)
T = locate(T.x - round(width/2) , T.y - round(height/2) , T.z)
T = locate(T.x - round(((orientation & NORTH|SOUTH) ? width : height)/2) , T.y - round(((orientation & NORTH|SOUTH) ? height : width)/2) , T.z)
if(!T)
return
if(T.x+width > world.maxx)
@@ -114,9 +114,9 @@ var/list/global/map_templates = list()
return
if(annihilate)
annihilate_bounds(old_T, centered)
annihilate_bounds(old_T, centered, orientation)
var/list/bounds = maploader.load_map(file(mappath), T.x, T.y, T.z, cropMap=TRUE)
var/list/bounds = maploader.load_map(file(mappath), T.x, T.y, T.z, cropMap=TRUE, orientation = orientation)
if(!bounds)
return
@@ -130,18 +130,18 @@ var/list/global/map_templates = list()
loaded++
return TRUE
/datum/map_template/proc/get_affected_turfs(turf/T, centered = FALSE)
/datum/map_template/proc/get_affected_turfs(turf/T, centered = FALSE, orientation = SOUTH)
var/turf/placement = T
if(centered)
var/turf/corner = locate(placement.x - round(width/2), placement.y - round(height/2), placement.z)
var/turf/corner = locate(placement.x - round(((orientation & NORTH|SOUTH) ? width : height)/2), placement.y - round(((orientation & NORTH|SOUTH) ? height : width)/2), placement.z)
if(corner)
placement = corner
return block(placement, locate(placement.x+width-1, placement.y+height-1, placement.z))
return block(placement, locate(placement.x+((orientation & NORTH|SOUTH) ? width : height)-1, placement.y+((orientation & NORTH|SOUTH) ? height : width)-1, placement.z))
/datum/map_template/proc/annihilate_bounds(turf/origin, centered = FALSE)
/datum/map_template/proc/annihilate_bounds(turf/origin, centered = FALSE, orientation = SOUTH)
var/deleted_atoms = 0
admin_notice("<span class='danger'>Annihilating objects in submap loading locatation.</span>", R_DEBUG)
var/list/turfs_to_clean = get_affected_turfs(origin, centered)
var/list/turfs_to_clean = get_affected_turfs(origin, centered, orientation)
if(turfs_to_clean.len)
for(var/turf/T in turfs_to_clean)
for(var/atom/movable/AM in T)
@@ -152,9 +152,9 @@ var/list/global/map_templates = list()
//for your ever biggening badminnery kevinz000
//❤ - Cyberboss
/proc/load_new_z_level(var/file, var/name)
/proc/load_new_z_level(var/file, var/name, var/orientation = SOUTH)
var/datum/map_template/template = new(file, name)
template.load_new_z()
template.load_new_z(orientation)
// Very similar to the /tg/ version.
/proc/seed_submaps(var/list/z_levels, var/budget = 0, var/whitelist = /area/space, var/desired_map_template_type = null)
@@ -226,17 +226,19 @@ var/list/global/map_templates = list()
var/specific_sanity = 100 // A hundred chances to place the chosen submap.
while(specific_sanity > 0)
specific_sanity--
var/width_border = TRANSITIONEDGE + SUBMAP_MAP_EDGE_PAD + round(chosen_template.width / 2)
var/height_border = TRANSITIONEDGE + SUBMAP_MAP_EDGE_PAD + round(chosen_template.height / 2)
var/orientation = pick(cardinal)
chosen_template.preload_size(chosen_template.mappath, orientation)
var/width_border = TRANSITIONEDGE + SUBMAP_MAP_EDGE_PAD + round(((orientation & NORTH|SOUTH) ? chosen_template.width : chosen_template.height) / 2)
var/height_border = TRANSITIONEDGE + SUBMAP_MAP_EDGE_PAD + round(((orientation & NORTH|SOUTH) ? chosen_template.height : chosen_template.width) / 2)
var/z_level = pick(z_levels)
var/turf/T = locate(rand(width_border, world.maxx - width_border), rand(height_border, world.maxy - height_border), z_level)
var/valid = TRUE
for(var/turf/check in chosen_template.get_affected_turfs(T,1))
for(var/turf/check in chosen_template.get_affected_turfs(T,TRUE,orientation))
var/area/new_area = get_area(check)
if(!(istype(new_area, whitelist)))
valid = FALSE // Probably overlapping something important.
// world << "Invalid due to overlapping with area [new_area.type], when wanting area [whitelist]."
// world << "Invalid due to overlapping with area [new_area.type] at ([check.x], [check.y], [check.z]), when attempting to place at ([T.x], [T.y], [T.z])."
break
CHECK_TICK
@@ -245,10 +247,10 @@ var/list/global/map_templates = list()
if(!valid)
continue
admin_notice("Submap \"[chosen_template.name]\" placed at ([T.x], [T.y], [T.z])", R_DEBUG)
admin_notice("Submap \"[chosen_template.name]\" placed at ([T.x], [T.y], [T.z])\n", R_DEBUG)
// Do loading here.
chosen_template.load(T, centered = TRUE) // This is run before the main map's initialization routine, so that can initilize our submaps for us instead.
chosen_template.load(T, centered = TRUE, orientation=orientation) // This is run before the main map's initialization routine, so that can initilize our submaps for us instead.
CHECK_TICK

View File

@@ -35,7 +35,7 @@ var/global/use_preloader = FALSE
* 2) Read the map line by line, parsing the result (using parse_grid)
*
*/
/dmm_suite/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)
/dmm_suite/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, orientation as num)
//How I wish for RAII
if(!measureOnly)
Master.StartLoadingMap()
@@ -43,7 +43,7 @@ var/global/use_preloader = FALSE
#ifdef TESTING
turfsSkipped = 0
#endif
. = load_map_impl(dmm_file, x_offset, y_offset, z_offset, cropMap, measureOnly, no_changeturf)
. = load_map_impl(dmm_file, x_offset, y_offset, z_offset, cropMap, measureOnly, no_changeturf, orientation)
#ifdef TESTING
if(turfsSkipped)
testing("Skipped loading [turfsSkipped] default turfs")
@@ -51,7 +51,7 @@ var/global/use_preloader = FALSE
if(!measureOnly)
Master.StopLoadingMap()
/dmm_suite/proc/load_map_impl(dmm_file, x_offset, y_offset, z_offset, cropMap, measureOnly, no_changeturf)
/dmm_suite/proc/load_map_impl(dmm_file, x_offset, y_offset, z_offset, cropMap, measureOnly, no_changeturf, orientation)
var/tfile = dmm_file//the map file we're creating
if(isfile(tfile))
tfile = file2text(tfile)
@@ -63,6 +63,10 @@ var/global/use_preloader = FALSE
if(!z_offset)
z_offset = world.maxz + 1
// If it's not a single dir, default to north (Default orientation)
if(!orientation in cardinal)
orientation = SOUTH
var/list/bounds = list(1.#INF, 1.#INF, 1.#INF, -1.#INF, -1.#INF, -1.#INF)
var/list/grid_models = list()
var/key_len = 0
@@ -132,14 +136,71 @@ var/global/use_preloader = FALSE
bounds[MAP_MAXY] = max(bounds[MAP_MAXY], min(ycrd, world.maxy))
var/maxx = xcrdStart
// Assemble the grid of keys
var/list/key_list = list()
for(var/line in gridLines)
var/list/line_keys = list()
xcrd = 1
for(var/tpos = 1 to length(line) - key_len + 1 step key_len)
if(xcrd > world.maxx)
if(cropMap)
break
else
world.maxx = xcrd
if(xcrd >= 1)
var/model_key = copytext(line, tpos, tpos + key_len)
line_keys[++line_keys.len] = model_key
#ifdef TESTING
else
++turfsSkipped
#endif
CHECK_TICK
maxx = max(maxx, ++xcrd)
key_list[++key_list.len] = line_keys
// Rotate the list according to orientation
if(orientation != SOUTH)
var/num_cols = key_list[1].len
var/num_rows = key_list.len
var/list/new_key_list = list()
// If it's rotated 180 degrees, the dimensions are the same
if(orientation == NORTH)
new_key_list.len = num_rows
for(var/i = 1 to new_key_list.len)
new_key_list[i] = list()
new_key_list[i].len = num_cols
// Else, the dimensions are swapped
else
new_key_list.len = num_cols
for(var/i = 1 to new_key_list.len)
new_key_list[i] = list()
new_key_list[i].len = num_rows
num_rows++ // Buffering against the base index of 1
num_cols++
// Populate the new list
for(var/i = 1 to new_key_list.len)
for(var/j = 1 to new_key_list[i].len)
switch(orientation)
if(NORTH)
new_key_list[i][j] = key_list[num_rows - i][num_cols - j]
if(EAST)
new_key_list[i][j] = key_list[num_rows - j][i]
if(WEST)
new_key_list[i][j] = key_list[j][num_cols - i]
key_list = new_key_list
if(measureOnly)
for(var/line in gridLines)
maxx = max(maxx, xcrdStart + length(line) / key_len - 1)
for(var/list/line in key_list)
maxx = max(maxx, line.len)
else
for(var/line in gridLines)
for(var/i = 1 to key_list.len)
if(ycrd <= world.maxy && ycrd >= 1)
xcrd = xcrdStart
for(var/tpos = 1 to length(line) - key_len + 1 step key_len)
for(var/j = 1 to key_list[1].len)
if(xcrd > world.maxx)
if(cropMap)
break
@@ -147,12 +208,11 @@ var/global/use_preloader = FALSE
world.maxx = xcrd
if(xcrd >= 1)
var/model_key = copytext(line, tpos, tpos + key_len)
var/no_afterchange = no_changeturf || zexpansion
if(!no_afterchange || (model_key != space_key))
if(!grid_models[model_key])
throw EXCEPTION("Undefined model key in DMM.")
parse_grid(grid_models[model_key], model_key, xcrd, ycrd, zcrd, no_changeturf || zexpansion)
if(!no_afterchange || (key_list[i][j] != space_key))
if(!grid_models[key_list[i][j]])
throw EXCEPTION("Undefined model key in DMM: [dmm_file], [key_list[i][j]]")
parse_grid(grid_models[key_list[i][j]], key_list[i][j], xcrd, ycrd, zcrd, no_afterchange, orientation)
#ifdef TESTING
else
++turfsSkipped
@@ -194,7 +254,7 @@ var/global/use_preloader = FALSE
* 4) Instanciates the atom with its variables
*
*/
/dmm_suite/proc/parse_grid(model as text, model_key as text, xcrd as num,ycrd as num,zcrd as num, no_changeturf as num)
/dmm_suite/proc/parse_grid(model as text, model_key as text, xcrd as num,ycrd as num,zcrd as num, no_changeturf as num, orientation as num)
/*Method parse_grid()
- Accepts a text string containing a comma separated list of type paths of the
same construction as those contained in a .dmm file, and instantiates them.
@@ -248,6 +308,12 @@ var/global/use_preloader = FALSE
if(istext(value))
fields[I] = apply_text_macros(value)
// Rotate dir if orientation isn't south (default)
if(fields["dir"])
fields["dir"] = turn(fields["dir"], dir2angle(orientation) + 180)
else
fields["dir"] = turn(SOUTH, dir2angle(orientation) + 180)
//then fill the members_attributes list with the corresponding variables
members_attributes.len++
members_attributes[index++] = fields