Map element stuff (#12909)

This commit is contained in:
unid15
2016-12-21 10:57:27 +01:00
committed by Probe1
parent ba44c91642
commit 554d34b814
6 changed files with 49 additions and 7 deletions

View File

@@ -24,11 +24,8 @@ var/list/datum/map_element/map_elements = list()
location = locate(/turf) in objects
//Build powernets
for(var/obj/structure/cable/C in objects)
if(C.powernet)
continue
C.rebuild_from()
for(var/atom/A in objects)
A.spawned_by_map_element(src, objects)
/datum/map_element/proc/load(x, y, z)
pre_load()

View File

@@ -800,3 +800,7 @@ its easier to just keep the beam vertical.
/atom/proc/animationBolt(var/mob/firer)
return
//Called when loaded by the map loader
/atom/proc/spawned_by_map_element(datum/map_element/ME, list/objects)
return

View File

@@ -60,7 +60,8 @@
// This is the placed to store data for the holomap.
var/list/image/holomap_data
// Map element which spawned this turf
var/datum/map_element/map_element
/turf/examine(mob/user)
..()
@@ -706,3 +707,8 @@
change_area(old_area, A)
for(var/atom/AM in contents)
AM.change_area(old_area, A)
/turf/spawned_by_map_element(datum/map_element/ME, list/objects)
.=..()
src.map_element = ME

View File

@@ -194,6 +194,7 @@ var/global/dmm_suite/preloader/_preloader = null
if(!isspace(instance)) //Space is the default area and contains every loaded turf by default
instance.contents.Add(locate(xcrd,ycrd,zcrd))
spawned_atoms |= instance
if(_preloader && instance)
_preloader.load(instance)

View File

@@ -485,3 +485,11 @@ By design, d1 is the smallest direction and d2 is the highest
if(PN.is_empty()) // can happen with machines made nodeless when smoothing cables
returnToPool(PN) //powernets do not get qdelled
/obj/structure/cable/spawned_by_map_element(datum/map_element/ME, list/objects)
.=..()
if(powernet)
return
rebuild_from()

View File

@@ -1,5 +1,10 @@
//Object and area definitions go here
/area/vault //Please make all areas used in vaults a subtype of this!
//Please make all areas used in vaults one of these:
// * subtype of /area/vault
// * /area/vault/automap (preferred option)
// * subtype of /area/vault/automap
/area/vault
name = "mysterious structure"
requires_power = 0
icon_state = "firingrange"
@@ -8,6 +13,27 @@
/area/vault/holomapAlwaysDraw()
return 0
//Special area that can be used in map elements. When loaded, it creates a new area object and transfers all of its contents into it.
//This means that this area can be put into multiple map elements without any issues
/area/vault/automap
/area/vault/automap/spawned_by_map_element(datum/map_element/ME, list/objects)
var/area/vault/automap/new_area = new src.type
for(var/turf/T in src.contents)
new_area.contents.Add(T)
T.change_area(src, new_area)
for(var/atom/allthings in T.contents)
allthings.change_area(src, new_area)
new_area.tag = "[new_area.type]/\ref[ME]"
new_area.addSorted()
/area/vault/automap/no_light
icon_state = "ME_vault_lit"
dynamic_lighting = FALSE
/area/vault/icetruck
/area/vault/asteroid