mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Optimize a couple things
This commit is contained in:
@@ -88,8 +88,7 @@ This allows for events that have their announcement happen after the end itself.
|
||||
if(!LAZYLEN(grand_list_of_areas))
|
||||
return list()
|
||||
|
||||
for(var/thing in grand_list_of_areas)
|
||||
var/list/A = thing
|
||||
for(var/list/A as anything in grand_list_of_areas)
|
||||
var/list/turfs = list()
|
||||
for(var/turf/T in A)
|
||||
if(!T.check_density())
|
||||
@@ -107,8 +106,7 @@ This allows for events that have their announcement happen after the end itself.
|
||||
|
||||
var/list/area/grand_list_of_areas = get_all_existing_areas_of_types(specific_areas)
|
||||
. = list()
|
||||
for(var/thing in shuffle(grand_list_of_areas))
|
||||
var/area/A = thing
|
||||
for(var/area/A as anything in shuffle(grand_list_of_areas))
|
||||
if(A.forbid_events)
|
||||
continue
|
||||
if(!(A.z in get_location_z_levels()))
|
||||
|
||||
@@ -111,16 +111,14 @@
|
||||
log_debug("Spawned [new_blob.overmind.blob_type.name] blob at [get_area(new_blob)].")
|
||||
|
||||
/datum/event2/event/blob/should_end()
|
||||
for(var/WR in blobs)
|
||||
var/weakref/weakref = WR
|
||||
for(var/weakref/weakref as anything in blobs)
|
||||
if(weakref.resolve()) // If the weakref is resolvable, that means the blob hasn't been deleted yet.
|
||||
return FALSE
|
||||
return TRUE // Only end if all blobs die.
|
||||
|
||||
// Normally this does nothing, but is useful if aborted by an admin.
|
||||
/datum/event2/event/blob/end()
|
||||
for(var/WR in blobs)
|
||||
var/weakref/weakref = WR
|
||||
for(var/weakref/weakref as anything in blobs)
|
||||
var/obj/structure/blob/core/B = weakref.resolve()
|
||||
if(istype(B))
|
||||
qdel(B)
|
||||
@@ -130,8 +128,7 @@
|
||||
var/danger_level = 0
|
||||
var/list/blob_type_names = list()
|
||||
var/multiblob = FALSE
|
||||
for(var/WR in blobs)
|
||||
var/weakref/weakref = WR
|
||||
for(var/weakref/weakref as anything in blobs)
|
||||
var/obj/structure/blob/core/B = weakref.resolve()
|
||||
if(!istype(B))
|
||||
continue
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
// Having the turbines be way over their rated limit makes grid checks more likely.
|
||||
/datum/event2/meta/grid_check/proc/get_overpower()
|
||||
var/highest_overpower = 0
|
||||
for(var/T in GLOB.all_turbines)
|
||||
var/obj/machinery/power/generator/turbine = T
|
||||
for(var/obj/machinery/power/generator/turbine as anything in GLOB.all_turbines)
|
||||
var/overpower = max((turbine.effective_gen / turbine.max_power) - 1, 0)
|
||||
if(overpower > highest_overpower)
|
||||
highest_overpower = overpower
|
||||
@@ -35,8 +34,7 @@
|
||||
/datum/event2/event/grid_check/set_up()
|
||||
// Find the turbine being pushed the most.
|
||||
var/obj/machinery/power/generator/most_stressed_turbine = null
|
||||
for(var/T in GLOB.all_turbines)
|
||||
var/obj/machinery/power/generator/turbine = T
|
||||
for(var/obj/machinery/power/generator/turbine as anything in GLOB.all_turbines)
|
||||
if(!most_stressed_turbine)
|
||||
most_stressed_turbine = turbine
|
||||
else if(turbine.effective_gen > most_stressed_turbine.effective_gen)
|
||||
|
||||
@@ -66,10 +66,9 @@
|
||||
// In the future, a new AI stance that handles long distance travel using getline() could work.
|
||||
var/max_distance = 8
|
||||
var/turf/spawn_turf = null
|
||||
for(var/P in space_line)
|
||||
var/turf/point = P
|
||||
for(var/turf/point as anything in space_line)
|
||||
if(get_dist(point, edge_of_station) <= max_distance)
|
||||
spawn_turf = P
|
||||
spawn_turf = point
|
||||
break
|
||||
|
||||
if(spawn_turf)
|
||||
@@ -88,8 +87,7 @@
|
||||
// Counts living simple_mobs spawned by this event.
|
||||
/datum/event2/event/mob_spawning/proc/count_spawned_mobs()
|
||||
. = 0
|
||||
for(var/I in spawned_mobs)
|
||||
var/mob/living/simple_mob/M = I
|
||||
for(var/mob/living/simple_mob/M as anything in spawned_mobs)
|
||||
if(!QDELETED(M) && M.stat != DEAD)
|
||||
. += 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user