Merge pull request #309 from LetterJay/bleeding-edgy

updates maploader, fixes a few things
This commit is contained in:
LetterJay
2017-03-24 02:53:14 -04:00
committed by GitHub
17 changed files with 89 additions and 56 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
#ifndef ALL_MAPS
#include "map_files\generic\Fastload.dmm"
#include "map_files\generic\SpaceStation.dmm"
#include "map_files\generic\Centcomm.dmm"
#include "map_files\generic\Space.dmm"
#include "map_files\generic\SpaceDock.dmm"
+1 -1
View File
@@ -7,9 +7,9 @@
#include "map_files\CitadelStation\CitadelStation-1.2.1.dmm"
#include "map_files\generic\Centcomm.dmm"
#include "map_files\generic\Fastload.dmm"
#include "map_files\generic\Space.dmm"
#include "map_files\generic\SpaceDock.dmm"
#include "map_files\generic\SpaceStation.dmm"
#include "map_files\Mining\Lavaland.dmm"
+5 -5
View File
@@ -1609,7 +1609,7 @@
},
/area/mine/living_quarters)
"dm" = (
/turf/open/floor/bluegrid{
/turf/open/floor/circuit{
baseturf = /turf/open/floor/plating/lava/smooth/lava_land_surface
},
/area/mine/maintenance)
@@ -2329,7 +2329,7 @@
d2 = 4;
icon_state = "1-4"
},
/turf/open/floor/bluegrid{
/turf/open/floor/circuit{
baseturf = /turf/open/floor/plating/lava/smooth/lava_land_surface
},
/area/mine/maintenance)
@@ -2353,7 +2353,7 @@
/obj/machinery/atmospherics/pipe/simple/supply/hidden{
dir = 9
},
/turf/open/floor/bluegrid{
/turf/open/floor/circuit{
baseturf = /turf/open/floor/plating/lava/smooth/lava_land_surface
},
/area/mine/maintenance)
@@ -2363,7 +2363,7 @@
dir = 8;
network = list("MINE")
},
/turf/open/floor/bluegrid{
/turf/open/floor/circuit{
baseturf = /turf/open/floor/plating/lava/smooth/lava_land_surface
},
/area/mine/maintenance)
@@ -2747,7 +2747,7 @@
/obj/machinery/airalarm{
pixel_y = 24
},
/turf/open/floor/bluegrid{
/turf/open/floor/circuit{
baseturf = /turf/open/floor/plating/lava/smooth/lava_land_surface
},
/area/mine/maintenance)
+5 -10
View File
@@ -110,22 +110,18 @@ var/datum/controller/subsystem/mapping/SSmapping
if(last)
QDEL_NULL(loader)
/datum/controller/subsystem/mapping/proc/CreateSpace(zlevel)
while(world.maxz < zlevel)
CHECK_TICK
/datum/controller/subsystem/mapping/proc/CreateSpace(MaxZLevel)
while(world.maxz < MaxZLevel)
++world.maxz
CHECK_TICK
for(var/T in block(locate(1, 1, zlevel), locate(world.maxx, world.maxy, zlevel)))
CHECK_TICK
new /turf/open/space(T)
#define INIT_ANNOUNCE(X) to_chat(world, "<span class='boldannounce'>[X]</span>"); log_world(X)
/datum/controller/subsystem/mapping/proc/loadWorld()
//if any of these fail, something has gone horribly, HORRIBLY, wrong
var/list/FailedZs = list()
var/start_time = REALTIMEOFDAY
INIT_ANNOUNCE("Loading [config.map_name]...")
TryLoadZ(config.GetFullMapPath(), FailedZs, ZLEVEL_STATION)
INIT_ANNOUNCE("Loaded station in [(REALTIMEOFDAY - start_time)/10]s!")
@@ -133,8 +129,7 @@ var/datum/controller/subsystem/mapping/SSmapping
if(config.minetype != "lavaland")
INIT_ANNOUNCE("WARNING: A map without lavaland set as it's minetype was loaded! This is being ignored! Update the maploader code!")
for(var/I in (world.maxz + 1) to ZLEVEL_SPACEMAX)
CreateSpace(I)
CreateSpace(ZLEVEL_SPACEMAX)
if(LAZYLEN(FailedZs)) //but seriously, unless the server's filesystem is messed up this will never happen
var/msg = "RED ALERT! The following map files failed to load: [FailedZs[1]]"
+5
View File
@@ -17,6 +17,11 @@
light_power = 0.25
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
/turf/open/space/basic/New() //Do not convert to Initialize
//This is used to optimize the map loader
return
/turf/open/space/Initialize()
icon_state = SPACE_ICON_STATE
air = space_gas
+15 -1
View File
@@ -70,7 +70,7 @@
if(force)
..()
//this will completely wipe turf state
var/turf/basic/B = new /turf/basic(src)
var/turf/B = new world.turf(src)
for(var/A in B.contents)
qdel(A)
for(var/I in B.vars)
@@ -488,3 +488,17 @@
LAZYINITLIST(decals)
cut_overlay(decals[group])
decals[group] = null
/turf/proc/photograph(limit=20)
var/image/I = new()
I.overlays += src
for(var/V in contents)
var/atom/A = V
if(A.invisibility)
continue
I.overlays += A
if(limit)
limit--
else
return I
return I
+54 -26
View File
@@ -14,6 +14,10 @@ var/global/dmm_suite/preloader/_preloader = new
// /^[\s\n]+|[\s\n]+$/
var/static/regex/trimRegex = new/regex("^\[\\s\n]+|\[\\s\n]+$", "g")
var/static/list/modelCache = list()
var/static/space_key
#ifdef TESTING
var/static/turfsSkipped
#endif
/**
* Construct the model map and control the loading process
@@ -28,7 +32,15 @@ var/global/dmm_suite/preloader/_preloader = new
/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)
//How I wish for RAII
Master.StartLoadingMap()
space_key = null
#ifdef TESTING
turfsSkipped = 0
#endif
. = load_map_impl(dmm_file, x_offset, y_offset, z_offset, cropMap, measureOnly, no_changeturf)
#ifdef TESTING
if(turfsSkipped)
testing("Skipped loading [turfsSkipped] default turfs")
#endif
Master.StopLoadingMap()
/dmm_suite/proc/load_map_impl(dmm_file, x_offset, y_offset, z_offset, cropMap, measureOnly, no_changeturf)
@@ -81,6 +93,8 @@ var/global/dmm_suite/preloader/_preloader = new
continue
else
world.maxz = zcrd //create a new z_level if needed
if(!no_changeturf)
WARNING("Z-level expansion occurred without no_changeturf set, this may cause problems when /turf/AfterChange is called")
bounds[MAP_MINX] = min(bounds[MAP_MINX], xcrdStart)
bounds[MAP_MINZ] = min(bounds[MAP_MINZ], zcrd)
@@ -126,11 +140,16 @@ var/global/dmm_suite/preloader/_preloader = new
if(xcrd >= 1)
var/model_key = copytext(line, tpos, tpos + key_len)
if(!grid_models[model_key])
throw EXCEPTION("Undefined model key in DMM.")
parse_grid(grid_models[model_key], xcrd, ycrd, zcrd, no_changeturf || zexpansion)
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)
#ifdef TESTING
else
++turfsSkipped
#endif
CHECK_TICK
maxx = max(maxx, xcrd)
++xcrd
--ycrd
@@ -167,7 +186,7 @@ var/global/dmm_suite/preloader/_preloader = new
* 4) Instanciates the atom with its variables
*
*/
/dmm_suite/proc/parse_grid(model 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)
/*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.
@@ -228,6 +247,20 @@ var/global/dmm_suite/preloader/_preloader = new
CHECK_TICK
while(dpos != 0)
//check and see if we can just skip this turf
//So you don't have to understand this horrid statement, we can do this if
// 1. no_changeturf is set
// 2. the space_key isn't set yet
// 3. there are exactly 2 members
// 4. with no attributes
// 5. and the members are world.turf and world.area
// Basically, if we find an entry like this: "XXX" = (/turf/default, /area/default)
// We can skip calling this proc every time we see XXX
if(no_changeturf && !space_key && members.len == 2 && members_attributes.len == 2 && length(members_attributes[1]) == 0 && length(members_attributes[2]) == 0 && (world.area in members) && (world.turf in members))
space_key = model_key
return
modelCache[model] = list(members, members_attributes)
@@ -236,6 +269,7 @@ var/global/dmm_suite/preloader/_preloader = new
////////////////
//The next part of the code assumes there's ALWAYS an /area AND a /turf on a given tile
var/turf/crds = locate(xcrd,ycrd,zcrd)
//first instance the /area and remove it from the members list
index = members.len
@@ -244,7 +278,6 @@ var/global/dmm_suite/preloader/_preloader = new
_preloader.setup(members_attributes[index])//preloader for assigning set variables on atom creation
instance = locate(members[index])
var/turf/crds = locate(xcrd,ycrd,zcrd)
if(crds)
instance.contents.Add(crds)
@@ -262,26 +295,20 @@ var/global/dmm_suite/preloader/_preloader = new
//instanciate the first /turf
var/turf/T
if(members[first_turf_index] != /turf/template_noop)
T = instance_atom(members[first_turf_index],members_attributes[first_turf_index],xcrd,ycrd,zcrd,no_changeturf)
T = instance_atom(members[first_turf_index],members_attributes[first_turf_index],crds,no_changeturf)
if(T)
//if others /turf are presents, simulates the underlays piling effect
index = first_turf_index + 1
while(index <= members.len - 1) // Last item is an /area
var/underlay = T.appearance
T = instance_atom(members[index],members_attributes[index],xcrd,ycrd,zcrd,no_changeturf)//instance new turf
T = instance_atom(members[index],members_attributes[index],crds,no_changeturf)//instance new turf
T.underlays += underlay
index++
//finally instance all remainings objects/mobs
for(index in 1 to first_turf_index-1)
instance_atom(members[index],members_attributes[index],xcrd,ycrd,zcrd,no_changeturf)
//custom CHECK_TICK here because we don't want things created while we're sleeping to not initialize
if(TICK_CHECK)
SSatoms.map_loader_stop()
stoplag()
SSatoms.map_loader_begin()
instance_atom(members[index],members_attributes[index],crds,no_changeturf)
//Restore initialization to the previous value
SSatoms.map_loader_stop()
@@ -290,22 +317,23 @@ var/global/dmm_suite/preloader/_preloader = new
////////////////
//Instance an atom at (x,y,z) and gives it the variables in attributes
/dmm_suite/proc/instance_atom(path,list/attributes, x, y, z, no_changeturf)
var/atom/instance
/dmm_suite/proc/instance_atom(path,list/attributes, turf/crds, no_changeturf)
_preloader.setup(attributes, path)
var/turf/T = locate(x,y,z)
if(T)
if(crds)
if(!no_changeturf && ispath(path, /turf))
T.ChangeTurf(path, TRUE)
instance = T
. = crds.ChangeTurf(path, TRUE)
else
instance = new path (T)//first preloader pass
. = new path (crds)//first preloader pass
if(use_preloader && instance)//second preloader pass, for those atoms that don't ..() in New()
_preloader.load(instance)
if(use_preloader && .)//second preloader pass, for those atoms that don't ..() in New()
_preloader.load(.)
return instance
//custom CHECK_TICK here because we don't want things created while we're sleeping to not initialize
if(world.tick_usage > CURRENT_TICKLIMIT)
SSatoms.map_loader_stop()
stoplag()
SSatoms.map_loader_begin()
//text trimming (both directions) helper proc
//optionally removes quotes before and after the text (for variable name)
@@ -417,4 +445,4 @@ var/global/dmm_suite/preloader/_preloader = new
name = "Area Passthrough"
/turf/template_noop
name = "Turf Passthrough"
name = "Turf Passthrough"
+1 -9
View File
@@ -1,6 +1,6 @@
/world
mob = /mob/dead/new_player
turf = /turf/basic
turf = /turf/open/space/basic
area = /area/space
view = "15x15"
cache_lifespan = 7
@@ -40,7 +40,6 @@
load_mode()
load_motd()
load_admins()
load_mentors()
if(config.usewhitelist)
load_whitelist()
LoadBans()
@@ -105,13 +104,6 @@
s["revision"] = revdata.commit
s["revision_date"] = revdata.date
var/mentors = 0
for(var/client/C in clients)
var/mentor = mentor_datums[C.ckey]
if(mentor)
mentors++
s["mentors"] = mentors
var/list/adm = get_admin_counts()
var/list/presentmins = adm["present"]
var/list/afkmins = adm["afk"]
Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 KiB

+2 -3
View File
@@ -13,9 +13,9 @@
// END_PREFERENCES
// BEGIN_INCLUDE
#include "_maps\__MAP_DEFINES.dm"
#include "_maps\citadelstation.dm"
#include "_maps\basemap.dm"
#include "_maps\loadallmaps.dm"
#include "_maps\tgstation2.dm"
#include "code\_compile_options.dm"
#include "code\world.dm"
#include "code\__DATASTRUCTURES\heap.dm"
@@ -949,7 +949,6 @@
#include "code\game\objects\structures\transit_tubes\transit_tube.dm"
#include "code\game\objects\structures\transit_tubes\transit_tube_construction.dm"
#include "code\game\objects\structures\transit_tubes\transit_tube_pod.dm"
#include "code\game\turfs\basic.dm"
#include "code\game\turfs\closed.dm"
#include "code\game\turfs\open.dm"
#include "code\game\turfs\turf.dm"