Revert "Singletons + refactor of /datum/observ (#15487)" (#15515)

This commit is contained in:
Matt Atlas
2023-01-05 19:21:22 +01:00
committed by GitHub
parent 34b1bcd055
commit b1869884c1
506 changed files with 7214 additions and 7561 deletions

View File

@@ -12,10 +12,10 @@ var/datum/controller/subsystem/chemistry/SSchemistry
var/tmp/list/processing_holders = list()
var/list/codex_data = list()
var/list/codex_ignored_reaction_path = list(/datum/chemical_reaction/slime)
var/list/codex_ignored_result_path = list(/singleton/reagent/drink, /singleton/reagent/alcohol)
var/list/codex_ignored_result_path = list(/decl/reagent/drink, /decl/reagent/alcohol)
/datum/controller/subsystem/chemistry/proc/has_valid_specific_heat(var/_R) //Used for unit tests. Same as check_specific_heat but returns a boolean instead.
var/singleton/reagent/R = GET_SINGLETON(_R)
var/decl/reagent/R = decls_repository.get_decl(_R)
if(R.specific_heat > 0)
return TRUE
@@ -35,7 +35,7 @@ var/datum/controller/subsystem/chemistry/SSchemistry
return FALSE
/datum/controller/subsystem/chemistry/proc/check_specific_heat(var/_R)
var/singleton/reagent/R = GET_SINGLETON(_R)
var/decl/reagent/R = decls_repository.get_decl(_R)
if(R.specific_heat > 0)
return R.specific_heat
@@ -73,7 +73,7 @@ var/datum/controller/subsystem/chemistry/SSchemistry
return CR
/datum/controller/subsystem/chemistry/proc/initialize_specific_heats()
for(var/_R in subtypesof(/singleton/reagent/))
for(var/_R in subtypesof(/decl/reagent/))
check_specific_heat(_R)
/datum/controller/subsystem/chemistry/stat_entry()
@@ -140,7 +140,7 @@ var/datum/controller/subsystem/chemistry/SSchemistry
cc.id = chemconfig[chemical]["id"]
cc.result = text2path(chemconfig[chemical]["result"])
cc.result_amount = chemconfig[chemical]["resultamount"]
if(!ispath(cc.result, /singleton/reagent))
if(!ispath(cc.result, /decl/reagent))
log_debug("SSchemistry: Warning: Invalid result [cc.result] in [cc.name] reactions list.")
qdel(cc)
break
@@ -148,7 +148,7 @@ var/datum/controller/subsystem/chemistry/SSchemistry
for(var/key in chemconfig[chemical]["required_reagents"])
var/result_chem = text2path(key)
LAZYSET(cc.required_reagents, result_chem, chemconfig[chemical]["required_reagents"][key])
if(!ispath(result_chem, /singleton/reagent))
if(!ispath(result_chem, /decl/reagent))
log_debug("SSchemistry: Warning: Invalid chemical [key] in [cc.name] required reagents list.")
qdel(cc)
break
@@ -162,7 +162,7 @@ var/datum/controller/subsystem/chemistry/SSchemistry
//Chemical Reactions - Initialises all /datum/chemical_reaction into a list
// It is filtered into multiple lists within a list.
// For example:
// chemical_reaction_list[/singleton/reagent/toxin/phoron] is a list of all reactions relating to phoron
// chemical_reaction_list[/decl/reagent/toxin/phoron] is a list of all reactions relating to phoron
// Note that entries in the list are NOT duplicated. So if a reaction pertains to
// more than one chemical it will still only appear in only one of the sublists.
/datum/controller/subsystem/chemistry/proc/initialize_chemical_reactions()
@@ -190,7 +190,7 @@ var/datum/controller/subsystem/chemistry/SSchemistry
continue
if(codex_ignored_result_path && is_path_in_list(CR.result, codex_ignored_result_path))
continue
var/singleton/reagent/R = GET_SINGLETON(CR.result)
var/decl/reagent/R = decls_repository.get_decl(CR.result)
var/reactionData = list(id = CR.id)
reactionData["result"] = list(
name = R.name,
@@ -200,7 +200,7 @@ var/datum/controller/subsystem/chemistry/SSchemistry
reactionData["reagents"] = list()
for(var/reagent in CR.required_reagents)
var/singleton/reagent/required_reagent = reagent
var/decl/reagent/required_reagent = reagent
reactionData["reagents"] += list(list(
name = initial(required_reagent.name),
amount = CR.required_reagents[reagent]
@@ -208,7 +208,7 @@ var/datum/controller/subsystem/chemistry/SSchemistry
reactionData["catalysts"] = list()
for(var/reagent_path in CR.catalysts)
var/singleton/reagent/required_reagent = reagent_path
var/decl/reagent/required_reagent = reagent_path
reactionData["catalysts"] += list(list(
name = initial(required_reagent.name),
amount = CR.catalysts[reagent_path]
@@ -216,7 +216,7 @@ var/datum/controller/subsystem/chemistry/SSchemistry
reactionData["inhibitors"] = list()
for(var/reagent_path in CR.inhibitors)
var/singleton/reagent/required_reagent = reagent_path
var/decl/reagent/required_reagent = reagent_path
var/inhibitor_amount = CR.inhibitors[reagent_path] ? CR.inhibitors[reagent_path] : "Any"
reactionData["inhibitors"] += list(list(
name = initial(required_reagent.name),

View File

@@ -166,10 +166,10 @@ var/datum/controller/subsystem/explosives/SSexplosives
// If inside the blast radius + world.view - 2
if (dist <= closedist)
to_chat(M, FONT_LARGE(SPAN_WARNING("You hear the sound of a nearby explosion coming from \the [explosion_dir].")))
M.playsound_simple(epicenter, get_sfx(/singleton/sound_category/explosion_sound), min(100, volume), use_random_freq = TRUE, falloff = 5)
M.playsound_simple(epicenter, get_sfx(/decl/sound_category/explosion_sound), min(100, volume), use_random_freq = TRUE, falloff = 5)
else if (dist > closedist && dist <= extendeddist) // People with sensitive hearing get a better idea of how far it is
to_chat(M, FONT_LARGE(SPAN_WARNING("You hear the sound of a semi-close explosion coming from \the [explosion_dir].")))
M.playsound_simple(epicenter, get_sfx(/singleton/sound_category/explosion_sound), min(100, volume), use_random_freq = TRUE, falloff = 5)
M.playsound_simple(epicenter, get_sfx(/decl/sound_category/explosion_sound), min(100, volume), use_random_freq = TRUE, falloff = 5)
else //You hear a far explosion if you're outside the blast radius. Small bombs shouldn't be heard all over the station.
volume = M.playsound_simple(epicenter, 'sound/effects/explosionfar.ogg', volume, use_random_freq = TRUE, falloff = 1000, use_pressure = TRUE)
if(volume)
@@ -333,7 +333,7 @@ var/datum/controller/subsystem/explosives/SSexplosives
var/close_dist = round(power + world.view - 2, 1)
var/sound/explosion_sound = sound(get_sfx(/singleton/sound_category/explosion_sound))
var/sound/explosion_sound = sound(get_sfx(/decl/sound_category/explosion_sound))
for (var/thing in player_list)
var/mob/M = thing

View File

@@ -832,9 +832,9 @@
var/permitted = !G.allowed_roles || (rank.title in G.allowed_roles)
permitted = permitted && G.check_species_whitelist(H)
permitted = permitted && (!G.faction || (G.faction == H.employer_faction || H.employer_faction == "Stellar Corporate Conglomerate"))
var/singleton/origin_item/culture/our_culture = GET_SINGLETON(text2path(prefs.culture))
var/decl/origin_item/culture/our_culture = decls_repository.get_decl(text2path(prefs.culture))
permitted = permitted && (!G.culture_restriction || (our_culture in G.culture_restriction))
var/singleton/origin_item/origin/our_origin = GET_SINGLETON(text2path(prefs.origin))
var/decl/origin_item/origin/our_origin = decls_repository.get_decl(text2path(prefs.origin))
permitted = permitted && (!G.origin_restriction || (our_origin in G.origin_restriction))
if(!permitted)

View File

@@ -18,7 +18,7 @@ var/datum/controller/subsystem/mapping/SSmapping
/datum/controller/subsystem/mapping/Initialize(timeofday)
// Load templates and build away sites.
preloadTemplates()
for(var/atype in subtypesof(/singleton/submap_archetype))
for(var/atype in subtypesof(/decl/submap_archetype))
submap_archetypes[atype] = new atype
current_map.build_away_sites()

View File

@@ -67,10 +67,10 @@
while(gene_mask in used_masks)
gene_mask = "[uppertext(num2hex(rand(0,255), 0))]"
var/singleton/plantgene/G
var/decl/plantgene/G
for(var/D in gene_datums)
var/singleton/plantgene/P = gene_datums[D]
var/decl/plantgene/P = gene_datums[D]
if(gene_tag == P.gene_tag)
G = P
gene_datums -=D
@@ -129,8 +129,8 @@
if(seed.consume_gasses)
seed.consume_gasses[GAS_PHORON] = null
seed.consume_gasses[GAS_CO2] = null
if(seed.chems && !isnull(seed.chems[/singleton/reagent/acid/polyacid]))
seed.chems[/singleton/reagent/acid/polyacid] = null // Eating through the hull will make these plants completely inviable, albeit very dangerous.
if(seed.chems && !isnull(seed.chems[/decl/reagent/acid/polyacid]))
seed.chems[/decl/reagent/acid/polyacid] = null // Eating through the hull will make these plants completely inviable, albeit very dangerous.
seed.chems -= null // Setting to null does not actually remove the entry, which is weird.
seed.set_trait(TRAIT_IDEAL_HEAT,293)
seed.set_trait(TRAIT_HEAT_TOLERANCE,20)