From f2c8a7cd6fd558819cf031caf72c3bdfdb590257 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Wed, 4 Mar 2020 15:59:46 +0100 Subject: [PATCH] Porting a couple material datums code updates and fixes. --- code/__DEFINES/materials.dm | 5 +-- code/__DEFINES/subsystems.dm | 1 - code/controllers/subsystem/materials.dm | 14 ++++---- code/datums/components/material_container.dm | 14 ++++---- code/datums/materials/_material.dm | 32 ++++++++++--------- code/game/atoms.dm | 6 ++-- code/game/machinery/autolathe.dm | 2 +- code/game/machinery/toylathe.dm | 2 +- code/game/objects/items/apc_frame.dm | 4 +-- code/game/objects/items/melee/misc.dm | 2 +- code/game/objects/items/stacks/stack.dm | 8 ++--- .../objects/structures/beds_chairs/chair.dm | 4 +-- code/game/objects/structures/table_frames.dm | 2 +- code/game/objects/structures/tables_racks.dm | 2 +- code/modules/antagonists/swarmer/swarmer.dm | 2 +- code/modules/cargo/exports/materials.dm | 4 +-- code/modules/clothing/head/helmet.dm | 2 +- code/modules/clothing/suits/armor.dm | 2 +- .../kitchen_machinery/microwave.dm | 2 +- code/modules/hydroponics/biogenerator.dm | 8 ++--- .../integrated_electronics/core/printer.dm | 4 +-- .../core/saved_circuits.dm | 4 +-- .../subtypes/manipulation.dm | 4 +-- code/modules/mining/machine_processing.dm | 2 +- code/modules/mining/mint.dm | 2 +- code/modules/mining/ores_coins.dm | 2 +- .../mob/living/silicon/robot/robot_modules.dm | 4 +-- code/modules/research/designs.dm | 2 +- 28 files changed, 70 insertions(+), 72 deletions(-) diff --git a/code/__DEFINES/materials.dm b/code/__DEFINES/materials.dm index 0e5234792a..89553d9c6c 100644 --- a/code/__DEFINES/materials.dm +++ b/code/__DEFINES/materials.dm @@ -4,11 +4,8 @@ /// Hard materials, such as iron or metal #define MAT_CATEGORY_RIGID "rigid material" - -/// Gets the reference for the material type that was given -#define getmaterialref(A) (SSmaterials.materials[A] || A) - /// Flag for atoms, this flag ensures it isn't re-colored by materials. Useful for snowflake icons such as default toolboxes. #define MATERIAL_COLOR (1<<0) #define MATERIAL_ADD_PREFIX (1<<1) #define MATERIAL_NO_EFFECTS (1<<2) +#define MATERIAL_AFFECT_STATISTICS (1<<3) \ No newline at end of file diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index 903e5cbbe1..a693b26b20 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -56,7 +56,6 @@ #define INIT_ORDER_SERVER_MAINT 93 #define INIT_ORDER_INPUT 85 #define INIT_ORDER_VIS 80 -#define INIT_ORDER_MATERIALS 76 #define INIT_ORDER_RESEARCH 75 #define INIT_ORDER_EVENTS 70 #define INIT_ORDER_JOBS 65 diff --git a/code/controllers/subsystem/materials.dm b/code/controllers/subsystem/materials.dm index 96b9e68904..8e6aedc557 100644 --- a/code/controllers/subsystem/materials.dm +++ b/code/controllers/subsystem/materials.dm @@ -5,8 +5,7 @@ These materials call on_applied() on whatever item they are applied to, common e SUBSYSTEM_DEF(materials) name = "Materials" - flags = SS_NO_FIRE - init_order = INIT_ORDER_MATERIALS + flags = SS_NO_FIRE | SS_NO_INIT ///Dictionary of material.type || material ref var/list/materials = list() ///Dictionary of category || list of material refs @@ -14,14 +13,15 @@ SUBSYSTEM_DEF(materials) ///List of stackcrafting recipes for materials using rigid materials var/list/rigid_stack_recipes = list(new/datum/stack_recipe("chair", /obj/structure/chair/greyscale, one_per_turf = TRUE, on_floor = TRUE, applies_mats = TRUE)) -/datum/controller/subsystem/materials/Initialize(timeofday) - InitializeMaterials() - return ..() - ///Ran on initialize, populated the materials and materials_by_category dictionaries with their appropiate vars (See these variables for more info) -/datum/controller/subsystem/materials/proc/InitializeMaterials(timeofday) +/datum/controller/subsystem/materials/proc/InitializeMaterials() for(var/type in subtypesof(/datum/material)) var/datum/material/ref = new type materials[type] = ref for(var/c in ref.categories) materials_by_category[c] += list(ref) + +/datum/controller/subsystem/materials/proc/GetMaterialRef(datum/material/fakemat) + if(!materials) + InitializeMaterials() + return materials[fakemat] || fakemat \ No newline at end of file diff --git a/code/datums/components/material_container.dm b/code/datums/components/material_container.dm index aab84d9ebb..2f411ff37f 100644 --- a/code/datums/components/material_container.dm +++ b/code/datums/components/material_container.dm @@ -42,7 +42,7 @@ RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/OnExamine) for(var/mat in mat_list) //Make the assoc list ref | amount - var/datum/material/M = getmaterialref(mat) || mat + var/datum/material/M = SSmaterials.GetMaterialRef(mat) materials[M] = 0 /datum/component/material_container/proc/OnExamine(datum/source, mob/user, list/examine_list) @@ -130,7 +130,7 @@ /// For inserting an amount of material /datum/component/material_container/proc/insert_amount_mat(amt, var/datum/material/mat) if(!istype(mat)) - mat = getmaterialref(mat) + mat = SSmaterials.GetMaterialRef(mat) if(amt > 0 && has_space(amt)) var/total_amount_saved = total_amount if(mat) @@ -145,7 +145,7 @@ /// Uses an amount of a specific material, effectively removing it. /datum/component/material_container/proc/use_amount_mat(amt, var/datum/material/mat) if(!istype(mat)) - mat = getmaterialref(mat) + mat = SSmaterials.GetMaterialRef(mat) var/amount = materials[mat] if(mat) if(amount >= amt) @@ -157,7 +157,7 @@ /// Proc for transfering materials to another container. /datum/component/material_container/proc/transer_amt_to(var/datum/component/material_container/T, amt, var/datum/material/mat) if(!istype(mat)) - mat = getmaterialref(mat) + mat = SSmaterials.GetMaterialRef(mat) if((amt==0)||(!T)||(!mat)) return FALSE if(amt<0) @@ -190,7 +190,7 @@ for(var/x in mats) //Loop through all required materials var/datum/material/req_mat = x if(!istype(req_mat)) - req_mat = getmaterialref(req_mat) //Get the ref if necesary + req_mat = SSmaterials.GetMaterialRef(req_mat) //Get the ref if necesary if(!materials[req_mat]) //Do we have the resource? return FALSE //Can't afford it var/amount_required = mats[x] * multiplier @@ -251,7 +251,7 @@ var/datum/material/req_mat = x if(!istype(req_mat)) if(ispath(req_mat)) //Is this an actual material, or is it a category? - req_mat = getmaterialref(req_mat) //Get the ref + req_mat = SSmaterials.GetMaterialRef(req_mat) //Get the ref else // Its a category. (For example MAT_CATEGORY_RIGID) if(!has_enough_of_category(req_mat, mats[req_mat], multiplier)) //Do we have enough of this category? @@ -316,5 +316,5 @@ /// Returns the amount of a specific material in this container. /datum/component/material_container/proc/get_material_amount(var/datum/material/mat) if(!istype(mat)) - mat = getmaterialref(mat) + mat = SSmaterials.GetMaterialRef(mat) return(materials[mat]) diff --git a/code/datums/materials/_material.dm b/code/datums/materials/_material.dm index 796ebc42c7..c658ac215d 100644 --- a/code/datums/materials/_material.dm +++ b/code/datums/materials/_material.dm @@ -41,20 +41,21 @@ Simple datum which is instanced once per type and is used for every object of sa ///This proc is called when the material is added to an object specifically. /datum/material/proc/on_applied_obj(var/obj/o, amount, material_flags) - var/new_max_integrity = CEILING(o.max_integrity * integrity_modifier, 1) - o.modify_max_integrity(new_max_integrity) - o.force *= strength_modifier - o.throwforce *= strength_modifier + if(material_flags & MATERIAL_AFFECT_STATISTICS) + var/new_max_integrity = CEILING(o.max_integrity * integrity_modifier, 1) + o.modify_max_integrity(new_max_integrity) + o.force *= strength_modifier + o.throwforce *= strength_modifier - var/list/temp_armor_list = list() //Time to add armor modifiers! + var/list/temp_armor_list = list() //Time to add armor modifiers! - if(!istype(o.armor)) - return - var/list/current_armor = o.armor?.getList() + if(!istype(o.armor)) + return + var/list/current_armor = o.armor?.getList() - for(var/i in current_armor) - temp_armor_list[i] = current_armor[i] * armor_modifiers[i] - o.armor = getArmor(arglist(temp_armor_list)) + for(var/i in current_armor) + temp_armor_list[i] = current_armor[i] * armor_modifiers[i] + o.armor = getArmor(arglist(temp_armor_list)) ///This proc is called when the material is removed from an object. /datum/material/proc/on_removed(atom/source, material_flags) @@ -71,7 +72,8 @@ Simple datum which is instanced once per type and is used for every object of sa ///This proc is called when the material is removed from an object specifically. /datum/material/proc/on_removed_obj(var/obj/o, amount, material_flags) - var/new_max_integrity = initial(o.max_integrity) - o.modify_max_integrity(new_max_integrity) - o.force = initial(o.force) - o.throwforce = initial(o.throwforce) + if(material_flags & MATERIAL_AFFECT_STATISTICS) + var/new_max_integrity = initial(o.max_integrity) + o.modify_max_integrity(new_max_integrity) + o.force = initial(o.force) + o.throwforce = initial(o.throwforce) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 6439fd1cfc..d0ce3a7fad 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -98,7 +98,7 @@ var/temp_list = list() for(var/i in custom_materials) - temp_list[getmaterialref(i)] = custom_materials[i] //Get the proper instanced version + temp_list[SSmaterials.GetMaterialRef(i)] = custom_materials[i] //Get the proper instanced version custom_materials = null //Null the list to prepare for applying the materials properly set_custom_materials(temp_list) @@ -904,7 +904,7 @@ Proc for attack log creation, because really why not if(custom_materials) //Only runs if custom materials existed at first. Should usually be the case but check anyways for(var/i in custom_materials) - var/datum/material/custom_material = getmaterialref(i) + var/datum/material/custom_material = SSmaterials.GetMaterialRef(i) custom_material.on_removed(src, material_flags) //Remove the current materials if(!length(materials)) @@ -913,7 +913,7 @@ Proc for attack log creation, because really why not custom_materials = list() //Reset the list for(var/x in materials) - var/datum/material/custom_material = getmaterialref(x) + var/datum/material/custom_material = SSmaterials.GetMaterialRef(x) if(!(material_flags & MATERIAL_NO_EFFECTS)) custom_material.on_applied(src, materials[custom_material] * multiplier * material_modifier, material_flags) diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 872b9e1d85..b74e4303e5 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -140,7 +140,7 @@ /obj/machinery/autolathe/proc/AfterMaterialInsert(obj/item/item_inserted, id_inserted, amount_inserted) if(istype(item_inserted, /obj/item/stack/ore/bluespace_crystal)) use_power(MINERAL_MATERIAL_AMOUNT / 10) - else if(item_inserted.custom_materials?.len && item_inserted.custom_materials[getmaterialref(/datum/material/glass)]) + else if(item_inserted.custom_materials?.len && item_inserted.custom_materials[SSmaterials.GetMaterialRef(/datum/material/glass)]) flick("autolathe_r",src)//plays glass insertion animation by default otherwise else flick("autolathe_o",src)//plays metal insertion animation diff --git a/code/game/machinery/toylathe.dm b/code/game/machinery/toylathe.dm index a286bcdc25..87ab3cadd8 100644 --- a/code/game/machinery/toylathe.dm +++ b/code/game/machinery/toylathe.dm @@ -121,7 +121,7 @@ return ..() /obj/machinery/autoylathe/proc/AfterMaterialInsert(obj/item/item_inserted, id_inserted, amount_inserted) - if(item_inserted.custom_materials?.len && item_inserted.custom_materials[getmaterialref(/datum/material/glass)]) + if(item_inserted.custom_materials?.len && item_inserted.custom_materials[SSmaterials.GetMaterialRef(/datum/material/glass)]) flick("autolathe_r",src)//plays glass insertion animation by default otherwise else flick("autolathe_o",src)//plays metal insertion animation diff --git a/code/game/objects/items/apc_frame.dm b/code/game/objects/items/apc_frame.dm index 3b1d9a8096..1f6dff490d 100644 --- a/code/game/objects/items/apc_frame.dm +++ b/code/game/objects/items/apc_frame.dm @@ -66,8 +66,8 @@ if(iswallturf(T)) T.attackby(src, user, params) - var/metal_amt = round(custom_materials[getmaterialref(/datum/material/iron)]/MINERAL_MATERIAL_AMOUNT) - var/glass_amt = round(custom_materials[getmaterialref(/datum/material/glass)]/MINERAL_MATERIAL_AMOUNT) + var/metal_amt = round(custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)]/MINERAL_MATERIAL_AMOUNT) + var/glass_amt = round(custom_materials[SSmaterials.GetMaterialRef(/datum/material/glass)]/MINERAL_MATERIAL_AMOUNT) if(istype(W, /obj/item/wrench) && (metal_amt || glass_amt)) to_chat(user, "You dismantle [src].") diff --git a/code/game/objects/items/melee/misc.dm b/code/game/objects/items/melee/misc.dm index 9c544a34ef..870e97e07a 100644 --- a/code/game/objects/items/melee/misc.dm +++ b/code/game/objects/items/melee/misc.dm @@ -514,7 +514,7 @@ item_state = "mace_greyscale" lefthand_file = 'icons/mob/inhands/weapons/melee_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/melee_righthand.dmi' - material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR //Material type changes the prefix as well as the color. + material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS //Material type changes the prefix as well as the color. custom_materials = list(/datum/material/iron = 12000) //Defaults to an Iron Mace. slot_flags = ITEM_SLOT_BELT force = 14 diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index f07b9bfd33..f707c02ce9 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -48,7 +48,7 @@ merge_type = type if(custom_materials && custom_materials.len) for(var/i in custom_materials) - custom_materials[getmaterialref(i)] = mats_per_stack * amount + custom_materials[SSmaterials.GetMaterialRef(i)] = mats_per_stack * amount . = ..() if(merge) for(var/obj/item/stack/S in loc) @@ -57,7 +57,7 @@ var/list/temp_recipes = get_main_recipes() recipes = temp_recipes.Copy() if(material_type) - var/datum/material/M = getmaterialref(material_type) //First/main material + var/datum/material/M = SSmaterials.GetMaterialRef(material_type) //First/main material for(var/i in M.categories) switch(i) if(MAT_CATEGORY_RIGID) @@ -225,7 +225,7 @@ if(R.applies_mats && custom_materials && custom_materials.len) var/list/used_materials = list() for(var/i in custom_materials) - used_materials[getmaterialref(i)] = R.req_amount / R.res_amount * (MINERAL_MATERIAL_AMOUNT / custom_materials.len) + used_materials[SSmaterials.GetMaterialRef(i)] = R.req_amount / R.res_amount * (MINERAL_MATERIAL_AMOUNT / custom_materials.len) O.set_custom_materials(used_materials) //START: oh fuck i'm so sorry @@ -347,7 +347,7 @@ src.amount += amount if(custom_materials && custom_materials.len) for(var/i in custom_materials) - custom_materials[getmaterialref(i)] = MINERAL_MATERIAL_AMOUNT * src.amount + custom_materials[SSmaterials.GetMaterialRef(i)] = MINERAL_MATERIAL_AMOUNT * src.amount set_custom_materials() //Refresh update_icon() update_weight() diff --git a/code/game/objects/structures/beds_chairs/chair.dm b/code/game/objects/structures/beds_chairs/chair.dm index 0d38f5eca6..006959dcea 100644 --- a/code/game/objects/structures/beds_chairs/chair.dm +++ b/code/game/objects/structures/beds_chairs/chair.dm @@ -153,7 +153,7 @@ ///Material chair /obj/structure/chair/greyscale icon_state = "chair_greyscale" - material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR + material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS item_chair = /obj/item/chair/greyscale buildstacktype = null //Custom mats handle this @@ -377,7 +377,7 @@ /obj/item/chair/greyscale icon_state = "chair_greyscale_toppled" item_state = "chair_greyscale" - material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR + material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS origin_type = /obj/structure/chair/greyscale /obj/item/chair/stool diff --git a/code/game/objects/structures/table_frames.dm b/code/game/objects/structures/table_frames.dm index e3cd053d94..7e2922279b 100644 --- a/code/game/objects/structures/table_frames.dm +++ b/code/game/objects/structures/table_frames.dm @@ -41,7 +41,7 @@ make_new_table(material.tableVariant) else if(material.get_amount() < 1) - to_chat(user, "You need one metal sheet to do this!") + to_chat(user, "You need one sheet to do this!") return to_chat(user, "You start adding [material] to [src]...") if(do_after(user, 20, target = src) && material.use(1)) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 4eba21b8f9..c42de7ce0f 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -212,7 +212,7 @@ /obj/structure/table/greyscale icon = 'icons/obj/smooth_structures/table_greyscale.dmi' icon_state = "table" - material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR + material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS buildstack = null //No buildstack, so generate from mat datums /* diff --git a/code/modules/antagonists/swarmer/swarmer.dm b/code/modules/antagonists/swarmer/swarmer.dm index 99d12972d8..63e4e36b36 100644 --- a/code/modules/antagonists/swarmer/swarmer.dm +++ b/code/modules/antagonists/swarmer/swarmer.dm @@ -191,7 +191,7 @@ return 0 /obj/item/IntegrateAmount() //returns the amount of resources gained when eating this item - if(custom_materials[getmaterialref(/datum/material/iron)] || custom_materials[getmaterialref(/datum/material/glass)]) + if(custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)] || custom_materials[SSmaterials.GetMaterialRef(/datum/material/glass)]) return 1 return ..() diff --git a/code/modules/cargo/exports/materials.dm b/code/modules/cargo/exports/materials.dm index a9d3b25d90..675cbb2be0 100644 --- a/code/modules/cargo/exports/materials.dm +++ b/code/modules/cargo/exports/materials.dm @@ -15,10 +15,10 @@ if(!isitem(O)) return 0 var/obj/item/I = O - if(!(getmaterialref(material_id) in I.custom_materials)) + if(!(SSmaterials.GetMaterialRef(material_id) in I.custom_materials)) return 0 - var/amount = I.custom_materials[getmaterialref(material_id)] + var/amount = I.custom_materials[SSmaterials.GetMaterialRef(material_id)] if(istype(I, /obj/item/stack/ore)) amount *= 0.8 // Station's ore redemption equipment is really goddamn good. diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index 50e458a224..e176943aa9 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -243,7 +243,7 @@ icon_state = "knight_greyscale" item_state = "knight_greyscale" armor = list("melee" = 35, "bullet" = 10, "laser" = 10, "energy" = 10, "bomb" = 10, "bio" = 10, "rad" = 10, "fire" = 40, "acid" = 40) - material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR //Can change color and add prefix + material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS //Can change color and add prefix /obj/item/clothing/head/helmet/skull name = "skull helmet" diff --git a/code/modules/clothing/suits/armor.dm b/code/modules/clothing/suits/armor.dm index 1f0214cade..3b84a227ef 100644 --- a/code/modules/clothing/suits/armor.dm +++ b/code/modules/clothing/suits/armor.dm @@ -267,7 +267,7 @@ icon_state = "knight_greyscale" item_state = "knight_greyscale" armor = list("melee" = 35, "bullet" = 10, "laser" = 10, "energy" = 10, "bomb" = 10, "bio" = 10, "rad" = 10, "fire" = 40, "acid" = 40) - material_flags = MATERIAL_ADD_PREFIX //Can change color and add prefix + material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS //Can change color and add prefix /obj/item/clothing/suit/armor/vest/durathread name = "makeshift vest" diff --git a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm index eddd1bdc3f..24dd99e5e0 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm @@ -310,7 +310,7 @@ for(var/obj/item/O in ingredients) O.microwave_act(src) if(O.custom_materials?.len) - metal += O.custom_materials[getmaterialref(/datum/material/iron)] + metal += O.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)] if(metal) spark() diff --git a/code/modules/hydroponics/biogenerator.dm b/code/modules/hydroponics/biogenerator.dm index 6f3c8c9047..f7715e7320 100644 --- a/code/modules/hydroponics/biogenerator.dm +++ b/code/modules/hydroponics/biogenerator.dm @@ -196,7 +196,7 @@ dat += "x5" if(ispath(D.build_path, /obj/item/stack)) dat += "x10" - dat += "([D.materials[getmaterialref(/datum/material/biomass)]/efficiency])
" + dat += "([D.materials[SSmaterials.GetMaterialRef(/datum/material/biomass)]/efficiency])
" dat += "" else dat += "
No container inside, please insert container.
" @@ -233,14 +233,14 @@ menustat = "void" /obj/machinery/biogenerator/proc/check_cost(list/materials, multiplier = 1, remove_points = TRUE) - if(materials.len != 1 || materials[1] != getmaterialref(/datum/material/biomass)) + if(materials.len != 1 || materials[1] != SSmaterials.GetMaterialRef(/datum/material/biomass)) return FALSE - if (materials[getmaterialref(/datum/material/biomass)]*multiplier/efficiency > points) + if (materials[SSmaterials.GetMaterialRef(/datum/material/biomass)]*multiplier/efficiency > points) menustat = "nopoints" return FALSE else if(remove_points) - points -= materials[getmaterialref(/datum/material/biomass)]*multiplier/efficiency + points -= materials[SSmaterials.GetMaterialRef(/datum/material/biomass)]*multiplier/efficiency update_icon() updateUsrDialog() return TRUE diff --git a/code/modules/integrated_electronics/core/printer.dm b/code/modules/integrated_electronics/core/printer.dm index cdccc92cfd..5f6440bffb 100644 --- a/code/modules/integrated_electronics/core/printer.dm +++ b/code/modules/integrated_electronics/core/printer.dm @@ -190,10 +190,10 @@ var/cost = 400 if(ispath(build_type, /obj/item/electronic_assembly)) var/obj/item/electronic_assembly/E = SScircuit.cached_assemblies[build_type] - cost = E.custom_materials[getmaterialref(/datum/material/iron)] + cost = E.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)] else if(ispath(build_type, /obj/item/integrated_circuit)) var/obj/item/integrated_circuit/IC = SScircuit.cached_components[build_type] - cost = IC.custom_materials[getmaterialref(/datum/material/iron)] + cost = IC.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)] else if(!(build_type in SScircuit.circuit_fabricator_recipe_list["Tools"])) return diff --git a/code/modules/integrated_electronics/core/saved_circuits.dm b/code/modules/integrated_electronics/core/saved_circuits.dm index cbf3bba616..61ada24b25 100644 --- a/code/modules/integrated_electronics/core/saved_circuits.dm +++ b/code/modules/integrated_electronics/core/saved_circuits.dm @@ -260,7 +260,7 @@ blocks["max_space"] = assembly.max_components // Start keeping track of total metal cost - blocks["metal_cost"] = assembly.custom_materials[getmaterialref(/datum/material/iron)] + blocks["metal_cost"] = assembly.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)] // Block 2. Components. @@ -291,7 +291,7 @@ // Update estimated assembly complexity, taken space and material cost blocks["complexity"] += component.complexity blocks["used_space"] += component.size - blocks["metal_cost"] += component.custom_materials[getmaterialref(/datum/material/iron)] + blocks["metal_cost"] += component.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)] // Check if the assembly requires printer upgrades if(!(component.spawn_flags & IC_SPAWN_DEFAULT)) diff --git a/code/modules/integrated_electronics/subtypes/manipulation.dm b/code/modules/integrated_electronics/subtypes/manipulation.dm index 9b275d85fe..3183a6d0e6 100644 --- a/code/modules/integrated_electronics/subtypes/manipulation.dm +++ b/code/modules/integrated_electronics/subtypes/manipulation.dm @@ -414,7 +414,7 @@ var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) set_pin_data(IC_OUTPUT, 2, materials.total_amount) for(var/I in 1 to mtypes.len) - var/datum/material/M = materials.materials[getmaterialref(I)] + var/datum/material/M = materials.materials[SSmaterials.GetMaterialRef(I)] var/amount = materials[M] if(M) set_pin_data(IC_OUTPUT, I+2, amount) @@ -452,7 +452,7 @@ continue if(!mt) //Invalid input if(U>0) - if(materials.retrieve_sheets(U, getmaterialref(mtypes[I]), T)) + if(materials.retrieve_sheets(U, SSmaterials.GetMaterialRef(mtypes[I]), T)) suc = TRUE else if(mt.transer_amt_to(materials, U, mtypes[I])) diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm index 9561684414..512fa8f3e4 100644 --- a/code/modules/mining/machine_processing.dm +++ b/code/modules/mining/machine_processing.dm @@ -86,7 +86,7 @@ proximity_monitor = new(src, 1) AddComponent(/datum/component/material_container, list(/datum/material/iron, /datum/material/glass, /datum/material/silver, /datum/material/gold, /datum/material/diamond, /datum/material/plasma, /datum/material/uranium, /datum/material/bananium, /datum/material/titanium, /datum/material/bluespace), INFINITY, TRUE, /obj/item/stack) stored_research = new /datum/techweb/specialized/autounlocking/smelter - selected_material = getmaterialref(/datum/material/iron) + selected_material = SSmaterials.GetMaterialRef(/datum/material/iron) /obj/machinery/mineral/processing_unit/Destroy() CONSOLE = null diff --git a/code/modules/mining/mint.dm b/code/modules/mining/mint.dm index c9f9a2cfbb..d04c0104e5 100644 --- a/code/modules/mining/mint.dm +++ b/code/modules/mining/mint.dm @@ -29,7 +29,7 @@ /datum/material/plastic, /datum/material/runite ), MINERAL_MATERIAL_AMOUNT * 50, FALSE, /obj/item/stack) - chosen = getmaterialref(chosen) + chosen = SSmaterials.GetMaterialRef(chosen) /obj/machinery/mineral/mint/process() var/turf/T = get_step(src, input_dir) diff --git a/code/modules/mining/ores_coins.dm b/code/modules/mining/ores_coins.dm index 67c26abaef..4f9bad2f0f 100644 --- a/code/modules/mining/ores_coins.dm +++ b/code/modules/mining/ores_coins.dm @@ -320,7 +320,7 @@ GLOBAL_LIST_INIT(sand_recipes, list(\ throwforce = 2 w_class = WEIGHT_CLASS_TINY custom_materials = list(/datum/material/iron = 400) - material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR + material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS var/string_attached var/list/sideslist = list("heads","tails") var/cooldown = 0 diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm index f3e0816b1b..f92a8430b9 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules.dm @@ -97,8 +97,8 @@ var/obj/item/stack/S = I if(is_type_in_list(S, list(/obj/item/stack/sheet/metal, /obj/item/stack/rods, /obj/item/stack/tile/plasteel))) - if(S.custom_materials?.len && S.custom_materials[getmaterialref(/datum/material/iron)]) - S.cost = S.custom_materials[getmaterialref(/datum/material/iron)] * 0.25 + if(S.custom_materials?.len && S.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)]) + S.cost = S.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)] * 0.25 S.source = get_or_create_estorage(/datum/robot_energy_storage/metal) else if(istype(S, /obj/item/stack/sheet/glass)) diff --git a/code/modules/research/designs.dm b/code/modules/research/designs.dm index 0f9c64545a..f3ac118134 100644 --- a/code/modules/research/designs.dm +++ b/code/modules/research/designs.dm @@ -53,7 +53,7 @@ other types of metals and chemistry for reagents). for(var/i in materials) //Go through all of our materials, get the subsystem instance, and then replace the list. var/amount = materials[i] if(!istext(i)) //Not a category, so get the ref the normal way - var/datum/material/M = getmaterialref(i) + var/datum/material/M = SSmaterials.GetMaterialRef(i) temp_list[M] = amount else temp_list[i] = amount