mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +01:00
valid_subtypes proc (#93541)
## About The Pull Request discussed in #93439, a generic proc for getting a list of all types minus abstract types. applies this to most instances of a for loop that currently filters out abstract types it SHOULD be a nothing burger for performance, however I have not bench marked the difference. (also testing, there is a total of 7 calls in init to it)
This commit is contained in:
@@ -36,10 +36,8 @@ PROCESSING_SUBSYSTEM_DEF(instruments)
|
||||
songs -= S
|
||||
|
||||
/datum/controller/subsystem/processing/instruments/proc/initialize_instrument_data()
|
||||
for(var/path in subtypesof(/datum/instrument))
|
||||
for(var/path in valid_subtypesof(/datum/instrument))
|
||||
var/datum/instrument/I = path
|
||||
if(initial(I.abstract_type) == path)
|
||||
continue
|
||||
I = new path
|
||||
I.Initialize()
|
||||
if(!I.id)
|
||||
|
||||
@@ -94,16 +94,13 @@ PROCESSING_SUBSYSTEM_DEF(station)
|
||||
|
||||
return
|
||||
|
||||
for(var/datum/station_trait/trait_typepath as anything in subtypesof(/datum/station_trait))
|
||||
for(var/datum/station_trait/trait_typepath as anything in valid_subtypesof(/datum/station_trait))
|
||||
|
||||
// If forced, (probably debugging), just set it up now, keep it out of the pool.
|
||||
if(initial(trait_typepath.force))
|
||||
setup_trait(trait_typepath)
|
||||
continue
|
||||
|
||||
if(initial(trait_typepath.abstract_type) == trait_typepath)
|
||||
continue //Dont add abstract ones to it
|
||||
|
||||
if(!(initial(trait_typepath.trait_flags) & STATION_TRAIT_PLANETARY) && SSmapping.is_planetary()) // we're on a planet but we can't do planet ;_;
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user