mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 00:29:02 +01:00
area/proc/get_apc() is no longer shit and does not lag (AT ALL) on large areas anymore, the new method stores a list of all APCs in the world, and checks if their area var is equal to the area get_apc() was called on.
This commit is contained in:
@@ -12,4 +12,5 @@ var/global/list/nuke_list = list()
|
||||
var/global/list/chemical_reactions_list //list of all /datum/chemical_reaction datums. Used during chemical reactions
|
||||
var/global/list/chemical_reagents_list //list of all /datum/reagent datums indexed by reagent id. Used by chemistry stuff
|
||||
var/global/list/surgeries_list = list() //list of all surgeries by name, associated with their path.
|
||||
var/global/list/table_recipes = list() //list of all table craft recipes
|
||||
var/global/list/table_recipes = list() //list of all table craft recipes
|
||||
var/global/list/apcs_list = list() //list of all Area Power Controller machines, seperate from machines for powernet speeeeeeed.
|
||||
@@ -112,6 +112,8 @@
|
||||
|
||||
/obj/machinery/power/apc/New(turf/loc, var/ndir, var/building=0)
|
||||
..()
|
||||
apcs_list += src
|
||||
|
||||
wires = new(src)
|
||||
// offset 24 pixels in direction of dir
|
||||
// this allows the APC to be embedded in a wall, yet still inside an area
|
||||
@@ -138,6 +140,8 @@
|
||||
src.update()
|
||||
|
||||
/obj/machinery/power/apc/Destroy()
|
||||
apcs_list -= src
|
||||
|
||||
if(malfai && operating)
|
||||
if (ticker.mode.config_tag == "malfunction")
|
||||
if (src.z == ZLEVEL_STATION) //if (is_type_in_list(get_area(src), the_station_areas))
|
||||
|
||||
@@ -356,7 +356,6 @@
|
||||
return null
|
||||
|
||||
/area/proc/get_apc()
|
||||
for(var/area/RA in src.related)
|
||||
var/obj/machinery/power/apc/FINDME = locate() in RA
|
||||
if (FINDME)
|
||||
return FINDME
|
||||
for(var/obj/machinery/power/apc/APC in apcs_list)
|
||||
if(APC.area == src)
|
||||
return APC
|
||||
|
||||
Reference in New Issue
Block a user