mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Give multiple copies of shuttles their own area instances (#39890)
This commit is contained in:
committed by
yogstation13-bot
parent
f272ae8192
commit
4c846aa4aa
@@ -577,14 +577,9 @@ Turf and target are separate in case you want to teleport some distance from a t
|
|||||||
//Takes: Area type as a text string from a variable.
|
//Takes: Area type as a text string from a variable.
|
||||||
//Returns: Instance for the area in the world.
|
//Returns: Instance for the area in the world.
|
||||||
/proc/get_area_instance_from_text(areatext)
|
/proc/get_area_instance_from_text(areatext)
|
||||||
var/areainstance = null
|
|
||||||
if(istext(areatext))
|
if(istext(areatext))
|
||||||
areatext = text2path(areatext)
|
areatext = text2path(areatext)
|
||||||
for(var/V in GLOB.sortedAreas)
|
return GLOB.areas_by_type[areatext]
|
||||||
var/area/A = V
|
|
||||||
if(A.type == areatext)
|
|
||||||
areainstance = V
|
|
||||||
return areainstance
|
|
||||||
|
|
||||||
//Takes: Area type as text string or as typepath OR an instance of the area.
|
//Takes: Area type as text string or as typepath OR an instance of the area.
|
||||||
//Returns: A list of all areas of that type in the world.
|
//Returns: A list of all areas of that type in the world.
|
||||||
|
|||||||
@@ -35,5 +35,7 @@ GLOBAL_LIST_EMPTY(vr_spawnpoints)
|
|||||||
|
|
||||||
//used by jump-to-area etc. Updated by area/updateName()
|
//used by jump-to-area etc. Updated by area/updateName()
|
||||||
GLOBAL_LIST_EMPTY(sortedAreas)
|
GLOBAL_LIST_EMPTY(sortedAreas)
|
||||||
|
/// An association from typepath to area instance. Only includes areas with `unique` set.
|
||||||
|
GLOBAL_LIST_EMPTY(areas_by_type)
|
||||||
|
|
||||||
GLOBAL_LIST_EMPTY(all_abstract_markers)
|
GLOBAL_LIST_EMPTY(all_abstract_markers)
|
||||||
|
|||||||
@@ -567,7 +567,7 @@ SUBSYSTEM_DEF(job)
|
|||||||
SendToAtom(M, pick(latejoin_trackers), buckle)
|
SendToAtom(M, pick(latejoin_trackers), buckle)
|
||||||
else
|
else
|
||||||
//bad mojo
|
//bad mojo
|
||||||
var/area/shuttle/arrival/A = locate() in GLOB.sortedAreas
|
var/area/shuttle/arrival/A = GLOB.areas_by_type[/area/shuttle/arrival]
|
||||||
if(A)
|
if(A)
|
||||||
//first check if we can find a chair
|
//first check if we can find a chair
|
||||||
var/obj/structure/chair/C = locate() in A
|
var/obj/structure/chair/C = locate() in A
|
||||||
|
|||||||
@@ -46,6 +46,8 @@
|
|||||||
var/noteleport = FALSE //Are you forbidden from teleporting to the area? (centcom, mobs, wizard, hand teleporter)
|
var/noteleport = FALSE //Are you forbidden from teleporting to the area? (centcom, mobs, wizard, hand teleporter)
|
||||||
var/hidden = FALSE //Hides area from player Teleport function.
|
var/hidden = FALSE //Hides area from player Teleport function.
|
||||||
var/safe = FALSE //Is the area teleport-safe: no space / radiation / aggresive mobs / other dangers
|
var/safe = FALSE //Is the area teleport-safe: no space / radiation / aggresive mobs / other dangers
|
||||||
|
/// If false, loading multiple maps with this area type will create multiple instances.
|
||||||
|
var/unique = TRUE
|
||||||
|
|
||||||
var/no_air = null
|
var/no_air = null
|
||||||
|
|
||||||
@@ -82,6 +84,12 @@ GLOBAL_LIST_EMPTY(teleportlocs)
|
|||||||
|
|
||||||
// ===
|
// ===
|
||||||
|
|
||||||
|
/area/New()
|
||||||
|
// This interacts with the map loader, so it needs to be set immediately
|
||||||
|
// rather than waiting for atoms to initialize.
|
||||||
|
if (unique)
|
||||||
|
GLOB.areas_by_type[type] = src
|
||||||
|
return ..()
|
||||||
|
|
||||||
/area/Initialize()
|
/area/Initialize()
|
||||||
icon_state = ""
|
icon_state = ""
|
||||||
@@ -135,6 +143,8 @@ GLOBAL_LIST_EMPTY(teleportlocs)
|
|||||||
power_change() // all machines set to current power level, also updates icon
|
power_change() // all machines set to current power level, also updates icon
|
||||||
|
|
||||||
/area/Destroy()
|
/area/Destroy()
|
||||||
|
if(GLOB.areas_by_type[type] == src)
|
||||||
|
GLOB.areas_by_type[type] = null
|
||||||
STOP_PROCESSING(SSobj, src)
|
STOP_PROCESSING(SSobj, src)
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
always_unpowered = FALSE
|
always_unpowered = FALSE
|
||||||
valid_territory = FALSE
|
valid_territory = FALSE
|
||||||
icon_state = "shuttle"
|
icon_state = "shuttle"
|
||||||
|
// Loading the same shuttle map at a different time will produce distinct area instances.
|
||||||
|
unique = FALSE
|
||||||
|
|
||||||
/area/shuttle/Initialize()
|
/area/shuttle/Initialize()
|
||||||
if(!canSmoothWithAreas)
|
if(!canSmoothWithAreas)
|
||||||
@@ -103,6 +105,7 @@
|
|||||||
|
|
||||||
/area/shuttle/arrival
|
/area/shuttle/arrival
|
||||||
name = "Arrival Shuttle"
|
name = "Arrival Shuttle"
|
||||||
|
unique = TRUE // SSjob refers to this area for latejoiners
|
||||||
|
|
||||||
/area/shuttle/pod_1
|
/area/shuttle/pod_1
|
||||||
name = "Escape Pod One"
|
name = "Escape Pod One"
|
||||||
|
|||||||
@@ -539,7 +539,7 @@ GLOBAL_LIST_EMPTY(possible_items_special)
|
|||||||
|
|
||||||
/datum/objective/capture/check_completion()//Basically runs through all the mobs in the area to determine how much they are worth.
|
/datum/objective/capture/check_completion()//Basically runs through all the mobs in the area to determine how much they are worth.
|
||||||
var/captured_amount = 0
|
var/captured_amount = 0
|
||||||
var/area/centcom/holding/A = locate() in GLOB.sortedAreas
|
var/area/centcom/holding/A = GLOB.areas_by_type[/area/centcom/holding]
|
||||||
for(var/mob/living/carbon/human/M in A)//Humans.
|
for(var/mob/living/carbon/human/M in A)//Humans.
|
||||||
if(M.stat == DEAD)//Dead folks are worth less.
|
if(M.stat == DEAD)//Dead folks are worth less.
|
||||||
captured_amount+=0.5
|
captured_amount+=0.5
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
/datum/spellbook_entry/proc/Refund(mob/living/carbon/human/user,obj/item/spellbook/book) //return point value or -1 for failure
|
/datum/spellbook_entry/proc/Refund(mob/living/carbon/human/user,obj/item/spellbook/book) //return point value or -1 for failure
|
||||||
var/area/wizard_station/A = locate() in GLOB.sortedAreas
|
var/area/wizard_station/A = GLOB.areas_by_type[/area/wizard_station]
|
||||||
if(!(user in A.contents))
|
if(!(user in A.contents))
|
||||||
to_chat(user, "<span class='warning'>You can only refund spells at the wizard lair</span>")
|
to_chat(user, "<span class='warning'>You can only refund spells at the wizard lair</span>")
|
||||||
return -1
|
return -1
|
||||||
|
|||||||
@@ -167,7 +167,7 @@
|
|||||||
LZ = get_turf(beacon)
|
LZ = get_turf(beacon)
|
||||||
beacon.update_status(SP_LAUNCH)
|
beacon.update_status(SP_LAUNCH)
|
||||||
else if (!usingBeacon)//find a suitable supplypod landing zone in cargobay
|
else if (!usingBeacon)//find a suitable supplypod landing zone in cargobay
|
||||||
landingzone = locate(/area/quartermaster/storage) in GLOB.sortedAreas
|
landingzone = GLOB.areas_by_type[/area/quartermaster/storage]
|
||||||
if (!landingzone)
|
if (!landingzone)
|
||||||
WARNING("[src] couldnt find a Quartermaster/Storage (aka cargobay) area on the station, and as such it has set the supplypod landingzone to the area it resides in.")
|
WARNING("[src] couldnt find a Quartermaster/Storage (aka cargobay) area on the station, and as such it has set the supplypod landingzone to the area it resides in.")
|
||||||
landingzone = get_area(src)
|
landingzone = get_area(src)
|
||||||
@@ -185,7 +185,7 @@
|
|||||||
update_icon()
|
update_icon()
|
||||||
else
|
else
|
||||||
if(SO.pack.cost * (0.72*MAX_EMAG_ROCKETS) <= SSshuttle.points) // bulk discount :^)
|
if(SO.pack.cost * (0.72*MAX_EMAG_ROCKETS) <= SSshuttle.points) // bulk discount :^)
|
||||||
landingzone = locate(pick(GLOB.the_station_areas)) in GLOB.sortedAreas //override default landing zone
|
landingzone = GLOB.areas_by_type[pick(GLOB.the_station_areas)] //override default landing zone
|
||||||
for(var/turf/open/floor/T in landingzone.contents)
|
for(var/turf/open/floor/T in landingzone.contents)
|
||||||
if(is_blocked_turf(T))
|
if(is_blocked_turf(T))
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -177,7 +177,7 @@
|
|||||||
|
|
||||||
/obj/machinery/computer/holodeck/proc/generate_program_list()
|
/obj/machinery/computer/holodeck/proc/generate_program_list()
|
||||||
for(var/typekey in subtypesof(program_type))
|
for(var/typekey in subtypesof(program_type))
|
||||||
var/area/holodeck/A = locate(typekey) in GLOB.sortedAreas
|
var/area/holodeck/A = GLOB.areas_by_type[typekey]
|
||||||
if(!A || !A.contents.len)
|
if(!A || !A.contents.len)
|
||||||
continue
|
continue
|
||||||
var/list/info_this = list()
|
var/list/info_this = list()
|
||||||
|
|||||||
@@ -138,6 +138,7 @@
|
|||||||
|
|
||||||
// Do not call except via load() above.
|
// Do not call except via load() above.
|
||||||
/datum/parsed_map/proc/_load_impl(x_offset = 1, y_offset = 1, z_offset = world.maxz + 1, cropMap = FALSE, no_changeturf = FALSE, x_lower = -INFINITY, x_upper = INFINITY, y_lower = -INFINITY, y_upper = INFINITY, placeOnTop = FALSE)
|
/datum/parsed_map/proc/_load_impl(x_offset = 1, y_offset = 1, z_offset = world.maxz + 1, cropMap = FALSE, no_changeturf = FALSE, x_lower = -INFINITY, x_upper = INFINITY, y_lower = -INFINITY, y_upper = INFINITY, placeOnTop = FALSE)
|
||||||
|
var/list/areaCache = list()
|
||||||
var/list/modelCache = build_cache(no_changeturf)
|
var/list/modelCache = build_cache(no_changeturf)
|
||||||
var/space_key = modelCache[SPACE_KEY]
|
var/space_key = modelCache[SPACE_KEY]
|
||||||
var/list/bounds
|
var/list/bounds
|
||||||
@@ -182,7 +183,7 @@
|
|||||||
var/list/cache = modelCache[model_key]
|
var/list/cache = modelCache[model_key]
|
||||||
if(!cache)
|
if(!cache)
|
||||||
CRASH("Undefined model key in DMM: [model_key]")
|
CRASH("Undefined model key in DMM: [model_key]")
|
||||||
build_coordinate(cache, xcrd, ycrd, zcrd, no_afterchange, placeOnTop)
|
build_coordinate(areaCache, cache, locate(xcrd, ycrd, zcrd), no_afterchange, placeOnTop)
|
||||||
|
|
||||||
// only bother with bounds that actually exist
|
// only bother with bounds that actually exist
|
||||||
bounds[MAP_MINX] = min(bounds[MAP_MINX], xcrd)
|
bounds[MAP_MINX] = min(bounds[MAP_MINX], xcrd)
|
||||||
@@ -292,7 +293,7 @@
|
|||||||
|
|
||||||
.[model_key] = list(members, members_attributes)
|
.[model_key] = list(members, members_attributes)
|
||||||
|
|
||||||
/datum/parsed_map/proc/build_coordinate(list/model, xcrd as num, ycrd as num, zcrd as num, no_changeturf as num, placeOnTop as num)
|
/datum/parsed_map/proc/build_coordinate(list/areaCache, list/model, turf/crds, no_changeturf as num, placeOnTop as num)
|
||||||
var/index
|
var/index
|
||||||
var/list/members = model[1]
|
var/list/members = model[1]
|
||||||
var/list/members_attributes = model[2]
|
var/list/members_attributes = model[2]
|
||||||
@@ -302,20 +303,17 @@
|
|||||||
////////////////
|
////////////////
|
||||||
|
|
||||||
//The next part of the code assumes there's ALWAYS an /area AND a /turf on a given tile
|
//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
|
//first instance the /area and remove it from the members list
|
||||||
index = members.len
|
index = members.len
|
||||||
if(members[index] != /area/template_noop)
|
if(members[index] != /area/template_noop)
|
||||||
var/atom/instance
|
|
||||||
GLOB._preloader.setup(members_attributes[index])//preloader for assigning set variables on atom creation
|
GLOB._preloader.setup(members_attributes[index])//preloader for assigning set variables on atom creation
|
||||||
var/atype = members[index]
|
var/atype = members[index]
|
||||||
for(var/area/A in world)
|
var/atom/instance = areaCache[atype]
|
||||||
if(A.type == atype)
|
if (!instance)
|
||||||
instance = A
|
instance = GLOB.areas_by_type[atype]
|
||||||
break
|
if (!instance)
|
||||||
if(!instance)
|
instance = new atype(null)
|
||||||
instance = new atype(null)
|
areaCache[atype] = instance
|
||||||
if(crds)
|
if(crds)
|
||||||
instance.contents.Add(crds)
|
instance.contents.Add(crds)
|
||||||
|
|
||||||
|
|||||||
@@ -32,12 +32,7 @@
|
|||||||
|
|
||||||
// The underlying old area is the area assumed to be under the shuttle's starting location
|
// The underlying old area is the area assumed to be under the shuttle's starting location
|
||||||
// If it no longer/has never existed it will be created
|
// If it no longer/has never existed it will be created
|
||||||
var/area/underlying_old_area
|
var/area/underlying_old_area = GLOB.areas_by_type[underlying_area_type]
|
||||||
for(var/i in GLOB.sortedAreas) // Locate grabs subtypes and we want a particular type
|
|
||||||
var/area/place = i
|
|
||||||
if(place.type == underlying_area_type)
|
|
||||||
underlying_old_area = place
|
|
||||||
break
|
|
||||||
if(!underlying_old_area)
|
if(!underlying_old_area)
|
||||||
underlying_old_area = new underlying_area_type(null)
|
underlying_old_area = new underlying_area_type(null)
|
||||||
|
|
||||||
|
|||||||
@@ -435,12 +435,7 @@
|
|||||||
|
|
||||||
var/list/old_turfs = return_ordered_turfs(x, y, z, dir)
|
var/list/old_turfs = return_ordered_turfs(x, y, z, dir)
|
||||||
|
|
||||||
var/area/underlying_area
|
var/area/underlying_area = GLOB.areas_by_type[underlying_area_type]
|
||||||
for(var/i in GLOB.sortedAreas)
|
|
||||||
var/area/place = i
|
|
||||||
if(place.type == underlying_area_type)
|
|
||||||
underlying_area = place
|
|
||||||
break
|
|
||||||
if(!underlying_area)
|
if(!underlying_area)
|
||||||
underlying_area = new underlying_area_type(null)
|
underlying_area = new underlying_area_type(null)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user