Porting a couple material datums code updates and fixes.

This commit is contained in:
Ghommie
2020-03-04 15:59:46 +01:00
parent 7a539d0a78
commit f2c8a7cd6f
28 changed files with 70 additions and 72 deletions

View File

@@ -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

View File

@@ -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))

View File

@@ -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]))